gmReport.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <view class="">
  3. <view class="banner">
  4. <view class="step-box">
  5. <up-steps :current="orderStatus" activeColor="#b5aa90">
  6. <up-steps-item
  7. :title="item.name"
  8. v-for="item in stepData"
  9. :key="item.name"
  10. >
  11. </up-steps-item>
  12. </up-steps>
  13. </view>
  14. <view class="block">
  15. <view class="check">
  16. <view class="header">
  17. <span class="title">合后检测确认单</span>
  18. </view>
  19. <view class="desc"
  20. >根据双方认可的检测内容及要求进行认定,为客户合后检测认定结果如下:</view
  21. >
  22. <view class="table">
  23. <view class="title">客户寄送品</view>
  24. <view class="tab_header">
  25. <up-row>
  26. <up-col :span="3">
  27. <view class="col">类型</view>
  28. </up-col>
  29. <up-col :span="3">
  30. <view class="col">来样重</view>
  31. </up-col>
  32. <up-col :span="3">
  33. <view class="col">实际重</view>
  34. </up-col>
  35. <up-col :span="3">
  36. <view class="col">成色</view>
  37. </up-col>
  38. </up-row>
  39. </view>
  40. <view class="tab_content">
  41. <view>
  42. <up-row v-for="item in detectionDetails" :key="item.id">
  43. <up-col :span="3">
  44. <view class="col">{{ getCate(item.type) }}</view>
  45. </up-col>
  46. <up-col :span="3">
  47. <view class="col"
  48. >{{ Number(item.userEstimatedWeight).toFixed(2) }}g</view
  49. >
  50. </up-col>
  51. <up-col :span="3">
  52. <view class="col"
  53. >{{ Number(item.discountedWeight).toFixed(2) }}g</view
  54. >
  55. </up-col>
  56. <up-col :span="3">
  57. <view class="col">{{ item.purity }}%</view>
  58. </up-col>
  59. </up-row>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="end">
  64. <view class="end-bttom">
  65. <span class="total">
  66. 总计:
  67. <span class="price">{{ deTotalWeight.toFixed(2) }}g</span>
  68. </span>
  69. </view>
  70. <view class="extra"
  71. >即:客户对{{
  72. detectionReport.inspectionTime
  73. }}合后检测重量和回收价无异议</view
  74. >
  75. <view class="sign">
  76. <span
  77. >检测人:{{ detectionReport.inspectorNickname || "系统" }}</span
  78. >
  79. </view>
  80. <view class="time">
  81. {{ detectionReport.inspectionTime }}
  82. </view>
  83. </view>
  84. <view style="font-size: 14px; padding: 10px">
  85. <span style="font-size: 16px; font-weight: 700">注:</span>
  86. <span>折算公式:兑料重量 = 折足重量 = 来料熔后重量 * 折足成色</span>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="block">
  91. <view class="check">
  92. <view class="header">
  93. <span class="title">检测图片</span>
  94. </view>
  95. <view class="checlImage">
  96. <cl-upload
  97. v-model="detectionImages"
  98. :add="false"
  99. :remove="false"
  100. ></cl-upload>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view style="height: 70px"></view>
  106. <view class="footer" v-if="orderStatus == 2">
  107. <view class="btn" @click="next()">确认报告</view>
  108. </view>
  109. </view>
  110. </template>
  111. <script setup>
  112. import { onMounted, computed, ref } from "vue";
  113. import { onLoad } from "@dcloudio/uni-app";
  114. import { postalDepositAPI } from "@/api/functions";
  115. const stepData = ref([
  116. {
  117. name: "待收货",
  118. isNow: 0,
  119. type: 1,
  120. },
  121. {
  122. name: "待检测",
  123. isNow: 0,
  124. type: 1,
  125. },
  126. {
  127. name: "待确认",
  128. isNow: 0,
  129. type: 1,
  130. },
  131. {
  132. name: "待充值",
  133. isNow: 0,
  134. type: 1,
  135. },
  136. {
  137. name: "已完成",
  138. isNow: 1,
  139. type: 0,
  140. },
  141. ]);
  142. // 注意:onLoad是uni-app的生命周期,如果是纯Vue3,应使用onMounted
  143. // 替代Vue2的methods中的方法
  144. const getCate = (cate) => {
  145. // console.log(cate);
  146. switch (cate) {
  147. case 1:
  148. return "黄金";
  149. case 3:
  150. return "白银";
  151. case 2:
  152. return "铂金";
  153. case 4:
  154. return "K金";
  155. }
  156. };
  157. // 检测信息-成色类型等
  158. const detectionDetails = ref([]);
  159. // 检测详情
  160. const detectionReport = ref({});
  161. // 检测图片
  162. const detectionImages = ref([]);
  163. // 订单号
  164. const orderNo = ref("");
  165. // 订单状态
  166. const orderStatus = ref(4);
  167. onLoad((options) => {
  168. if (options.orderInfo) {
  169. // 先解码再解析
  170. const orderInfoStr = decodeURIComponent(options.orderInfo);
  171. const res = JSON.parse(orderInfoStr);
  172. detectionDetails.value = res.goldBalances;
  173. detectionReport.value = res;
  174. detectionImages.value = JSON.parse(res.inspectionImage);
  175. orderNo.value = res.id;
  176. orderStatus.value = res.status;
  177. }
  178. });
  179. // 确认报告
  180. const next = async () => {
  181. const res = await postalDepositAPI(orderNo.value);
  182. uni.showToast({
  183. title: "确认成功",
  184. duration: 1000,
  185. });
  186. setTimeout(() => {
  187. uni.redirectTo({
  188. url: "/pages/users/vault/storeMetal/order",
  189. });
  190. }, 1000);
  191. };
  192. const deTotalWeight = computed(() => {
  193. if (detectionReport.value.goldBalances) {
  194. const totalWeight = detectionReport.value.goldBalances.reduce(
  195. (sum, material) => {
  196. return sum + (Number(material.discountedWeight) || 0);
  197. },
  198. 0
  199. );
  200. return totalWeight;
  201. }
  202. });
  203. </script>
  204. <style scoped lang="scss">
  205. .banner {
  206. padding: 10px 15px;
  207. background: $uni-bg-primary; /* fallback for old browsers */
  208. .step-box {
  209. margin: 30rpx 0;
  210. width: 100%;
  211. background: #fff;
  212. height: 150rpx;
  213. display: flex;
  214. flex-direction: column;
  215. justify-content: center;
  216. border-radius: 4px;
  217. &::v-deep .u-steps--row {
  218. flex: none !important;
  219. }
  220. &::v-deep .u-text__value {
  221. font-size: 24rpx !important;
  222. }
  223. }
  224. }
  225. .block {
  226. margin-bottom: 10px;
  227. .check {
  228. background-color: #fff;
  229. border-radius: 4px;
  230. padding-top: 10px;
  231. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  232. }
  233. .header {
  234. font-size: 14px;
  235. font-weight: 700;
  236. padding-left: 10px;
  237. margin-left: 10px;
  238. position: relative;
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. &::before {
  243. position: absolute; /*绝对定位*/
  244. top: 50%; /*Y轴方向偏移自身高度的50%*/
  245. transform: translatey(-40%); /*Y轴方向偏移微调*/
  246. left: 0px; /*紧靠容器左边缘*/
  247. content: ""; /*伪元素需要有内容才能显示*/
  248. width: 2px; /*伪元素宽度*/
  249. height: 18px; /*伪元素高度*/
  250. background-color: #daa520; /*伪元素颜色*/
  251. }
  252. .title {
  253. font-size: 18px;
  254. }
  255. }
  256. .desc {
  257. padding: 8px 10px;
  258. color: #888;
  259. font-size: 14px;
  260. }
  261. }
  262. .table {
  263. padding: 14px 10px;
  264. .title {
  265. text-align: center;
  266. padding: 4px 0;
  267. color: #fff;
  268. font-weight: 700;
  269. font-size: 16px;
  270. width: 100%;
  271. background-color: #b5aa90;
  272. }
  273. .tab_header {
  274. border-left: 1px solid #b5aa90;
  275. font-size: 18px;
  276. background-color: #fff;
  277. .col {
  278. padding: 12px 0;
  279. line-height: 19px;
  280. }
  281. }
  282. .tab_content {
  283. border-left: 1px solid #b5aa90;
  284. font-size: 16px;
  285. background-color: #fff;
  286. .col {
  287. padding: 12px 0;
  288. line-height: 19px;
  289. }
  290. }
  291. .tab_header .col,
  292. .tab_content .col {
  293. border-bottom: 1px solid #b5aa90;
  294. border-right: 1px solid #b5aa90;
  295. text-align: center;
  296. }
  297. .symbol-name {
  298. font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
  299. font-size: 20px;
  300. color: #ffbf24;
  301. }
  302. }
  303. .end {
  304. width: 100%;
  305. display: inline-block;
  306. text-align: right;
  307. .end-bttom {
  308. color: #888;
  309. .total {
  310. font-size: 16px;
  311. }
  312. .price {
  313. margin-right: 10px;
  314. color: #ffa034;
  315. }
  316. }
  317. .extra {
  318. font-size: 14px;
  319. margin-top: 15px;
  320. color: #888;
  321. margin-right: 10px;
  322. }
  323. .sign {
  324. margin: 10px;
  325. }
  326. .time {
  327. padding: 10px;
  328. }
  329. }
  330. .checlImage {
  331. padding: 10px;
  332. }
  333. .footer {
  334. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
  335. position: fixed;
  336. width: 100%;
  337. border-radius: 8px 8px 0 0;
  338. background-color: #fff;
  339. bottom: 0;
  340. height: 60px;
  341. display: flex;
  342. justify-content: space-around;
  343. align-items: center;
  344. .btn {
  345. color: #fff;
  346. font-weight: 700;
  347. margin: 0 15px;
  348. border-radius: 10px;
  349. width: 100px;
  350. padding: 10px;
  351. text-align: center;
  352. background-color: #cc9933;
  353. }
  354. }
  355. </style>