| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212 |
- <template>
- <view class="page-three-container">
- <!-- 支付信息卡片 -->
- <view class="info-card">
- <view class="info-card-title">支付信息</view>
- <u-row class="info-row" justify="space-between">
- <u-col span="5.8">
- <view class="info-label">开户人</view>
- <u-input v-model="paymentInfo.customName" placeholder="请输入开户人姓名" class="info-input"
- @blur="handleCustomNameInput" />
- </u-col>
- <u-col span="5.8">
- <view class="info-label">银行名称</view>
- <u-input v-model="paymentInfo.bankName" placeholder="请输入银行名称" class="info-input"
- :disabled="isAlipayPayment" @blur="handleBankNameInput" />
- </u-col>
- </u-row>
- <u-row class="info-row">
- <u-col span="12">
- <view class="info-label">{{ bankAccountLabel }}</view>
- <u-input v-model="paymentInfo.bankAccount" :placeholder="bankAccountPlaceholder" class="info-input"
- :type="isAlipayPayment ? 'text' : 'number'" @input="handleBankAccountInput" @blur="handleBankAccountBlur" />
- </u-col>
- </u-row>
- <u-row class="info-row">
- <u-col span="12">
- <view class="info-label">身份证号</view>
- <u-input v-model="paymentInfo.idNumber" placeholder="请输入身份证号" class="info-input"
- @blur="handleIdNumberInput" />
- </u-col>
- </u-row>
- <u-row class="info-row">
- <u-col span="12">
- <view class="info-label">支付方式选择</view>
- <u-radio-group iconPlacement="left" v-model="paymentMethodRadio" placement="column"
- @change="handlePaymentMethodRadioChange">
- <u-radio shape="circle" label="小葫芦线上支付" name="online" :customStyle="{marginBottom: '16rpx'}"/>
- <u-radio shape="circle" label="小葫芦线上支付宝" name="online_alipay" :customStyle="{marginBottom: '16rpx'}" />
- <u-radio shape="circle" label="线下支付" name="offline" :customStyle="{marginBottom: '16rpx'}"/>
- </u-radio-group>
- </u-col>
- </u-row>
- <u-row class="info-row">
- <u-col span="12">
- <view class="info-label">支付方式</view>
- <u-input :disabled="paymentMethodRadio === 'online'||paymentMethodRadio === 'online_alipay'" v-model="paymentMethod" placeholder="请输入支付方式"
- class="info-input" />
- </u-col>
- </u-row>
- </view>
- <!-- 核价信息卡片 -->
- <view v-if="hasInquiryInfo" class="info-card">
- <view class="info-card-title">核价信息</view>
- <u-row class="info-row">
- <u-col span="6">
- <view class="info-label">核价人数</view>
- <view class="info-value">{{ currentReceipt.inquiryCount || 0 }}</view>
- </u-col>
- <u-col span="6">
- <view class="info-label">核价价格</view>
- <view class="info-value">¥{{ currentReceipt.inquiryPrice || 0 }}</view>
- </u-col>
- </u-row>
- </view>
- <!-- 高清实物图卡片 -->
- <view class="card-wrap">
- <view class="detail-image-section">
- <view class="detail-image-header">
- <text class="detail-image-title">高清实物图(拖拽排序)</text>
- <u-button type="primary" shape="circle" plain text="核价" size="small" class="pricing-btn" @click="handlePricing"></u-button>
- </view>
- <view class="detail-image-content">
- <view class="detail-image-list">
- <view v-for="(item, index) in displayImages" :key="item.id || `detail-${index}`" class="detail-image-item"
- :class="{
- 'dragging': draggingIndex === index,
- 'can-drop': canDropIndex === index && draggingIndex !== index
- }" :style="draggingIndex === index ? draggingStyle : ''" @touchstart.stop="onTouchStart($event, index)"
- @touchmove.stop="onTouchMove($event, index)" @touchend.stop="onTouchEnd">
- <PicComp :src="item.fileUrl" @needPreviewPic="previewImageDetail" />
- <view class="image-type-tag">{{ getImageType(index) }}</view>
- <view class="detail-delete-btn" @click.stop="handleHideImage(item, index)">
- ×
- </view>
- </view>
- <view class="detail-upload-btn" @click="handleUploadImage">
- <u-icon name="plus" size="40rpx" color="#999" />
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 支付总额卡片 -->
- <view class="card-wrap payment-card">
- <view class="payment-section">
- <view class="payment-total-container">
- <text class="payment-label">支付总额</text>
- <view class="payment-amount-wrap">
- <u-input v-model="paymentAmount" class="payment-amount" type="number" decimal="2" prefix="¥"
- @blur="handlePaymentAmountBlur" />
- </view>
- <view class="pay-now-btn-wrap">
- <u-button type="primary" shape="circle" plain text="立即支付" size="small" @click="handlePayNowClick"></u-button>
- </view>
- </view>
- <view class="payment-buttons-row">
- <view class="payment-button" @click="handleUnpaidClick">
- <u-icon name="star" size="40rpx" color="#ff9500" />
- <text class="button-text">未收</text>
- </view>
- <view class="payment-button" @click="handleFollowUpClick">
- <u-icon name="chat" size="40rpx" color="#108cff" />
- <text class="button-text">待跟进</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 下一步按钮 -->
- <!-- <u-button class="next-btn" @click="handleNext" type="primary" size="middle">
- 下一步
- </u-button> -->
- <!-- 未收评级模态窗 -->
- <u-modal showCancelButton showConfirmButton @confirm="confirmUnpaid" @cancel="onUnpaidModalCancel"
- :show="unpaidModalVisible" title="未收评级">
- <view class="modal-content">
- <u-rate v-model="unpaidRating" :count="5" :size="50" active-color="#ff9500" />
- <view class="unpaid-benefit-fee-wrap">
- <view class="unpaid-benefit-fee-label">好处费</view>
- <u-input v-model="unpaidBenefitFee" class="unpaid-benefit-fee-input" type="number" :decimal="2"
- placeholder="请输入好处费(金额)" @input="handleUnpaidBenefitFeeInput" />
- </view>
- </view>
- </u-modal>
- <!-- 待跟进模态窗 -->
- <u-modal showCancelButton showConfirmButton @confirm="confirmFollowUp" @cancel="followUpModalVisible = false"
- :show="followUpModalVisible" title="填写跟进细节">
- <view class="modal-content">
- <u--textarea v-model="followUpNotes" placeholder="请输入情况" confirm-type="done"
- style="width: 100%; margin-bottom: 30rpx;" />
- </view>
- </u-modal>
- <!-- 确认支付模态窗 -->
- <u-modal showCancelButton showConfirmButton @confirm="confirmRiskWarning" @cancel="riskWarningModalVisible = false"
- confirmText="确认并继续付款" :show="riskWarningModalVisible" title="付款警示" :content="'湖南耒阳地区身份证号请确认!'">
- </u-modal>
- <!-- 核价对话框 -->
- <add-inquiry-dialog ref="pricingDialog" :clueId="pricingClueId" :editOrAdd="pricingEditOrAdd"
- :editInfo="pricingEditInfo" :type="2" title="询价"/>
- <u-modal :show="payNowModalVisible" title="确认支付信息" :showConfirmButton="false">
- <view class="modal-content">
- <view class="payment-amount-display">¥{{ paymentAmount }}</view>
- <view class="payment-info-section">
- <view class="info-item">
- <text class="info-label">收款姓名:</text>
- <text class="info-value">{{ paymentInfo.customName || '未填写' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">开户银行:</text>
- <text class="info-value">{{ paymentInfo.bankName || '未填写' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">银行卡号:</text>
- <text class="info-value">{{ paymentInfo.bankAccount || '未填写' }}</text>
- </view>
- <view class="info-item">
- <text class="info-label">支付方式:</text>
- <text class="info-value">{{ paymentMethod || '未填写' }}</text>
- </view>
- </view>
- <u-button type="primary" size="large" @click="confirmTransfer" style="margin-top: 40rpx;">
- 确认转账
- </u-button>
- <u-button type="primary" :plain="true" @click="payNowModalVisible = false" size="large"
- style="margin-top: 20rpx;">
- 取消
- </u-button>
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- import PicComp from './PicComp.vue'
- import imageUpload from '../utils/imageUpload.js'
- import addInquiryDialog from '@/components/add-inquiry-dialog/index.vue'
- export default {
- name: 'PageThree',
- components: {
- PicComp,
- addInquiryDialog
- },
- props: {
- orderDetail: {
- type: Object,
- default: () => ({})
- },
- orderId: {
- type: String,
- default: ''
- },
- currentReceipt: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- paymentInfo: {
- customName: '',
- bankName: '',
- bankAccount: '',
- idNumber: ''
- },
- paymentMethodRadio: 'offline',
- paymentMethod: '',
- paymentAmount: '0.00',
- detailImages: [],
- // 拖拽相关
- draggingIndex: -1,
- canDropIndex: -1,
- startX: 0,
- startY: 0,
- currentX: 0,
- currentY: 0,
- // 模态窗
- unpaidModalVisible: false,
- followUpModalVisible: false,
- payNowModalVisible: false,
- riskWarningModalVisible: false,
- unpaidRating: 0,
- unpaidBenefitFee: '',
- followUpNotes: '',
- // 核价相关
- pricingClueId: '',
- pricingEditOrAdd: 'receptFormAdd',
- pricingEditInfo: {}
- }
- },
- computed: {
- // 显示前6个图片用于拖拽
- displayImages() {
- return this.detailImages.slice(0, 6)
- },
- // 拖拽时的样式
- draggingStyle() {
- if (this.draggingIndex === -1) return ''
- return {
- transform: `translate(${this.currentX - this.startX}px, ${this.currentY - this.startY}px)`,
- zIndex: 1000
- }
- },
- // 是否为支付宝支付
- isAlipayPayment() {
- return this.paymentMethodRadio === 'online_alipay'
- },
- // 银行账号标签
- bankAccountLabel() {
- return this.isAlipayPayment ? '支付宝账号' : '银行账号'
- },
- // 银行账号占位符
- bankAccountPlaceholder() {
- return this.isAlipayPayment ? '请输入支付宝账号' : '请输入银行账号'
- },
- // 是否有核价信息
- hasInquiryInfo() {
- return this.currentReceipt && (this.currentReceipt.inquiryCount || this.currentReceipt.inquiryPrice)
- }
- },
- watch: {
- // 支付信息已保存到 receiptForm,不再从 orderDetail(sendForm) 读取
- currentReceipt: {
- handler(newVal, oldVal) {
- if (newVal) {
- //是为了修复一个问题,当上传高清图片时,支付方式会被重置,这里是为了避免这个问题
- // 仅当回单 id 变化时(切换了回单)才从 receipt 回填表单,避免上传图片等只更新 fileIds 时触发 watch 导致支付方式被重置
- const receiptIdChanged = !oldVal || oldVal.id !== newVal.id
- if (receiptIdChanged) {
- this.paymentAmount = newVal.tableFee || '0.00'
- // 从回单表 receiptForm 回填支付信息(与 PC 端一致)
- this.paymentInfo.customName = newVal.customName || ''
- this.paymentInfo.bankName = newVal.bankName || ''
- this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
- this.paymentInfo.idNumber = newVal.idCard || ''
- this.initPaymentMethod(newVal.paymentMethod)
- }
- // 只有当 receipt id 变化时才重新加载图片,避免 fileIds 更新时重新加载
- if (receiptIdChanged) {
- this.loadDetailImages()
- }
- }
- },
- deep: true,
- immediate: true
- }
- },
- methods: {
- /**
- * 刷新图片列表(供父组件调用)
- */
- async refreshImageList() {
- await this.loadDetailImages()
- },
- /**
- * 加载细节图
- */
- async loadDetailImages() {
- if (!this.currentReceipt.id || !this.orderDetail.itemBrand) return
- try {
- const list = await imageUpload.getFileList(
- '2',
- '3',
- this.currentReceipt.id,
- this.orderDetail.itemBrand,
- this.currentReceipt.clueId
- )
- // 按照 fileIds 排序
- if (this.currentReceipt.fileIds && list && list.length > 0) {
- const sortedIds = this.currentReceipt.fileIds.split(',')
- list.sort((a, b) => {
- const indexA = sortedIds.indexOf(a.id)
- const indexB = sortedIds.indexOf(b.id)
- // 如果都不在列表中,保持原顺序
- if (indexA === -1 && indexB === -1) return 0
- // 如果 a 不在列表中,放到后面
- if (indexA === -1) return 1
- // 如果 b 不在列表中,放到后面
- if (indexB === -1) return -1
- // 都在列表中,按 index 排序
- return indexA - indexB
- })
- }
- this.detailImages = list || []
- } catch (error) {
- console.error('加载细节图失败:', error)
- }
- },
- /**
- * 初始化支付方式
- */
- initPaymentMethod(value) {
- if (value === '小葫芦线上支付') {
- this.paymentMethod = '小葫芦线上支付'
- this.paymentMethodRadio = 'online'
- } else if (value === '小葫芦线上支付宝') {
- this.paymentMethod = '小葫芦线上支付宝'
- this.paymentMethodRadio = 'online_alipay'
- this.paymentInfo.bankName = '支付宝'
- } else {
- this.paymentMethod = value || ''
- this.paymentMethodRadio = 'offline'
- }
- },
- /**
- * 支付方式选择改变
- */
- handlePaymentMethodRadioChange(value) {
- if (value === 'online') {
- this.paymentMethod = '小葫芦线上支付'
- // 恢复银行名称输入框
- if (this.paymentInfo.bankName === '支付宝') {
- this.paymentInfo.bankName = ''
- }
- } else if (value === 'online_alipay') {
- this.paymentMethod = '小葫芦线上支付宝'
- // 自动设置银行名称为支付宝
- this.paymentInfo.bankName = '支付宝'
- } else {
- this.paymentMethod = ''
- // 恢复银行名称输入框
- if (this.paymentInfo.bankName === '支付宝') {
- this.paymentInfo.bankName = ''
- }
- }
- },
- /**
- * 失焦后保存支付信息(开户人/银行名称/账号/身份证/支付总额)
- */
- async savePaymentInfoOnBlur() {
- if (!this.currentReceipt || !this.currentReceipt.id) return
- try {
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- customName: this.paymentInfo.customName || '',
- bankName: this.paymentInfo.bankName || '',
- bankCardNumber: this.paymentInfo.bankAccount || '',
- idCard: this.paymentInfo.idNumber || '',
- tableFee: this.paymentAmount || '0.00'
- })
- } catch (e) {
- console.error('保存支付信息失败:', e)
- }
- },
- /**
- * 开户人输入处理 - 只允许中文,失焦保存
- */
- handleCustomNameInput(value) {
- const chineseReg = /[^\u4e00-\u9fa5]/g
- this.paymentInfo.customName = String(value ?? this.paymentInfo.customName ?? '').replace(chineseReg, '')
- this.savePaymentInfoOnBlur()
- },
- /**
- * 银行名称输入处理 - 只允许中文,失焦保存
- */
- handleBankNameInput(value) {
- const chineseReg = /[^\u4e00-\u9fa5]/g
- this.paymentInfo.bankName = String(value ?? this.paymentInfo.bankName ?? '').replace(chineseReg, '')
- this.savePaymentInfoOnBlur()
- },
- /**
- * 银行账号输入处理 - 只允许数字
- */
- handleBankAccountInput(value) {
- const numberReg = /[^\d]/g
- this.paymentInfo.bankAccount = String(value || '').replace(numberReg, '')
- },
- /**
- * 银行账号失焦保存
- */
- handleBankAccountBlur() {
- this.savePaymentInfoOnBlur()
- },
- /**
- * 身份证号输入处理 - 允许数字和X,失焦保存
- */
- handleIdNumberInput(value) {
- const reg = /[^\dxX]/g
- this.paymentInfo.idNumber = String(value ?? this.paymentInfo.idNumber ?? '').replace(reg, '')
- this.savePaymentInfoOnBlur()
- },
- /**
- * 支付总额失焦保存
- */
- async handlePaymentAmountBlur() {
- this.savePaymentInfoOnBlur()
- },
- /**
- * 获取图片类型
- */
- getImageType(index) {
- const types = ['正面', '反面', '侧面', '扣子', '编号']
- return types[index] || `细节${index - 4}`
- },
- /**
- * 触摸开始
- */
- onTouchStart(event, index) {
- if (this.draggingIndex !== -1) return
- this.draggingIndex = index
- const touch = event.touches[0]
- this.startX = touch.clientX
- this.startY = touch.clientY
- this.currentX = touch.clientX
- this.currentY = touch.clientY
- },
- /**
- * 触摸移动
- */
- onTouchMove(event, index) {
- if (this.draggingIndex === -1 || this.draggingIndex !== index) return
- const touch = event.touches[0]
- this.currentX = touch.clientX
- this.currentY = touch.clientY
- this.findTargetIndex(touch.clientX, touch.clientY)
- },
- /**
- * 触摸结束
- */
- async onTouchEnd() {
- if (this.draggingIndex === -1) return
- if (this.canDropIndex !== -1 && this.canDropIndex !== this.draggingIndex) {
- // 交换位置
- const images = [...this.detailImages]
- const temp = images[this.draggingIndex]
- images[this.draggingIndex] = images[this.canDropIndex]
- images[this.canDropIndex] = temp
- this.detailImages = images
- }
- this.resetDragState()
- //每次拖拽结束后把新的顺序传送给接口
- const fileIds = this.detailImages.map(item => item.id).join(',')
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- fileIds: fileIds
- })
- this.$emit('update-file-ids', fileIds)
- },
- /**
- * 查找目标索引
- */
- findTargetIndex(x, y) {
- const query = uni.createSelectorQuery().in(this)
- query.selectAll('.detail-image-item').boundingClientRect((rects) => {
- if (!rects || rects.length === 0) return
- let targetIndex = -1
- for (let i = 0; i < rects.length; i++) {
- if (i === this.draggingIndex) continue
- const rect = rects[i]
- if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
- targetIndex = i
- break
- }
- }
- this.canDropIndex = targetIndex
- }).exec()
- },
- /**
- * 重置拖拽状态
- */
- resetDragState() {
- this.draggingIndex = -1
- this.canDropIndex = -1
- this.startX = 0
- this.startY = 0
- this.currentX = 0
- this.currentY = 0
- },
- /**
- * 上传图片
- */
- async handleUploadImage() {
- try {
- const filePaths = await imageUpload.chooseImage(9)
- const uploadResults = await imageUpload.uploadFiles(filePaths)
- await imageUpload.bindOrderFile(
- this.currentReceipt.clueId,
- this.currentReceipt.id,
- '3',
- uploadResults
- )
- await this.loadDetailImages()
- //上传新图片完成之后也要把新数据给接口
- const fileIds = this.detailImages.map(item => item.id).join(',')
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- fileIds: fileIds
- })
- this.$emit('update-file-ids', fileIds)
- } catch (error) {
- console.error('上传失败:', error)
- }
- },
- /**
- * 隐藏图片
- */
- async handleHideImage(item, index) {
- const itemIndex = this.detailImages.findIndex(img => img.id === item.id || img.fileUrl === item.fileUrl)
- if (itemIndex !== -1) {
- this.detailImages.splice(itemIndex, 1)
- // 更新 fileIds
- const fileIds = this.detailImages.map(item => item.id).join(',')
- try {
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- fileIds: fileIds
- })
- this.$emit('update-file-ids', fileIds)
- uni.$u.toast('图片已隐藏')
- } catch (error) {
- console.error('更新失败:', error)
- }
- }
- },
- /**
- * 预览图片
- */
- previewImageDetail(src) {
- const urlList = this.detailImages.map(item => item.fileUrl)
- uni.previewImage({
- urls: urlList,
- current: src
- })
- },
- /**
- * 未收点击
- */
- handleUnpaidClick() {
- this.unpaidBenefitFee = ''
- this.unpaidModalVisible = true
- },
- /**
- * 未收弹窗取消 - 重置好处费
- */
- onUnpaidModalCancel() {
- this.unpaidModalVisible = false
- this.unpaidBenefitFee = ''
- },
- /**
- * 好处费输入 - 限制仅可输入金额(数字、最多两位小数)
- */
- handleUnpaidBenefitFeeInput(e) {
- const value = (e && e.detail && e.detail.value !== undefined) ? e.detail.value : e
- let val = String(value ?? '').trim()
- if (!val) {
- this.unpaidBenefitFee = ''
- return
- }
- // 只保留数字和第一个小数点,且小数点后最多两位
- const parts = val.replace(/[^\d.]/g, '').split('.')
- if (parts.length > 2) {
- val = parts[0] + '.' + parts.slice(1).join('')
- }
- if (parts.length === 2 && parts[1].length > 2) {
- val = parts[0] + '.' + parts[1].slice(0, 2)
- }
- this.unpaidBenefitFee = val
- },
- /**
- * 待跟进点击
- */
- handleFollowUpClick() {
- this.followUpModalVisible = true
- },
- /**
- * 立即支付点击
- */
- async handlePayNowClick() {
- // 与 PC 端一致:先做必填校验
- if (this.paymentAmount <= 0) {
- uni.$u.toast('请填写正确的支付总额')
- return
- }
- // 支付方式必填(与 PC 一致)
- if (!this.paymentMethod) {
- uni.$u.toast('请填写支付方式')
- return
- }
- // 仅线上支付时校验开户人/银行/身份证;线下支付不校验(与 PC 一致)
- if (this.paymentMethodRadio === 'online' || this.paymentMethodRadio === 'online_alipay') {
- if (!this.paymentInfo.customName || !this.paymentInfo.bankName ||
- !this.paymentInfo.bankAccount || !this.paymentInfo.idNumber) {
- uni.$u.toast('请填写完整的开户人信息、身份证号、银行名称、银行卡号')
- return
- }
- }
-
- // 保存支付信息到回单表(后端需 sendFormId 才能更新发单表的开户人/银行/身份证等)
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- tableFee: this.paymentAmount,
- fileIds: this.detailImages.map(item => item.id).join(','),
- customName: this.paymentInfo.customName || '',
- bankName: this.paymentInfo.bankName || '',
- bankCardNumber: this.paymentInfo.bankAccount || '',
- idCard: this.paymentInfo.idNumber || ''
- })
- // 湖南耒阳身份证号确认(仅当已填写身份证时校验,与 PC 一致)
- if (this.paymentInfo.idNumber && String(this.paymentInfo.idNumber).startsWith('430481')) {
- this.riskWarningModalVisible = true
- return
- }
- // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
- if (this.paymentMethodRadio === 'offline') {
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- paymentMethod: this.paymentMethod || ''
- })
- this.handleNext()
- return
- }
- this.payNowModalVisible = true
- },
- /**
- * 确认风险警示
- */
- async confirmRiskWarning() {
- this.riskWarningModalVisible = false
- // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
- if (this.paymentMethodRadio === 'offline') {
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- paymentMethod: this.paymentMethod || ''
- })
- this.handleNext()
- return
- }
- this.payNowModalVisible = true
- },
- /**
- * 确认转账
- */
- async confirmTransfer() {
- this.payNowModalVisible = false
- // 支付方式保存(后端需 sendFormId 更新发单表)
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- paymentMethod: this.paymentMethod || ''
- })
- // 根据 radio 选择判断:线上支付(online / online_alipay)需调用支付接口,线下则直接下一步
- if (this.paymentMethodRadio === 'online' || this.paymentMethodRadio === 'online_alipay') {
- this.$emit('confirm-pay')
- } else {
- this.handleNext()
- }
- },
- /**
- * 确认未收
- */
- async confirmUnpaid() {
- try {
- // 若填写了好处费,先更新回单表
- if (this.currentReceipt?.id && (this.unpaidBenefitFee !== '' && this.unpaidBenefitFee != null)) {
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- benefitFee: this.unpaidBenefitFee
- })
- }
- await uni.$u.api.addOrderFollow({
- orderId: this.orderId,
- content: `未收评分_${this.unpaidRating}`
- })
- await uni.$u.api.oderForm({
- status: '4',
- id: this.orderId
- })
- uni.$u.toast('提交未收评级成功')
- this.unpaidModalVisible = false
- this.unpaidBenefitFee = ''
- // 刷新当前收单数据,以便第四页好处费等字段同步
- this.$emit('price-updated')
- } catch (error) {
- console.error('提交失败:', error)
- uni.$u.toast('提交失败')
- }
- },
- /**
- * 确认跟进
- */
- async confirmFollowUp() {
- try {
- await uni.$u.api.addOrderFollow({
- orderId: this.orderId,
- content: `待跟进_${this.followUpNotes}`
- })
- uni.$u.toast('提交待跟进记录成功')
- this.followUpModalVisible = false
- this.followUpNotes = ''
- } catch (error) {
- console.error('提交失败:', error)
- uni.$u.toast('提交失败')
- }
- },
- /**
- * 下一步
- */
- async handleNext() {
- // 与 PC 端一致:支付信息通过 updateReceiptForm 保存;后端需 sendFormId 才能更新发单表的开户人/银行/身份证等
- await uni.$u.api.updateReceiptForm({
- id: this.currentReceipt.id,
- sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
- tableFee: this.paymentAmount,
- fileIds: this.detailImages.map(item => item.id).join(','),
- customName: this.paymentInfo.customName || '',
- bankName: this.paymentInfo.bankName || '',
- bankCardNumber: this.paymentInfo.bankAccount || '',
- idCard: this.paymentInfo.idNumber || '',
- // paymentMethod: this.paymentMethod || ''
- })
- this.$emit('save', {
- nowPage: 'formThree',
- form: {
- ...this.paymentInfo
- },
- fileIds: this.detailImages.map(item => item.id).join(',')
- })
- this.$emit('next', {
- nowPage: 'formThree',
- form: {
- ...this.paymentInfo
- }
- })
- },
- /**
- * 核价
- */
- async handlePricing() {
- const brandList = await this.$getDicts("crm_form_brand");
- if (!this.currentReceipt || !this.currentReceipt.clueId) {
- uni.$u.toast('缺少线索ID')
- return
- }
- if (!this.currentReceipt.brand) {
- uni.$u.toast('缺少品牌信息')
- return
- }
- if (!this.displayImages || this.displayImages.length === 0) {
- uni.$u.toast('请先上传图片')
- return
- }
- //我这里询价要用receiptid来询价
- this.pricingClueId = this.currentReceipt.id
- // brand 是品牌的 id(dictValue),itemBrand 是品牌的 label(dictLabel)
- const brandDictLabel = this.currentReceipt.brand
- const brandDictValue = brandList.find(item => item.dictLabel === this.currentReceipt.brand).dictValue;
- // 将图片转换为 imgsUrl 格式
- const imgsUrl = this.displayImages.map(item => item.fileUrl).filter(url => url)
- // 检查是否已有核价记录
- try {
- const data = {
- clueId: this.currentReceipt.clueId,
- type: 2
- }
- const res = await uni.$u.api.inquiryDetail(data)
- if (res.code === 200 && res.data) {
- // 编辑模式:保留原有数据,但更新品牌和图片
- this.pricingEditOrAdd = 'edit'
- this.pricingEditInfo = {
- ...res.data,
- dictLabel: brandDictLabel || res.data.dictLabel,
- dictValue: brandDictValue || res.data.dictValue,
- imgsUrl: imgsUrl.length > 0 ? imgsUrl : (res.data.imgsUrl || [])
- }
- this.$nextTick(() => {
- this.$refs.pricingDialog.showDialog()
- })
- } else {
- // 新增模式:设置品牌和图片
- this.pricingEditOrAdd = 'receptFormAdd'
- this.pricingEditInfo = {
- dictLabel: brandDictLabel,
- dictValue: brandDictValue,
- imgsUrl: imgsUrl,
- model: this.currentReceipt.model,
- code: '',
- price: ''
- }
- this.$nextTick(() => {
- this.$refs.pricingDialog.showDialog()
- })
- }
- } catch (error) {
- // 如果没有记录,则新增
- this.pricingEditOrAdd = 'add'
- this.pricingEditInfo = {
- dictLabel: brandDictLabel,
- dictValue: brandDictValue,
- imgsUrl: imgsUrl,
- model: this.currentReceipt.model,
- code: '',
- price: ''
- }
- this.$nextTick(() => {
- this.$refs.pricingDialog.showDialog()
- })
- }
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import '../styles/common.scss';
- .page-three-container {
- @extend .page-container;
- padding-bottom: 100rpx;
- }
- .info-card {
- @extend .card-wrap;
- padding: 20rpx;
- margin-top: 20rpx;
- box-sizing: border-box;
- width: 100%;
- max-width: 100%;
- }
- .info-card-title {
- @include font-styles($size: title, $weight: bold, $color: primary);
- margin-bottom: 25rpx;
- padding-bottom: 15rpx;
- border-bottom: 1rpx solid map-get($colors, border);
- }
- .info-row {
- margin-bottom: 20rpx;
- }
- .info-label {
- @include font-styles($size: tiny, $weight: regular, $color: tertiary);
- margin-bottom: 8rpx;
- display: block;
- }
- .info-input {
- border-radius: 8rpx;
- border: 1rpx solid #e5e7eb;
- padding: 12rpx 16rpx;
- width: 100%;
- box-sizing: border-box;
- }
- .detail-image-section {
- padding: 20rpx;
- }
- .detail-image-header {
- display: grid;
- grid-template-columns: 1fr auto;
- margin-bottom: 20rpx;
- padding-bottom: 20rpx;
- padding-right: 100rpx; /* 右侧留空,避免被固定页面导航遮挡,使整行(含核价按钮)左移 */
- border-bottom: 1rpx solid map-get($colors, border);
- }
- .detail-image-title {
- @include font-styles($size: content, $weight: bold, $color: primary);
- }
- .detail-image-list {
- display: flex;
- flex-wrap: wrap;
- gap: 20rpx;
- position: relative;
- }
- .detail-image-item {
- position: relative;
- width: 200rpx;
- height: 200rpx;
- touch-action: none;
- transition: transform 0.2s ease, opacity 0.2s ease;
- z-index: 1;
- box-sizing: border-box;
- &.dragging {
- opacity: 0.6;
- transform: scale(1.05);
- z-index: 999;
- box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.2);
- }
- &.can-drop {
- outline: 2rpx dashed #108cff;
- outline-offset: -2rpx;
- background-color: rgba(16, 140, 255, 0.1);
- border-radius: 8rpx;
- }
- }
- .image-type-tag {
- position: absolute;
- top: 10rpx;
- left: 10rpx;
- background-color: rgba(0, 0, 0, 0.6);
- color: white;
- padding: 5rpx 10rpx;
- border-radius: 12rpx;
- font-size: 22rpx;
- z-index: 1;
- }
- .detail-delete-btn {
- position: absolute;
- top: -10rpx;
- right: -10rpx;
- width: 40rpx;
- height: 40rpx;
- background-color: #ff4d4f;
- color: #fff;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: bold;
- z-index: 10;
- cursor: pointer;
- }
- .detail-upload-btn {
- width: 200rpx;
- height: 200rpx;
- border: 8rpx dashed #ddd;
- border-radius: 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #f9f9f9;
- cursor: pointer;
- }
- .pricing-button {
- margin-top: 0;
- }
- .payment-card {
- margin-top: 20rpx;
- }
- .payment-section {
- padding: 20rpx;
- }
- .payment-total-container {
- background-color: #f5f7fa;
- border: 2rpx solid #e5e7eb;
- border-radius: 12rpx;
- padding: 0rpx 30rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 24rpx;
- }
- .payment-label {
- font-size: 36rpx;
- font-weight: 700;
- min-width: 140rpx;
- flex-shrink: 0;
- }
- .payment-amount-wrap {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- min-width: 0;
- }
- .payment-amount-wrap .payment-amount {
- font-size: 48rpx;
- font-weight: 600;
- color: #f53f3f;
- width: 100%;
- max-width: 240rpx;
- border: none;
- text-align: center;
- }
- /* 让 u-input 内部输入框文字居中 */
- .payment-amount-wrap :deep(.u-input__content__field-wrapper__field),
- .payment-amount-wrap :deep(input) {
- text-align: center !important;
- }
- .pay-now-btn-wrap {
- flex-shrink: 0;
- display: inline-flex;
- }
- .payment-total-container .pay-now-btn-wrap .u-button,
- .payment-total-container .pay-now-btn-wrap .u-btn {
- width: auto !important;
- min-width: 0 !important;
- flex: none !important;
- }
- .payment-buttons-row {
- display: flex;
- gap: 20rpx;
- margin-bottom: 24rpx;
- }
- .payment-button {
- flex: 1;
- border-radius: 12rpx;
- padding: 5rpx 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- background-color: #f5f7fa;
- border: 2rpx solid #e5e7eb;
- cursor: pointer;
- gap: 12rpx;
- }
- .button-text {
- font-size: 28rpx;
- font-weight: 500;
- color: inherit;
- }
- .modal-content {
- width: 100%;
- padding: 40rpx 20rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .unpaid-benefit-fee-wrap {
- width: 100%;
- margin-top: 32rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- }
- .unpaid-benefit-fee-label {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 16rpx;
- }
- .unpaid-benefit-fee-input {
- width: 100%;
- border: 2rpx solid #e5e7eb;
- border-radius: 12rpx;
- padding: 20rpx 24rpx;
- box-sizing: border-box;
- }
- .payment-amount-display {
- font-size: 64rpx;
- font-weight: bold;
- color: #108cff;
- text-align: center;
- margin-bottom: 40rpx;
- width: 100%;
- }
- .payment-info-section {
- width: 100%;
- background-color: #f5f7fa;
- border: 2rpx solid #e5e7eb;
- border-radius: 12rpx;
- padding: 30rpx 20rpx;
- margin-bottom: 40rpx;
- }
- .info-item {
- display: flex;
- margin-bottom: 20rpx;
- align-items: center;
- justify-content: space-between;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .next-btn {
- position: fixed;
- bottom: 10rpx;
- left: 2.5%;
- width: 95%;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 20rpx;
- z-index: 1000;
- }
- </style>
|