codeTracing.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="card_code_tracing">
  3. <u-navbar title="二维码溯源" autoBack placeholder></u-navbar>
  4. <!-- <view class="details_title">二维码溯源</view> -->
  5. <view class="details_title1">单位内编号 <span class="line_title">*</span></view>
  6. <view class="card_search">
  7. <view class="card_input">
  8. <u-search :showAction="true" v-model="frequencyCoding" actionText="搜索" :animation="true"
  9. @custom="traceSource(frequencyCoding)"></u-search>
  10. <!-- <u-input border="surround" v-model="frequencyCoding"></u-input> -->
  11. </view>
  12. </view>
  13. <view class="card_basic_information" v-if="gasCylinderList.pro_name">
  14. <view class="headline">基础信息</view>
  15. <view style="padding: 20rpx;">
  16. <view class="card_basics" v-for="(item,index) in basicsList" :key="index">
  17. <view class="basics_title basics_left">{{item.title}}:</view>
  18. <view class="basics_title1 basics_right"
  19. v-if="['fill_media','location','status'].includes(item.field)">
  20. <!-- {{initDictvalue(gasCylinderList,item.options,item.field)}} -->
  21. {{gasCylinderList[`${item.field}`]}}
  22. </view>
  23. <view class="basics_title1 basics_right" v-else>{{gasCylinderList[`${item.field}`]}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="card_basic_information" v-if="operationLogList.length > 0">
  28. <view class="headline">物流信息</view>
  29. <view style="padding: 20rpx;">
  30. <step-bar :stepList="operationLogList" id="step"></step-bar>
  31. </view>
  32. </view>
  33. <view style="margin-top: 50rpx;" v-if="!gasCylinderList.pro_name && operationLogList.length === 0">
  34. <u-empty mode="search" text="当前气瓶没有溯源信息"></u-empty>
  35. </view>
  36. <view style="width: 100%; height: 200rpx;"></view>
  37. <!-- <view class="card_Booking center_in" @click="goBooking">订气</view> -->
  38. </view>
  39. </template>
  40. <script>
  41. import stepBar from '@/components/StepBar.vue'
  42. import {
  43. neurogen,
  44. attribution,
  45. cylinderCondition
  46. } from '@/static/js/blockSort.js'
  47. export default {
  48. components: {
  49. stepBar,
  50. },
  51. data() {
  52. return {
  53. frequencyCoding: '',
  54. gasCylinderList: {},
  55. operationLogList: [],
  56. basicsList: [{
  57. title: '产权单位',
  58. field: 'enterprise_name',
  59. }, {
  60. title: '设备品种',
  61. field: 'pro_variety',
  62. }, {
  63. title: '产品名称',
  64. field: 'pro_name',
  65. }, {
  66. title: '(出厂)编号',
  67. field: 'pro_no',
  68. }, {
  69. title: '充装介质',
  70. field: 'fill_media',
  71. }, {
  72. title: '单位内编号',
  73. field: 'inner_code',
  74. }, {
  75. title: '制造单位',
  76. field: 'make_unit',
  77. }, {
  78. title: '生产日期',
  79. field: 'make_time',
  80. }, {
  81. title: '公称工作压力',
  82. field: 'work_pressure',
  83. }, {
  84. title: '容积(L)',
  85. field: 'volume',
  86. }, {
  87. title: '最近一次检验日期',
  88. field: 'check_time',
  89. }, {
  90. title: '下次检验日期',
  91. field: 'next_check_time',
  92. }],
  93. }
  94. },
  95. onLoad(option) {
  96. if (option.code) {
  97. this.frequencyCoding = option.code
  98. this.traceSource(option.code)
  99. }
  100. },
  101. methods: {
  102. // 扫码溯源
  103. traceSource(code) {
  104. if (code) {
  105. this.$api.get('/api/gas-cylinder/uid/' + code).then(res => {
  106. if (res.code == 200) {
  107. this.gasCylinderList = res.data.gasCylinder
  108. this.operationLogList = res.data.operationLog
  109. }
  110. })
  111. } else {
  112. uni.$u.toast('请先完善信息')
  113. }
  114. },
  115. // 普通类型文字匹配
  116. initDictvalue(value, list, type) {
  117. let name = ''
  118. if (list) {
  119. list.forEach(item => {
  120. if (value[type] === item.value) {
  121. name = item.label
  122. }
  123. })
  124. }
  125. return name
  126. },
  127. // 去订气
  128. goBooking() {
  129. uni.redirectTo({
  130. url: '/pages/indexRouter'
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .card_order_details {
  138. padding: 30rpx 40rpx 10rpx 40rpx;
  139. background-color: #fff;
  140. }
  141. .details_title {
  142. display: flex;
  143. justify-content: center;
  144. padding: 20rpx;
  145. color: #333;
  146. font-size: 34rpx;
  147. font-weight: 500;
  148. margin-bottom: 10rpx;
  149. }
  150. .details_title1 {
  151. color: #333;
  152. font-size: 34rpx;
  153. font-weight: 500;
  154. margin-bottom: 10rpx;
  155. margin-left: 30rpx;
  156. }
  157. .card_search {
  158. display: flex;
  159. align-items: center;
  160. margin: 20rpx 0rpx;
  161. }
  162. .card_input {
  163. width: 100%;
  164. margin-left: 30rpx;
  165. margin-right: 30rpx;
  166. }
  167. .line_title {
  168. color: red;
  169. }
  170. .card_basic_information {
  171. border-top: 6px solid #f5f5f5;
  172. padding: 20rpx;
  173. }
  174. .headline {
  175. font-size: 32rpx;
  176. color: #000;
  177. padding: 0rpx 10rpx 20rpx 10rpx;
  178. border-bottom: 1rpx solid #e7e6e4;
  179. }
  180. .card_basics {
  181. width: 100%;
  182. display: flex;
  183. margin-bottom: 14rpx;
  184. }
  185. .basics_title {
  186. color: #303133;
  187. font-size: 30rpx;
  188. }
  189. .basics_title1 {
  190. color: #606266;
  191. font-size: 30rpx;
  192. }
  193. .basics_left {
  194. width: 38%;
  195. text-align: right;
  196. font-size: 28rpx;
  197. color: #3eacef;
  198. }
  199. .basics_right {
  200. width: 62%;
  201. text-align: left;
  202. padding-left: 20rpx;
  203. font-size: 28rpx;
  204. }
  205. .card_Booking {
  206. position: fixed;
  207. bottom: 50rpx;
  208. right: 20rpx;
  209. width: 100rpx;
  210. height: 100rpx;
  211. border-radius: 50%;
  212. color: #fff;
  213. background-color: #5ac725;
  214. box-shadow: 0 2px 12px 0 rgba(90, 199, 37, 0.5)
  215. }
  216. </style>