codeTracing.vue 5.1 KB

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