codeTracing.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. console.log(res,7)
  107. if (res.code == 200) {
  108. this.gasCylinderList = res.data.gasCylinder
  109. this.operationLogList = res.data.operationLog
  110. }
  111. })
  112. } else {
  113. uni.$u.toast('请先完善信息')
  114. }
  115. },
  116. // 普通类型文字匹配
  117. initDictvalue(value, list, type) {
  118. let name = ''
  119. if (list) {
  120. list.forEach(item => {
  121. if (value[type] === item.value) {
  122. name = item.label
  123. }
  124. })
  125. }
  126. return name
  127. },
  128. // 去订气
  129. goBooking() {
  130. uni.redirectTo({
  131. url: '/pages/indexRouter'
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .card_order_details {
  139. padding: 30rpx 40rpx 10rpx 40rpx;
  140. background-color: #fff;
  141. }
  142. .details_title {
  143. display: flex;
  144. justify-content: center;
  145. padding: 20rpx;
  146. color: #333;
  147. font-size: 34rpx;
  148. font-weight: 500;
  149. margin-bottom: 10rpx;
  150. }
  151. .details_title1 {
  152. color: #333;
  153. font-size: 34rpx;
  154. font-weight: 500;
  155. margin-bottom: 10rpx;
  156. margin-left: 30rpx;
  157. }
  158. .card_search {
  159. display: flex;
  160. align-items: center;
  161. margin: 20rpx 0rpx;
  162. }
  163. .card_input {
  164. width: 100%;
  165. margin-left: 30rpx;
  166. margin-right: 30rpx;
  167. }
  168. .line_title {
  169. color: red;
  170. }
  171. .card_basic_information {
  172. border-top: 6px solid #f5f5f5;
  173. padding: 20rpx;
  174. }
  175. .headline {
  176. font-size: 32rpx;
  177. color: #000;
  178. padding: 0rpx 10rpx 20rpx 10rpx;
  179. border-bottom: 1rpx solid #e7e6e4;
  180. }
  181. .card_basics {
  182. width: 100%;
  183. display: flex;
  184. margin-bottom: 14rpx;
  185. }
  186. .basics_title {
  187. color: #303133;
  188. font-size: 30rpx;
  189. }
  190. .basics_title1 {
  191. color: #606266;
  192. font-size: 30rpx;
  193. }
  194. .basics_left {
  195. width: 38%;
  196. text-align: right;
  197. font-size: 28rpx;
  198. color: #3eacef;
  199. }
  200. .basics_right {
  201. width: 62%;
  202. text-align: left;
  203. padding-left: 20rpx;
  204. font-size: 28rpx;
  205. }
  206. .card_Booking {
  207. position: fixed;
  208. bottom: 50rpx;
  209. right: 20rpx;
  210. width: 100rpx;
  211. height: 100rpx;
  212. border-radius: 50%;
  213. color: #fff;
  214. background-color: #5ac725;
  215. box-shadow: 0 2px 12px 0 rgba(90, 199, 37, 0.5)
  216. }
  217. </style>