trace.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <u-sticky bgColor="#4680F9">
  4. <u-tabs :current="activeIndex" :activeStyle="{color:'#fff',fontWeight:'bold'}"
  5. :inactiveStyle="{color:'#ffffff80'}" :scrollable="false" @change="onChangeIndex" :list="list"
  6. lineColor="#fff" lineWidth="160rpx"></u-tabs>
  7. </u-sticky>
  8. <view v-if="activeIndex==0">
  9. <u-cell :border="false" :customStyle="{'background':'#f5f7fa','font-weight':'bold','padding':'10rpx 10rpx'}"
  10. title="产品信息"></u-cell>
  11. <view class="cell-list">
  12. <p class="cell-item"><span class="label">产品溯源编码</span><span>{{vehicleOrder.markingCodeName}}</span></p>
  13. <p class="cell-item"><span class="label">销售区域</span><span>{{vehicleOrder.blockRegion}}</span></p>
  14. </view>
  15. <u-cell :border="false" :customStyle="{'background':'#f5f7fa','font-weight':'bold','padding':'10rpx 10rpx'}"
  16. title="业务流程"></u-cell>
  17. <view class="cell-list">
  18. <view class="step-view">
  19. <view class="step-item" v-for="item,index in vehicleOrderFlowList" :key="index">
  20. <view class="step-status">
  21. <span class="point"
  22. :class="index == vehicleOrderFlowList.length-1?'active-point':''"></span>
  23. <span class="title">
  24. <span class="title-text">{{item.name}}</span>
  25. <span class="title-time">{{item.time}}</span>
  26. </span>
  27. </view>
  28. <view class="step-line">
  29. <span class="no-line" v-if="index == vehicleOrderFlowList.length-1"></span>
  30. <span class="line" v-else></span>
  31. <span class="info">
  32. <span style="margin-right:40rpx">{{item.showName}}</span>
  33. <span style="margin-left:50rpx;color: #083af9;" v-if="item.linkAddress"
  34. @click="todo(item)">{{item.linkTitle}}</span>
  35. </span>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view v-else>
  42. <view class="tabs-box">
  43. <view class="orderStatus-tab">
  44. <span :class="electronicValue == item.value ? 'active' : ''" v-for="item in traceElectronicTemp"
  45. @click="onElectronicChange(item)" :key="item.name">
  46. {{ item.name }}
  47. </span>
  48. </view>
  49. </view>{{"electronicUrl"+electronicUrl}}
  50. <template v-if="electronicUrl">
  51. <web-view :src="electronicUrl"></web-view>
  52. </template>
  53. <template v-else>
  54. <u-empty mode="data" icon="https://cdn.uviewui.com/uview/empty/list.png">
  55. <u-icon name="edit-pen" color="#2979ff" size="28" label="生成票据"></u-icon>
  56. </u-empty>
  57. </template>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. getTraceInfo
  64. } from '../../api/trace'
  65. export default {
  66. data() {
  67. return {
  68. showPreview: true,
  69. activeIndex: 0,
  70. electronicValue: "601",
  71. electronicUrl: "",
  72. orderId: "",
  73. tenantId: "",
  74. list: [{
  75. name: '溯源链条'
  76. }, {
  77. name: '订单票据'
  78. }],
  79. vehicleOrder: {},
  80. vehicleOrderFlowList: [{
  81. stepName: '下单',
  82. stepTime: '2022-12-21 09:32:56',
  83. showName: ['水泥出库', '库号:12号']
  84. },
  85. {
  86. stepName: '运输中',
  87. stepTime: '昨天 09:32',
  88. showName: ['【机阳县】', '水泥出厂(0571-4718283492)揽收']
  89. },
  90. ],
  91. traceElectronicTemp: [{
  92. name: '质检单',
  93. value: '101'
  94. }, {
  95. name: '合格证',
  96. value: '103'
  97. }, {
  98. name: '磅单',
  99. value: '102'
  100. }]
  101. }
  102. },
  103. onLoad(options) {
  104. console.log("获取到参数信息、", options);
  105. this.orderId = options.orderId
  106. this.tenantId = options.tenantId
  107. if (options.index) {
  108. this.activeIndex = Number(options.index)
  109. }
  110. this.bindTraceInfo()
  111. },
  112. methods: {
  113. todo(item) {
  114. console.log("开始提交连接、", item);
  115. uni.navigateTo({
  116. url: item.linkAddress
  117. })
  118. },
  119. onElectronicChange(item) {
  120. this.electronicValue = item.value
  121. this.electronicUrl = ""
  122. if (this.vehicleOrderElectronicList) {
  123. var vehicleInfo = this.vehicleOrderElectronicList.filter(p => {
  124. return p.electronicType == this.electronicValue
  125. });
  126. if (vehicleInfo) {
  127. this.electronicUrl = vehicleInfo[0].address || '';
  128. }
  129. }
  130. },
  131. onChangeIndex(e) {
  132. this.activeIndex = e.index
  133. },
  134. bindTraceInfo() {
  135. let data = {
  136. orderId: this.orderId,
  137. tenantId: this.tenantId
  138. }
  139. var that = this
  140. getTraceInfo(data).then(res => {
  141. if (res.statusCode == 200 && res.data.code == 0) {
  142. that.vehicleOrder = res.data.data.vehicleOrder
  143. that.vehicleOrderFlowList = res.data.data.vehicleOrderFlowList
  144. that.vehicleOrderElectronicList = res.data.data.vehicleOrderElectronicList
  145. // if (that.vehicleOrderElectronicList) {
  146. // var vehicleInfo = that.vehicleOrderElectronicList.filter(p => {
  147. // return p.electronicType == 101
  148. // });
  149. // if (vehicleInfo) {
  150. // console.log("开始打开文件对象,",vehicleInfo);
  151. // uni.downloadFile({
  152. // url: vehicleInfo[0].address,
  153. // success: (result) => {
  154. // const path = result.tempFilePath;
  155. // console.log("开始打开文件,",path);
  156. // uni.openDocument({
  157. // filePath: path,
  158. // fileType: 'pdf',
  159. // success: (res) => {
  160. // uni.navigateBack({
  161. // delta: 1
  162. // });
  163. // },
  164. // fail: (err) => {
  165. // uni.showToast({
  166. // title: '打开文件失败',
  167. // icon: 'none',
  168. // duration: 2000
  169. // });
  170. // }
  171. // });
  172. // }
  173. // })
  174. // }
  175. // }
  176. }
  177. console.log("当前追溯信息、", res);
  178. })
  179. },
  180. }
  181. }
  182. </script>
  183. <style>
  184. /* #ifndef APP-NVUE */
  185. page {
  186. background-color: #f5f7fa;
  187. }
  188. /* #endif */
  189. </style>
  190. <style lang="scss" scoped>
  191. @import '../../common/css/public.scss';
  192. .preview {
  193. top: 150px;
  194. }
  195. .cell-list {
  196. font-size: 30rpx;
  197. padding: 0 40rpx;
  198. background-color: #fff;
  199. .cell-item {
  200. display: flex;
  201. justify-content: space-between;
  202. line-height: 108rpx;
  203. border-bottom: 1px solid #F2F2F2;
  204. .label {
  205. color: #666666;
  206. }
  207. &:last-of-type {
  208. border: none;
  209. }
  210. }
  211. .step-view {
  212. padding: 30rpx 0;
  213. .step-item {
  214. display: flex;
  215. flex-direction: column;
  216. line-height: 64rpx;
  217. margin-bottom: 24rpx;
  218. color: #666666;
  219. font-size: 24rpx;
  220. .step-status {
  221. display: flex;
  222. align-items: center;
  223. .point {
  224. width: 18rpx;
  225. height: 18rpx;
  226. border-radius: 50%;
  227. background-color: #CBDCFD;
  228. margin-right: 36rpx;
  229. }
  230. .active-point {
  231. background-color: #528BF7;
  232. }
  233. .title {
  234. .title-text {
  235. margin-right: 40rpx;
  236. color: #000;
  237. font-size: 28rpx;
  238. font-weight: bold;
  239. }
  240. }
  241. }
  242. .step-line {
  243. display: flex;
  244. .line {
  245. position: relative;
  246. width: 2rpx;
  247. background-color: #CBDCFD;
  248. margin-right: 52rpx;
  249. transform: translate(8rpx, 0);
  250. // height: 100%;
  251. &::before {
  252. content: '';
  253. height: 32rpx;
  254. width: 2rpx;
  255. background-color: #CBDCFD;
  256. position: absolute;
  257. left: 0rpx;
  258. top: -24rpx;
  259. }
  260. &::after {
  261. content: '';
  262. height: 52rpx;
  263. width: 2rpx;
  264. background-color: #CBDCFD;
  265. position: absolute;
  266. left: 0rpx;
  267. bottom: -48rpx;
  268. }
  269. }
  270. .no-line {
  271. margin-right: 54rpx;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. </style>