OrderDetailView.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="order-detail-view">
  3. <!-- 页面切换 -->
  4. <view
  5. class="page-item"
  6. v-show="activeIndex === 0"
  7. >
  8. <PageOne
  9. :order-detail="orderDetail"
  10. :order-id="orderId"
  11. :current-receipt="currentReceipt"
  12. @next="handleNext"
  13. />
  14. </view>
  15. <view
  16. class="page-item"
  17. v-show="activeIndex === 1"
  18. >
  19. <PageTwo
  20. :order-detail="orderDetail"
  21. :order-id="orderId"
  22. :current-receipt="currentReceipt"
  23. :follow-up-list="followUpList"
  24. @next="handleNext"
  25. />
  26. </view>
  27. <view
  28. class="page-item"
  29. v-show="activeIndex === 2"
  30. >
  31. <PageThree
  32. :order-detail="orderDetail"
  33. :order-id="orderId"
  34. :current-receipt="currentReceipt"
  35. @next="handleNext"
  36. @save="handleSave"
  37. @confirm-pay="handleConfirmPay"
  38. ref="pageThreeRef"
  39. />
  40. </view>
  41. <view
  42. class="page-item"
  43. v-show="activeIndex === 3"
  44. >
  45. <PageFour
  46. :order-detail="orderDetail"
  47. :current-receipt="currentReceipt"
  48. @next="handleNext"
  49. @confirm-warehouse="handleConfirmWarehouse"
  50. />
  51. </view>
  52. <!-- 页面导航 -->
  53. <ul class="page-navigation">
  54. <li
  55. v-for="(tab, index) in tabs"
  56. :key="index"
  57. :class="{ 'active': activeIndex === index }"
  58. @click="handleTabClick(index)"
  59. >
  60. {{ tab }}
  61. </li>
  62. </ul>
  63. </view>
  64. </template>
  65. <script>
  66. import PageOne from './PageOne.vue'
  67. import PageTwo from './PageTwo.vue'
  68. import PageThree from './PageThree.vue'
  69. import PageFour from './PageFour.vue'
  70. export default {
  71. name: 'OrderDetailView',
  72. components: {
  73. PageOne,
  74. PageTwo,
  75. PageThree,
  76. PageFour
  77. },
  78. props: {
  79. orderDetail: {
  80. type: Object,
  81. default: () => ({})
  82. },
  83. topInfo: {
  84. type: Object,
  85. default: () => ({})
  86. },
  87. orderId: {
  88. type: String,
  89. default: ''
  90. },
  91. currentReceipt: {
  92. type: Object,
  93. default: () => ({})
  94. }
  95. },
  96. data() {
  97. return {
  98. activeIndex: 0,
  99. tabs: ['一', '二', '三', '四'],
  100. // 表单数据
  101. formData: {
  102. formOne: {},
  103. formTwo: {},
  104. formThree: {},
  105. formFour: {}
  106. },
  107. pageThreeForm: {},
  108. fileIds: '',
  109. // 跟进记录
  110. followUpList: []
  111. }
  112. },
  113. watch: {
  114. orderDetail: {
  115. handler(newVal) {
  116. if (newVal && newVal.clueId) {
  117. this.loadFollowUpList()
  118. }
  119. },
  120. deep: true,
  121. immediate: true
  122. }
  123. },
  124. methods: {
  125. /**
  126. * 加载跟进记录
  127. */
  128. async loadFollowUpList() {
  129. try {
  130. const res = await uni.$u.api.getDuplicateOrderFollowListByClueId({
  131. clueId: this.orderDetail.clueId
  132. })
  133. const data = res.data || {}
  134. const followUpList = []
  135. for (const key in data) {
  136. followUpList.push(...(data[key] || []))
  137. }
  138. this.followUpList = followUpList
  139. } catch (error) {
  140. console.error('获取跟进记录失败:', error)
  141. uni.$u.toast('获取跟进记录失败')
  142. }
  143. },
  144. /**
  145. * 处理下一步
  146. */
  147. handleNext({ nowPage, form }) {
  148. this.activeIndex++
  149. if (nowPage) {
  150. this.formData[nowPage] = form
  151. }
  152. // 当切换到第三页时,更新第三页的图片列表
  153. if (nowPage === 'formTwo' && this.$refs.pageThreeRef) {
  154. this.$refs.pageThreeRef.refreshImageList()
  155. }
  156. },
  157. /**
  158. * 处理保存
  159. */
  160. handleNeedSave({ nowPage, form, fileIds }) {
  161. this.pageThreeForm = form
  162. this.fileIds = fileIds
  163. },
  164. /**
  165. * 处理确认支付
  166. */
  167. async handleConfirmPay() {
  168. try {
  169. const response = await uni.$u.api.saveOrderFileAndTransfer({
  170. id: this.orderId,
  171. clueId: this.orderDetail.clueId
  172. })
  173. uni.$u.toast(response.msg || '支付成功')
  174. } catch (error) {
  175. console.error('支付失败:', error)
  176. uni.$u.toast(`支付失败:${error}`)
  177. }
  178. },
  179. /**
  180. * 处理确认入库
  181. */
  182. async handleConfirmWarehouse({ warehouseInfo }) {
  183. try {
  184. const params = {
  185. searchValue: this.orderDetail.searchValue,
  186. createBy: this.orderDetail.createBy,
  187. createTime: this.orderDetail.createTime,
  188. updateBy: this.orderDetail.updateBy,
  189. updateTime: this.orderDetail.updateTime,
  190. params: this.orderDetail.params,
  191. id: this.currentReceipt.id,
  192. sendFormId: this.orderId,
  193. clueId: this.orderDetail.clueId,
  194. item: warehouseInfo.item || '',
  195. code: warehouseInfo.codeStorage || '',
  196. phone: this.orderDetail.phone,
  197. tableFee: warehouseInfo.watchPrice || '',
  198. benefitFee: warehouseInfo.benefitFee || '',
  199. freight: warehouseInfo.freight || '',
  200. checkCodeFee: warehouseInfo.checkCodeFee || '',
  201. receiptRemark: `${warehouseInfo.remarks || ''};${warehouseInfo.uploadedImage || ''}`,
  202. repairAmount: warehouseInfo.repairAmount || '',
  203. grossPerformance: warehouseInfo.grossPerformance || '',
  204. expressOrderNo: warehouseInfo.expressOrderNo || '',
  205. fileIds: this.fileIds,
  206. customerServiceName: warehouseInfo.customerServiceName || '1',
  207. deptId: this.orderDetail.deptId,
  208. category: warehouseInfo.category || this.orderDetail.category,
  209. delFlag: this.orderDetail.delFlag,
  210. idCard: this.pageThreeForm.idNumber || '',
  211. paymentMethod: '小葫芦线上支付',
  212. bankCardNumber: this.pageThreeForm.bankAccount || '',
  213. bankName: this.pageThreeForm.bankName || '',
  214. customName: this.pageThreeForm.customName || ''
  215. }
  216. if (this.currentReceipt.id) {
  217. await uni.$u.api.updateReceiptForm(params)
  218. } else {
  219. await uni.$u.api.addReceiptForm(params)
  220. }
  221. uni.$u.toast('入库成功')
  222. } catch (error) {
  223. console.error('入库失败:', error)
  224. uni.$u.toast('入库失败')
  225. }
  226. },
  227. /**
  228. * 处理标签点击
  229. */
  230. handleTabClick(index) {
  231. this.activeIndex = index
  232. // 切换到第三页时刷新图片列表
  233. if (index === 2 && this.$refs.pageThreeRef) {
  234. this.$refs.pageThreeRef.refreshImageList()
  235. }
  236. }
  237. }
  238. }
  239. </script>
  240. <style scoped lang="scss">
  241. .order-detail-view {
  242. padding: 20rpx;
  243. min-height: calc(100vh - 200rpx);
  244. }
  245. .page-item {
  246. width: 100%;
  247. }
  248. .page-navigation {
  249. position: fixed;
  250. right: 20rpx;
  251. top: 40%;
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. justify-content: center;
  256. list-style: none;
  257. color: #000;
  258. font-size: 20rpx;
  259. font-weight: 800;
  260. z-index: 100;
  261. li {
  262. opacity: 0.7;
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. background-color: #fff;
  267. border-radius: 50%;
  268. width: 70rpx;
  269. height: 70rpx;
  270. line-height: 70rpx;
  271. text-align: center;
  272. margin-bottom: 20rpx;
  273. transition: all 0.3s ease-in-out;
  274. font-weight: 800;
  275. box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  276. cursor: pointer;
  277. &.active {
  278. color: #fff;
  279. opacity: 1;
  280. background-color: rgb(37 99 235 / 1);
  281. }
  282. &:hover {
  283. opacity: 0.9;
  284. transform: scale(1.05);
  285. }
  286. }
  287. }
  288. </style>