PageThree.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  1. <template>
  2. <view class="page-three-container">
  3. <!-- 支付信息卡片 -->
  4. <view class="info-card">
  5. <view class="info-card-title">支付信息</view>
  6. <u-row class="info-row" justify="space-between">
  7. <u-col span="5.8">
  8. <view class="info-label">开户人</view>
  9. <u-input v-model="paymentInfo.customName" placeholder="请输入开户人姓名" class="info-input"
  10. @blur="handleCustomNameInput" />
  11. </u-col>
  12. <u-col span="5.8">
  13. <view class="info-label">银行名称</view>
  14. <u-input v-model="paymentInfo.bankName" placeholder="请输入银行名称" class="info-input"
  15. :disabled="isAlipayPayment" @blur="handleBankNameInput" />
  16. </u-col>
  17. </u-row>
  18. <u-row class="info-row">
  19. <u-col span="12">
  20. <view class="info-label">{{ bankAccountLabel }}</view>
  21. <u-input v-model="paymentInfo.bankAccount" :placeholder="bankAccountPlaceholder" class="info-input"
  22. :type="isAlipayPayment ? 'text' : 'number'" @input="handleBankAccountInput" />
  23. </u-col>
  24. </u-row>
  25. <u-row class="info-row">
  26. <u-col span="12">
  27. <view class="info-label">身份证号</view>
  28. <u-input v-model="paymentInfo.idNumber" placeholder="请输入身份证号" class="info-input"
  29. @blur="handleIdNumberInput" />
  30. </u-col>
  31. </u-row>
  32. <u-row class="info-row">
  33. <u-col span="12">
  34. <view class="info-label">支付方式选择</view>
  35. <u-radio-group iconPlacement="left" v-model="paymentMethodRadio" placement="column"
  36. @change="handlePaymentMethodRadioChange">
  37. <u-radio shape="circle" label="小葫芦线上支付" name="online" :customStyle="{marginBottom: '16rpx'}"/>
  38. <u-radio shape="circle" label="小葫芦线上支付宝" name="online_alipay" :customStyle="{marginBottom: '16rpx'}" />
  39. <u-radio shape="circle" label="线下支付" name="offline" :customStyle="{marginBottom: '16rpx'}"/>
  40. </u-radio-group>
  41. </u-col>
  42. </u-row>
  43. <u-row class="info-row">
  44. <u-col span="12">
  45. <view class="info-label">支付方式</view>
  46. <u-input :disabled="paymentMethodRadio === 'online'||paymentMethodRadio === 'online_alipay'" v-model="paymentMethod" placeholder="请输入支付方式"
  47. class="info-input" />
  48. </u-col>
  49. </u-row>
  50. </view>
  51. <!-- 高清实物图卡片 -->
  52. <view class="card-wrap">
  53. <view class="detail-image-section">
  54. <view class="detail-image-header">
  55. <text class="detail-image-title">高清实物图(拖拽排序)</text>
  56. <u-button type="primary" shape="circle" plain text="核价" size="small" class="pricing-btn" @click="handlePricing"></u-button>
  57. </view>
  58. <view class="detail-image-content">
  59. <view class="detail-image-list">
  60. <view v-for="(item, index) in displayImages" :key="item.id || `detail-${index}`" class="detail-image-item"
  61. :class="{
  62. 'dragging': draggingIndex === index,
  63. 'can-drop': canDropIndex === index && draggingIndex !== index
  64. }" :style="draggingIndex === index ? draggingStyle : ''" @touchstart.stop="onTouchStart($event, index)"
  65. @touchmove.stop="onTouchMove($event, index)" @touchend.stop="onTouchEnd">
  66. <PicComp :src="item.fileUrl" @needPreviewPic="previewImageDetail" />
  67. <view class="image-type-tag">{{ getImageType(index) }}</view>
  68. <view class="detail-delete-btn" @click.stop="handleHideImage(item, index)">
  69. ×
  70. </view>
  71. </view>
  72. <view class="detail-upload-btn" @click="handleUploadImage">
  73. <u-icon name="plus" size="40rpx" color="#999" />
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 支付总额卡片 -->
  80. <view class="card-wrap payment-card">
  81. <view class="payment-section">
  82. <view class="payment-total-container">
  83. <text class="payment-label">支付总额</text>
  84. <view class="payment-amount-wrap">
  85. <u-input v-model="paymentAmount" class="payment-amount" type="number" decimal="2" prefix="¥" />
  86. </view>
  87. <view class="pay-now-btn-wrap">
  88. <u-button type="primary" shape="circle" plain text="立即支付" size="small" @click="handlePayNowClick"></u-button>
  89. </view>
  90. </view>
  91. <view class="payment-buttons-row">
  92. <view class="payment-button" @click="handleUnpaidClick">
  93. <u-icon name="star" size="40rpx" color="#ff9500" />
  94. <text class="button-text">未收</text>
  95. </view>
  96. <view class="payment-button" @click="handleFollowUpClick">
  97. <u-icon name="chat" size="40rpx" color="#108cff" />
  98. <text class="button-text">待跟进</text>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 下一步按钮 -->
  104. <u-button class="next-btn" @click="handleNext" type="primary" size="middle">
  105. 下一步
  106. </u-button>
  107. <!-- 未收评级模态窗 -->
  108. <u-modal showCancelButton showConfirmButton @confirm="confirmUnpaid" @cancel="onUnpaidModalCancel"
  109. :show="unpaidModalVisible" title="未收评级">
  110. <view class="modal-content">
  111. <u-rate v-model="unpaidRating" :count="5" :size="50" active-color="#ff9500" />
  112. <view class="unpaid-benefit-fee-wrap">
  113. <view class="unpaid-benefit-fee-label">好处费</view>
  114. <u-input v-model="unpaidBenefitFee" class="unpaid-benefit-fee-input" type="number" :decimal="2"
  115. placeholder="请输入好处费(金额)" @input="handleUnpaidBenefitFeeInput" />
  116. </view>
  117. </view>
  118. </u-modal>
  119. <!-- 待跟进模态窗 -->
  120. <u-modal showCancelButton showConfirmButton @confirm="confirmFollowUp" @cancel="followUpModalVisible = false"
  121. :show="followUpModalVisible" title="填写跟进细节">
  122. <view class="modal-content">
  123. <u--textarea v-model="followUpNotes" placeholder="请输入情况" confirm-type="done"
  124. style="width: 100%; margin-bottom: 30rpx;" />
  125. </view>
  126. </u-modal>
  127. <!-- 确认支付模态窗 -->
  128. <u-modal showCancelButton showConfirmButton @confirm="confirmRiskWarning" @cancel="riskWarningModalVisible = false"
  129. confirmText="确认并继续付款" :show="riskWarningModalVisible" title="付款警示" :content="'湖南耒阳地区身份证号请确认!'">
  130. </u-modal>
  131. <!-- 核价对话框 -->
  132. <add-inquiry-dialog ref="pricingDialog" :clueId="pricingClueId" :editOrAdd="pricingEditOrAdd"
  133. :editInfo="pricingEditInfo" :type="2" />
  134. <u-modal :show="payNowModalVisible" title="确认支付信息" :showConfirmButton="false">
  135. <view class="modal-content">
  136. <view class="payment-amount-display">¥{{ paymentAmount }}</view>
  137. <view class="payment-info-section">
  138. <view class="info-item">
  139. <text class="info-label">收款姓名:</text>
  140. <text class="info-value">{{ paymentInfo.customName || '未填写' }}</text>
  141. </view>
  142. <view class="info-item">
  143. <text class="info-label">开户银行:</text>
  144. <text class="info-value">{{ paymentInfo.bankName || '未填写' }}</text>
  145. </view>
  146. <view class="info-item">
  147. <text class="info-label">银行卡号:</text>
  148. <text class="info-value">{{ paymentInfo.bankAccount || '未填写' }}</text>
  149. </view>
  150. <view class="info-item">
  151. <text class="info-label">支付方式:</text>
  152. <text class="info-value">{{ paymentMethod || '未填写' }}</text>
  153. </view>
  154. </view>
  155. <u-button type="primary" size="large" @click="confirmTransfer" style="margin-top: 40rpx;">
  156. 确认转账
  157. </u-button>
  158. <u-button type="primary" :plain="true" @click="payNowModalVisible = false" size="large"
  159. style="margin-top: 20rpx;">
  160. 取消
  161. </u-button>
  162. </view>
  163. </u-modal>
  164. </view>
  165. </template>
  166. <script>
  167. import PicComp from './PicComp.vue'
  168. import imageUpload from '../utils/imageUpload.js'
  169. import addInquiryDialog from '@/components/add-inquiry-dialog/index.vue'
  170. export default {
  171. name: 'PageThree',
  172. components: {
  173. PicComp,
  174. addInquiryDialog
  175. },
  176. props: {
  177. orderDetail: {
  178. type: Object,
  179. default: () => ({})
  180. },
  181. orderId: {
  182. type: String,
  183. default: ''
  184. },
  185. currentReceipt: {
  186. type: Object,
  187. default: () => ({})
  188. }
  189. },
  190. data() {
  191. return {
  192. paymentInfo: {
  193. customName: '',
  194. bankName: '',
  195. bankAccount: '',
  196. idNumber: ''
  197. },
  198. paymentMethodRadio: 'offline',
  199. paymentMethod: '',
  200. paymentAmount: '0.00',
  201. detailImages: [],
  202. // 拖拽相关
  203. draggingIndex: -1,
  204. canDropIndex: -1,
  205. startX: 0,
  206. startY: 0,
  207. currentX: 0,
  208. currentY: 0,
  209. // 模态窗
  210. unpaidModalVisible: false,
  211. followUpModalVisible: false,
  212. payNowModalVisible: false,
  213. riskWarningModalVisible: false,
  214. unpaidRating: 0,
  215. unpaidBenefitFee: '',
  216. followUpNotes: '',
  217. // 核价相关
  218. pricingClueId: '',
  219. pricingEditOrAdd: 'receptFormAdd',
  220. pricingEditInfo: {}
  221. }
  222. },
  223. computed: {
  224. // 显示前6个图片用于拖拽
  225. displayImages() {
  226. return this.detailImages.slice(0, 6)
  227. },
  228. // 拖拽时的样式
  229. draggingStyle() {
  230. if (this.draggingIndex === -1) return ''
  231. return {
  232. transform: `translate(${this.currentX - this.startX}px, ${this.currentY - this.startY}px)`,
  233. zIndex: 1000
  234. }
  235. },
  236. // 是否为支付宝支付
  237. isAlipayPayment() {
  238. return this.paymentMethodRadio === 'online_alipay'
  239. },
  240. // 银行账号标签
  241. bankAccountLabel() {
  242. return this.isAlipayPayment ? '支付宝账号' : '银行账号'
  243. },
  244. // 银行账号占位符
  245. bankAccountPlaceholder() {
  246. return this.isAlipayPayment ? '请输入支付宝账号' : '请输入银行账号'
  247. }
  248. },
  249. watch: {
  250. orderDetail: {
  251. handler(newVal) {
  252. if (newVal) {
  253. this.paymentInfo.customName = newVal.customName || ''
  254. this.paymentInfo.bankName = newVal.bankName || ''
  255. this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
  256. this.paymentInfo.idNumber = newVal.idCard || ''
  257. this.initPaymentMethod(newVal.paymentMethod)
  258. }
  259. },
  260. deep: true,
  261. immediate: true
  262. },
  263. currentReceipt: {
  264. handler(newVal, oldVal) {
  265. if (newVal) {
  266. this.paymentAmount = newVal.tableFee || '0.00'
  267. // 只有当 receipt id 变化时才重新加载图片,避免 fileIds 更新时重新加载
  268. if (!oldVal || oldVal.id !== newVal.id) {
  269. this.loadDetailImages()
  270. }
  271. }
  272. },
  273. deep: true,
  274. immediate: true
  275. }
  276. },
  277. methods: {
  278. /**
  279. * 刷新图片列表(供父组件调用)
  280. */
  281. async refreshImageList() {
  282. await this.loadDetailImages()
  283. },
  284. /**
  285. * 加载细节图
  286. */
  287. async loadDetailImages() {
  288. if (!this.currentReceipt.id || !this.orderDetail.itemBrand) return
  289. try {
  290. const list = await imageUpload.getFileList(
  291. '2',
  292. '3',
  293. this.currentReceipt.id,
  294. this.orderDetail.itemBrand,
  295. this.currentReceipt.clueId
  296. )
  297. // 按照 fileIds 排序
  298. if (this.currentReceipt.fileIds && list && list.length > 0) {
  299. const sortedIds = this.currentReceipt.fileIds.split(',')
  300. list.sort((a, b) => {
  301. const indexA = sortedIds.indexOf(a.id)
  302. const indexB = sortedIds.indexOf(b.id)
  303. // 如果都不在列表中,保持原顺序
  304. if (indexA === -1 && indexB === -1) return 0
  305. // 如果 a 不在列表中,放到后面
  306. if (indexA === -1) return 1
  307. // 如果 b 不在列表中,放到后面
  308. if (indexB === -1) return -1
  309. // 都在列表中,按 index 排序
  310. return indexA - indexB
  311. })
  312. }
  313. this.detailImages = list || []
  314. } catch (error) {
  315. console.error('加载细节图失败:', error)
  316. }
  317. },
  318. /**
  319. * 初始化支付方式
  320. */
  321. initPaymentMethod(value) {
  322. if (value === '小葫芦线上支付') {
  323. this.paymentMethod = '小葫芦线上支付'
  324. this.paymentMethodRadio = 'online'
  325. } else if (value === '小葫芦线上支付宝') {
  326. this.paymentMethod = '小葫芦线上支付宝'
  327. this.paymentMethodRadio = 'online_alipay'
  328. this.paymentInfo.bankName = '支付宝'
  329. } else {
  330. this.paymentMethod = value || ''
  331. this.paymentMethodRadio = 'offline'
  332. }
  333. },
  334. /**
  335. * 支付方式选择改变
  336. */
  337. handlePaymentMethodRadioChange(value) {
  338. if (value === 'online') {
  339. this.paymentMethod = '小葫芦线上支付'
  340. // 恢复银行名称输入框
  341. if (this.paymentInfo.bankName === '支付宝') {
  342. this.paymentInfo.bankName = ''
  343. }
  344. } else if (value === 'online_alipay') {
  345. this.paymentMethod = '小葫芦线上支付宝'
  346. // 自动设置银行名称为支付宝
  347. this.paymentInfo.bankName = '支付宝'
  348. } else {
  349. this.paymentMethod = ''
  350. // 恢复银行名称输入框
  351. if (this.paymentInfo.bankName === '支付宝') {
  352. this.paymentInfo.bankName = ''
  353. }
  354. }
  355. },
  356. /**
  357. * 开户人输入处理 - 只允许中文
  358. */
  359. handleCustomNameInput(value) {
  360. // 只保留中文字符(包括中文标点)
  361. const chineseReg = /[^\u4e00-\u9fa5]/g
  362. this.paymentInfo.customName = String(value || '').replace(chineseReg, '')
  363. },
  364. /**
  365. * 银行名称输入处理 - 只允许中文
  366. */
  367. handleBankNameInput(value) {
  368. // 只保留中文字符(包括中文标点)
  369. const chineseReg = /[^\u4e00-\u9fa5]/g
  370. this.paymentInfo.bankName = String(value || '').replace(chineseReg, '')
  371. },
  372. /**
  373. * 银行账号输入处理 - 只允许数字
  374. */
  375. handleBankAccountInput(value) {
  376. // 只保留数字
  377. const numberReg = /[^\d]/g
  378. this.paymentInfo.bankAccount = String(value || '').replace(numberReg, '')
  379. },
  380. /**
  381. * 身份证号输入处理 - 允许数字和X
  382. */
  383. handleIdNumberInput(value) {
  384. // 只保留数字和X
  385. const reg = /[^\dxX]/g
  386. this.paymentInfo.idNumber = String(value || '').replace(reg, '')
  387. },
  388. /**
  389. * 获取图片类型
  390. */
  391. getImageType(index) {
  392. const types = ['正面', '反面', '侧面', '扣子', '编号']
  393. return types[index] || `细节${index - 4}`
  394. },
  395. /**
  396. * 触摸开始
  397. */
  398. onTouchStart(event, index) {
  399. if (this.draggingIndex !== -1) return
  400. this.draggingIndex = index
  401. const touch = event.touches[0]
  402. this.startX = touch.clientX
  403. this.startY = touch.clientY
  404. this.currentX = touch.clientX
  405. this.currentY = touch.clientY
  406. },
  407. /**
  408. * 触摸移动
  409. */
  410. onTouchMove(event, index) {
  411. if (this.draggingIndex === -1 || this.draggingIndex !== index) return
  412. const touch = event.touches[0]
  413. this.currentX = touch.clientX
  414. this.currentY = touch.clientY
  415. this.findTargetIndex(touch.clientX, touch.clientY)
  416. },
  417. /**
  418. * 触摸结束
  419. */
  420. async onTouchEnd() {
  421. if (this.draggingIndex === -1) return
  422. if (this.canDropIndex !== -1 && this.canDropIndex !== this.draggingIndex) {
  423. // 交换位置
  424. const images = [...this.detailImages]
  425. const temp = images[this.draggingIndex]
  426. images[this.draggingIndex] = images[this.canDropIndex]
  427. images[this.canDropIndex] = temp
  428. this.detailImages = images
  429. }
  430. this.resetDragState()
  431. //每次拖拽结束后把新的顺序传送给接口
  432. const fileIds = this.detailImages.map(item => item.id).join(',')
  433. await uni.$u.api.updateReceiptForm({
  434. id: this.currentReceipt.id,
  435. fileIds: fileIds
  436. })
  437. this.$emit('update-file-ids', fileIds)
  438. },
  439. /**
  440. * 查找目标索引
  441. */
  442. findTargetIndex(x, y) {
  443. const query = uni.createSelectorQuery().in(this)
  444. query.selectAll('.detail-image-item').boundingClientRect((rects) => {
  445. if (!rects || rects.length === 0) return
  446. let targetIndex = -1
  447. for (let i = 0; i < rects.length; i++) {
  448. if (i === this.draggingIndex) continue
  449. const rect = rects[i]
  450. if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
  451. targetIndex = i
  452. break
  453. }
  454. }
  455. this.canDropIndex = targetIndex
  456. }).exec()
  457. },
  458. /**
  459. * 重置拖拽状态
  460. */
  461. resetDragState() {
  462. this.draggingIndex = -1
  463. this.canDropIndex = -1
  464. this.startX = 0
  465. this.startY = 0
  466. this.currentX = 0
  467. this.currentY = 0
  468. },
  469. /**
  470. * 上传图片
  471. */
  472. async handleUploadImage() {
  473. try {
  474. const filePaths = await imageUpload.chooseImage(9)
  475. const uploadResults = await imageUpload.uploadFiles(filePaths)
  476. await imageUpload.bindOrderFile(
  477. this.currentReceipt.clueId,
  478. this.currentReceipt.id,
  479. '3',
  480. uploadResults
  481. )
  482. await this.loadDetailImages()
  483. //上传新图片完成之后也要把新数据给接口
  484. const fileIds = this.detailImages.map(item => item.id).join(',')
  485. await uni.$u.api.updateReceiptForm({
  486. id: this.currentReceipt.id,
  487. fileIds: fileIds
  488. })
  489. this.$emit('update-file-ids', fileIds)
  490. } catch (error) {
  491. console.error('上传失败:', error)
  492. }
  493. },
  494. /**
  495. * 隐藏图片
  496. */
  497. async handleHideImage(item, index) {
  498. const itemIndex = this.detailImages.findIndex(img => img.id === item.id || img.fileUrl === item.fileUrl)
  499. if (itemIndex !== -1) {
  500. this.detailImages.splice(itemIndex, 1)
  501. // 更新 fileIds
  502. const fileIds = this.detailImages.map(item => item.id).join(',')
  503. try {
  504. await uni.$u.api.updateReceiptForm({
  505. id: this.currentReceipt.id,
  506. fileIds: fileIds
  507. })
  508. this.$emit('update-file-ids', fileIds)
  509. uni.$u.toast('图片已隐藏')
  510. } catch (error) {
  511. console.error('更新失败:', error)
  512. }
  513. }
  514. },
  515. /**
  516. * 预览图片
  517. */
  518. previewImageDetail(src) {
  519. const urlList = this.detailImages.map(item => item.fileUrl)
  520. uni.previewImage({
  521. urls: urlList,
  522. current: src
  523. })
  524. },
  525. /**
  526. * 未收点击
  527. */
  528. handleUnpaidClick() {
  529. this.unpaidBenefitFee = ''
  530. this.unpaidModalVisible = true
  531. },
  532. /**
  533. * 未收弹窗取消 - 重置好处费
  534. */
  535. onUnpaidModalCancel() {
  536. this.unpaidModalVisible = false
  537. this.unpaidBenefitFee = ''
  538. },
  539. /**
  540. * 好处费输入 - 限制仅可输入金额(数字、最多两位小数)
  541. */
  542. handleUnpaidBenefitFeeInput(e) {
  543. const value = (e && e.detail && e.detail.value !== undefined) ? e.detail.value : e
  544. let val = String(value ?? '').trim()
  545. if (!val) {
  546. this.unpaidBenefitFee = ''
  547. return
  548. }
  549. // 只保留数字和第一个小数点,且小数点后最多两位
  550. const parts = val.replace(/[^\d.]/g, '').split('.')
  551. if (parts.length > 2) {
  552. val = parts[0] + '.' + parts.slice(1).join('')
  553. }
  554. if (parts.length === 2 && parts[1].length > 2) {
  555. val = parts[0] + '.' + parts[1].slice(0, 2)
  556. }
  557. this.unpaidBenefitFee = val
  558. },
  559. /**
  560. * 待跟进点击
  561. */
  562. handleFollowUpClick() {
  563. this.followUpModalVisible = true
  564. },
  565. /**
  566. * 立即支付点击
  567. */
  568. async handlePayNowClick() {
  569. // 保存支付信息
  570. await uni.$u.api.updateReceiptForm({
  571. id: this.currentReceipt.id,
  572. tableFee: this.paymentAmount,
  573. fileIds: this.detailImages.map(item => item.id).join(',')
  574. })
  575. await uni.$u.api.updateClueOrderForm({
  576. id: this.orderDetail.id,
  577. customName: this.paymentInfo.customName || '',
  578. bankName: this.paymentInfo.bankName || '',
  579. bankCardNumber: this.paymentInfo.bankAccount || '',
  580. idCard: this.paymentInfo.idNumber || '',
  581. // paymentMethod: this.paymentMethod || ''
  582. })
  583. if (!this.paymentInfo.customName || !this.paymentInfo.bankName ||
  584. !this.paymentInfo.bankAccount || !this.paymentInfo.idNumber || !this.paymentMethod) {
  585. uni.$u.toast('请填写完整的支付信息')
  586. return
  587. }
  588. if (this.paymentAmount <= 0) {
  589. uni.$u.toast('请填写正确的支付总额')
  590. return
  591. }
  592. //判断当前账号是否敏感地区
  593. if (String(this.paymentInfo.idNumber).startsWith('430481')) {
  594. this.riskWarningModalVisible = true
  595. return
  596. }
  597. // 线下支付:不弹确认框,直接更新支付方式并进入下一步
  598. if (this.paymentMethodRadio === 'offline') {
  599. await uni.$u.api.updateClueOrderForm({
  600. id: this.orderDetail.id,
  601. paymentMethod: this.paymentMethod || ''
  602. })
  603. this.handleNext()
  604. return
  605. }
  606. this.payNowModalVisible = true
  607. },
  608. /**
  609. * 确认风险警示
  610. */
  611. async confirmRiskWarning() {
  612. this.riskWarningModalVisible = false
  613. // 线下支付:不弹确认框,直接更新支付方式并进入下一步
  614. if (this.paymentMethodRadio === 'offline') {
  615. await uni.$u.api.updateClueOrderForm({
  616. id: this.orderDetail.id,
  617. paymentMethod: this.paymentMethod || ''
  618. })
  619. this.handleNext()
  620. return
  621. }
  622. this.payNowModalVisible = true
  623. },
  624. /**
  625. * 确认转账
  626. */
  627. async confirmTransfer() {
  628. this.payNowModalVisible = false
  629. await uni.$u.api.updateClueOrderForm({
  630. id: this.orderDetail.id,
  631. paymentMethod: this.paymentMethod || ''
  632. })
  633. // 根据 radio 选择判断:线上支付(online / online_alipay)需调用支付接口,线下则直接下一步
  634. if (this.paymentMethodRadio === 'online' || this.paymentMethodRadio === 'online_alipay') {
  635. this.$emit('confirm-pay')
  636. } else {
  637. this.handleNext()
  638. }
  639. },
  640. /**
  641. * 确认未收
  642. */
  643. async confirmUnpaid() {
  644. try {
  645. // 若填写了好处费,先更新回单表
  646. if (this.currentReceipt?.id && (this.unpaidBenefitFee !== '' && this.unpaidBenefitFee != null)) {
  647. await uni.$u.api.updateReceiptForm({
  648. id: this.currentReceipt.id,
  649. benefitFee: this.unpaidBenefitFee
  650. })
  651. }
  652. await uni.$u.api.addOrderFollow({
  653. orderId: this.orderId,
  654. content: `未收评分_${this.unpaidRating}`
  655. })
  656. await uni.$u.api.oderForm({
  657. status: '4',
  658. id: this.orderId
  659. })
  660. uni.$u.toast('提交未收评级成功')
  661. this.unpaidModalVisible = false
  662. this.unpaidBenefitFee = ''
  663. // 刷新当前收单数据,以便第四页好处费等字段同步
  664. this.$emit('price-updated')
  665. } catch (error) {
  666. console.error('提交失败:', error)
  667. uni.$u.toast('提交失败')
  668. }
  669. },
  670. /**
  671. * 确认跟进
  672. */
  673. async confirmFollowUp() {
  674. try {
  675. await uni.$u.api.addOrderFollow({
  676. orderId: this.orderId,
  677. content: `待跟进_${this.followUpNotes}`
  678. })
  679. uni.$u.toast('提交待跟进记录成功')
  680. this.followUpModalVisible = false
  681. this.followUpNotes = ''
  682. } catch (error) {
  683. console.error('提交失败:', error)
  684. uni.$u.toast('提交失败')
  685. }
  686. },
  687. /**
  688. * 下一步
  689. */
  690. async handleNext() {
  691. await uni.$u.api.updateReceiptForm({
  692. id: this.currentReceipt.id,
  693. tableFee: this.paymentAmount,
  694. fileIds: this.detailImages.map(item => item.id).join(',')
  695. })
  696. await uni.$u.api.updateClueOrderForm({
  697. id: this.orderDetail.id,
  698. customName: this.paymentInfo.customName || '',
  699. bankName: this.paymentInfo.bankName || '',
  700. bankCardNumber: this.paymentInfo.bankAccount || '',
  701. idCard: this.paymentInfo.idNumber || ''
  702. })
  703. this.$emit('save', {
  704. nowPage: 'formThree',
  705. form: {
  706. ...this.paymentInfo
  707. },
  708. fileIds: this.detailImages.map(item => item.id).join(',')
  709. })
  710. this.$emit('next', {
  711. nowPage: 'formThree',
  712. form: {
  713. ...this.paymentInfo
  714. }
  715. })
  716. },
  717. /**
  718. * 核价
  719. */
  720. async handlePricing() {
  721. const brandList = await this.$getDicts("crm_form_brand");
  722. if (!this.currentReceipt || !this.currentReceipt.clueId) {
  723. uni.$u.toast('缺少线索ID')
  724. return
  725. }
  726. if (!this.currentReceipt.brand) {
  727. uni.$u.toast('缺少品牌信息')
  728. return
  729. }
  730. if (!this.displayImages || this.displayImages.length === 0) {
  731. uni.$u.toast('请先上传图片')
  732. return
  733. }
  734. //我这里询价要用receiptid来询价
  735. this.pricingClueId = this.currentReceipt.id
  736. // brand 是品牌的 id(dictValue),itemBrand 是品牌的 label(dictLabel)
  737. const brandDictLabel = this.currentReceipt.brand
  738. const brandDictValue = brandList.find(item => item.dictLabel === this.currentReceipt.brand).dictValue;
  739. // 将图片转换为 imgsUrl 格式
  740. const imgsUrl = this.displayImages.map(item => item.fileUrl).filter(url => url)
  741. // 检查是否已有核价记录
  742. try {
  743. const data = {
  744. clueId: this.currentReceipt.clueId,
  745. type: 2
  746. }
  747. const res = await uni.$u.api.inquiryDetail(data)
  748. if (res.code === 200 && res.data) {
  749. // 编辑模式:保留原有数据,但更新品牌和图片
  750. this.pricingEditOrAdd = 'editForm'
  751. this.pricingEditInfo = {
  752. ...res.data,
  753. dictLabel: brandDictLabel || res.data.dictLabel,
  754. dictValue: brandDictValue || res.data.dictValue,
  755. imgsUrl: imgsUrl.length > 0 ? imgsUrl : (res.data.imgsUrl || [])
  756. }
  757. this.$nextTick(() => {
  758. this.$refs.pricingDialog.showDialog()
  759. })
  760. } else {
  761. // 新增模式:设置品牌和图片
  762. this.pricingEditOrAdd = 'editForm'
  763. this.pricingEditInfo = {
  764. dictLabel: brandDictLabel,
  765. dictValue: brandDictValue,
  766. imgsUrl: imgsUrl,
  767. model: this.currentReceipt.model,
  768. code: '',
  769. price: ''
  770. }
  771. this.$nextTick(() => {
  772. this.$refs.pricingDialog.showDialog()
  773. })
  774. }
  775. } catch (error) {
  776. // 如果没有记录,则新增
  777. this.pricingEditOrAdd = 'receptFormAdd'
  778. this.pricingEditInfo = {
  779. dictLabel: brandDictLabel,
  780. dictValue: brandDictValue,
  781. imgsUrl: imgsUrl,
  782. model: this.currentReceipt.model,
  783. code: '',
  784. price: ''
  785. }
  786. this.$nextTick(() => {
  787. this.$refs.pricingDialog.showDialog()
  788. })
  789. }
  790. },
  791. }
  792. }
  793. </script>
  794. <style scoped lang="scss">
  795. @import '../styles/common.scss';
  796. .page-three-container {
  797. @extend .page-container;
  798. padding-bottom: 100rpx;
  799. }
  800. .info-card {
  801. @extend .card-wrap;
  802. padding: 20rpx;
  803. margin-top: 20rpx;
  804. box-sizing: border-box;
  805. width: 100%;
  806. max-width: 100%;
  807. }
  808. .info-card-title {
  809. @include font-styles($size: title, $weight: bold, $color: primary);
  810. margin-bottom: 25rpx;
  811. padding-bottom: 15rpx;
  812. border-bottom: 1rpx solid map-get($colors, border);
  813. }
  814. .info-row {
  815. margin-bottom: 20rpx;
  816. }
  817. .info-label {
  818. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  819. margin-bottom: 8rpx;
  820. display: block;
  821. }
  822. .info-input {
  823. border-radius: 8rpx;
  824. border: 1rpx solid #e5e7eb;
  825. padding: 12rpx 16rpx;
  826. width: 100%;
  827. box-sizing: border-box;
  828. }
  829. .detail-image-section {
  830. padding: 20rpx;
  831. }
  832. .detail-image-header {
  833. display: grid;
  834. grid-template-columns: 1fr auto;
  835. margin-bottom: 20rpx;
  836. padding-bottom: 20rpx;
  837. padding-right: 100rpx; /* 右侧留空,避免被固定页面导航遮挡,使整行(含核价按钮)左移 */
  838. border-bottom: 1rpx solid map-get($colors, border);
  839. }
  840. .detail-image-title {
  841. @include font-styles($size: content, $weight: bold, $color: primary);
  842. }
  843. .detail-image-list {
  844. display: flex;
  845. flex-wrap: wrap;
  846. gap: 20rpx;
  847. position: relative;
  848. }
  849. .detail-image-item {
  850. position: relative;
  851. width: 200rpx;
  852. height: 200rpx;
  853. touch-action: none;
  854. transition: transform 0.2s ease, opacity 0.2s ease;
  855. z-index: 1;
  856. box-sizing: border-box;
  857. &.dragging {
  858. opacity: 0.6;
  859. transform: scale(1.05);
  860. z-index: 999;
  861. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.2);
  862. }
  863. &.can-drop {
  864. outline: 2rpx dashed #108cff;
  865. outline-offset: -2rpx;
  866. background-color: rgba(16, 140, 255, 0.1);
  867. border-radius: 8rpx;
  868. }
  869. }
  870. .image-type-tag {
  871. position: absolute;
  872. top: 10rpx;
  873. left: 10rpx;
  874. background-color: rgba(0, 0, 0, 0.6);
  875. color: white;
  876. padding: 5rpx 10rpx;
  877. border-radius: 12rpx;
  878. font-size: 22rpx;
  879. z-index: 1;
  880. }
  881. .detail-delete-btn {
  882. position: absolute;
  883. top: -10rpx;
  884. right: -10rpx;
  885. width: 40rpx;
  886. height: 40rpx;
  887. background-color: #ff4d4f;
  888. color: #fff;
  889. border-radius: 50%;
  890. display: flex;
  891. align-items: center;
  892. justify-content: center;
  893. font-weight: bold;
  894. z-index: 10;
  895. cursor: pointer;
  896. }
  897. .detail-upload-btn {
  898. width: 200rpx;
  899. height: 200rpx;
  900. border: 8rpx dashed #ddd;
  901. border-radius: 30rpx;
  902. display: flex;
  903. align-items: center;
  904. justify-content: center;
  905. background-color: #f9f9f9;
  906. cursor: pointer;
  907. }
  908. .pricing-button {
  909. margin-top: 0;
  910. }
  911. .payment-card {
  912. margin-top: 20rpx;
  913. }
  914. .payment-section {
  915. padding: 20rpx;
  916. }
  917. .payment-total-container {
  918. background-color: #f5f7fa;
  919. border: 2rpx solid #e5e7eb;
  920. border-radius: 12rpx;
  921. padding: 0rpx 30rpx;
  922. display: flex;
  923. align-items: center;
  924. justify-content: space-between;
  925. margin-bottom: 24rpx;
  926. }
  927. .payment-label {
  928. font-size: 36rpx;
  929. font-weight: 700;
  930. min-width: 140rpx;
  931. flex-shrink: 0;
  932. }
  933. .payment-amount-wrap {
  934. flex: 1;
  935. display: flex;
  936. justify-content: center;
  937. align-items: center;
  938. min-width: 0;
  939. }
  940. .payment-amount-wrap .payment-amount {
  941. font-size: 48rpx;
  942. font-weight: 600;
  943. color: #f53f3f;
  944. width: 100%;
  945. max-width: 240rpx;
  946. border: none;
  947. text-align: center;
  948. }
  949. /* 让 u-input 内部输入框文字居中 */
  950. .payment-amount-wrap :deep(.u-input__content__field-wrapper__field),
  951. .payment-amount-wrap :deep(input) {
  952. text-align: center !important;
  953. }
  954. .pay-now-btn-wrap {
  955. flex-shrink: 0;
  956. display: inline-flex;
  957. }
  958. .payment-total-container .pay-now-btn-wrap .u-button,
  959. .payment-total-container .pay-now-btn-wrap .u-btn {
  960. width: auto !important;
  961. min-width: 0 !important;
  962. flex: none !important;
  963. }
  964. .payment-buttons-row {
  965. display: flex;
  966. gap: 20rpx;
  967. margin-bottom: 24rpx;
  968. }
  969. .payment-button {
  970. flex: 1;
  971. border-radius: 12rpx;
  972. padding: 5rpx 0;
  973. display: flex;
  974. flex-direction: column;
  975. align-items: center;
  976. justify-content: center;
  977. background-color: #f5f7fa;
  978. border: 2rpx solid #e5e7eb;
  979. cursor: pointer;
  980. gap: 12rpx;
  981. }
  982. .button-text {
  983. font-size: 28rpx;
  984. font-weight: 500;
  985. color: inherit;
  986. }
  987. .modal-content {
  988. width: 100%;
  989. padding: 40rpx 20rpx;
  990. display: flex;
  991. flex-direction: column;
  992. align-items: center;
  993. }
  994. .unpaid-benefit-fee-wrap {
  995. width: 100%;
  996. margin-top: 32rpx;
  997. display: flex;
  998. flex-direction: column;
  999. align-items: flex-start;
  1000. }
  1001. .unpaid-benefit-fee-label {
  1002. font-size: 28rpx;
  1003. color: #333;
  1004. margin-bottom: 16rpx;
  1005. }
  1006. .unpaid-benefit-fee-input {
  1007. width: 100%;
  1008. border: 2rpx solid #e5e7eb;
  1009. border-radius: 12rpx;
  1010. padding: 20rpx 24rpx;
  1011. box-sizing: border-box;
  1012. }
  1013. .payment-amount-display {
  1014. font-size: 64rpx;
  1015. font-weight: bold;
  1016. color: #108cff;
  1017. text-align: center;
  1018. margin-bottom: 40rpx;
  1019. width: 100%;
  1020. }
  1021. .payment-info-section {
  1022. width: 100%;
  1023. background-color: #f5f7fa;
  1024. border: 2rpx solid #e5e7eb;
  1025. border-radius: 12rpx;
  1026. padding: 30rpx 20rpx;
  1027. margin-bottom: 40rpx;
  1028. }
  1029. .info-item {
  1030. display: flex;
  1031. margin-bottom: 20rpx;
  1032. align-items: center;
  1033. justify-content: space-between;
  1034. &:last-child {
  1035. margin-bottom: 0;
  1036. }
  1037. }
  1038. .next-btn {
  1039. position: fixed;
  1040. bottom: 10rpx;
  1041. left: 2.5%;
  1042. width: 95%;
  1043. height: 80rpx;
  1044. line-height: 80rpx;
  1045. text-align: center;
  1046. border-radius: 20rpx;
  1047. z-index: 1000;
  1048. }
  1049. </style>