PageThree.vue 29 KB

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