pageThree.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <template>
  2. <view class="page-container">
  3. <!-- 支付信息录入卡片 -->
  4. <view class="info-card">
  5. <view class="info-card-title">支付信息</view>
  6. <!-- 开户人和银行名称同一行 -->
  7. <u-row class="info-row" justify="space-between">
  8. <u-col span="5.8">
  9. <view class="info-label">开户人</view>
  10. <u-input v-model="paymentInfo.accountHolder" placeholder="请输入开户人姓名" class="info-input" />
  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. </u-col>
  16. </u-row>
  17. <!-- 银行账号单独一行 -->
  18. <u-row class="info-row">
  19. <u-col span="12">
  20. <view class="info-label">银行账号</view>
  21. <u-input v-model="paymentInfo.bankAccount" placeholder="请输入银行账号" class="info-input" />
  22. </u-col>
  23. </u-row>
  24. <!-- 身份证号单独一行 -->
  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. </u-col>
  30. </u-row>
  31. </view>
  32. <view class="card_wrap">
  33. <view class="detail-image-section">
  34. <view class="detail-image-header">
  35. <div class="detail-image-title">高清实物图(拖拽排序)</div>
  36. </view>
  37. <view class="detail-image-content">
  38. <view class="detail-image-list">
  39. <!-- 替换drag事件为touch事件 -->
  40. <view class="detail-image-item" v-for="(item, index) in localDetailImages"
  41. :key="'detail-' + index" :style="{ opacity: draggingIndex === index ? 0.5 : 1 }"
  42. @touchstart="onTouchStart($event, index)" @touchmove="onTouchMove($event, index)"
  43. @touchend="onTouchEnd">
  44. <pic-comp :src="item"></pic-comp>
  45. <view class="image-type-tag">{{ getImageType(index) }}</view>
  46. <view class="detail-delete-btn" @click="deleteImage(index)">×</view>
  47. </view>
  48. <view class="detail-upload-btn" @click="uploadDetailImage">
  49. <u-icon name="plus" size="40rpx" color="#999"></u-icon>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 支付总额卡片 -->
  56. <view class="card_wrap payment-card">
  57. <view class="payment-section">
  58. <view class="payment-total-container">
  59. <text class="payment-label">支付总额</text>
  60. <text class="payment-amount">¥0.00</text>
  61. </view>
  62. <view class="payment-buttons-row">
  63. <view class="payment-button" @click="handleUnpaidClick">
  64. <u-icon name="star" size="40rpx" color="#ff9500"></u-icon>
  65. <text class="button-text">未收</text>
  66. </view>
  67. <view class="payment-button" @click="handleFollowUpClick">
  68. <u-icon name="chat" size="40rpx" color="#108cff"></u-icon>
  69. <text class="button-text">待跟进</text>
  70. </view>
  71. </view>
  72. <view class="pay-now-button" @click="handlePayNowClick">
  73. <text class="button-text">立即支付</text>
  74. </view>
  75. </view>
  76. </view>
  77. <u-button @click="handleNextClick" type="primary" size="middle" style="border-radius: 20rpx;">下一步</u-button>
  78. <u-modal :show="unpaidModelShow" :title="'未收评级'" :showConfirmButton="false">
  79. <view class="modal-content">
  80. <u-rate v-model="unpaidRating" :count="5" :size="50" active-color="#ff9500"></u-rate>
  81. <u-button type="primary" size="large" @click="confirmUnpaid" style="margin-top: 40rpx;">确认未收</u-button>
  82. </view>
  83. </u-modal>
  84. <u-modal :show="followUpModelShow" :title="'填写跟进细节'" :showConfirmButton="false">
  85. <view class="modal-content">
  86. <u--textarea v-model="followUpNotes" placeholder="请输入情况" confirm-type="done"
  87. style="width: 100%; margin-bottom: 30rpx;"></u--textarea>
  88. <u-button type="primary" size="large" @click="confirmFollowUp">确认</u-button>
  89. </view>
  90. </u-modal>
  91. <u-modal :show="payNowModelShow" :title="'确认支付信息'" :showConfirmButton="false">
  92. <view class="modal-content">
  93. <!-- 支付金额显示 -->
  94. <view class="payment-amount-display">¥0.00</view>
  95. <!-- 支付信息区域 -->
  96. <view class="payment-info-section">
  97. <view class="info-item">
  98. <text class="info-label">收款姓名:</text>
  99. <text class="info-value">{{ paymentInfo.accountHolder || '未填写' }}</text>
  100. </view>
  101. <view class="info-item">
  102. <text class="info-label">开户银行:</text>
  103. <text class="info-value">{{ paymentInfo.bankName || '未填写' }}</text>
  104. </view>
  105. <view class="info-item">
  106. <text class="info-label">银行卡号:</text>
  107. <text class="info-value">{{ paymentInfo.bankAccount || '未填写' }}</text>
  108. </view>
  109. </view>
  110. <!-- 确认转账按钮 -->
  111. <u-button type="primary" size="large" @click="confirmTransfer"
  112. style="margin-top: 40rpx;">确认转账</u-button>
  113. </view>
  114. </u-modal>
  115. </view>
  116. </template>
  117. <script>
  118. import picComp from './picComp.vue'
  119. export default {
  120. components: {
  121. picComp
  122. },
  123. props: {
  124. detailImages: {
  125. type: Array,
  126. default: () => []
  127. }
  128. },
  129. data() {
  130. return {
  131. unpaidModelShow: false,
  132. followUpModelShow: false,
  133. payNowModelShow: false,
  134. unpaidRating: 0, // 未收评级
  135. followUpNotes: '', // 跟进细节
  136. // 支付信息
  137. paymentInfo: {
  138. accountHolder: '', // 开户人
  139. bankName: '', // 银行名称
  140. bankAccount: '', // 银行账号
  141. idNumber: '' // 身份证号
  142. },
  143. // Local copy of detailImages prop to avoid direct mutation
  144. localDetailImages: [...this.detailImages],
  145. // 拖拽相关状态
  146. draggingIndex: -1, // 当前正在拖拽的元素索引
  147. startX: 0, // 触摸起始X坐标
  148. startY: 0 // 触摸起始Y坐标
  149. };
  150. },
  151. watch: {
  152. detailImages: {
  153. handler(newVal) {
  154. this.localDetailImages = [...newVal];
  155. },
  156. deep: true
  157. }
  158. },
  159. methods: {
  160. // 上传高清细节图
  161. uploadDetailImage() {
  162. uni.chooseImage({
  163. count: 9 - this.localDetailImages.length, // 最多选择9张
  164. sizeType: ['compressed'], // 压缩图片
  165. sourceType: ['album', 'camera'], // 从相册选择或拍照
  166. success: (res) => {
  167. const tempFilePaths = res.tempFilePaths;
  168. // 将图片路径添加到数组中
  169. this.localDetailImages = [...this.localDetailImages, ...tempFilePaths];
  170. },
  171. fail: (err) => {
  172. console.error('选择图片失败:', err);
  173. uni.showToast({
  174. title: '选择图片失败',
  175. icon: 'none'
  176. });
  177. }
  178. });
  179. },
  180. // 删除图片
  181. deleteImage(index) {
  182. uni.showModal({
  183. title: '提示',
  184. content: '确定要删除这张图片吗?',
  185. success: (res) => {
  186. if (res.confirm) {
  187. this.localDetailImages.splice(index, 1);
  188. }
  189. }
  190. });
  191. },
  192. // 获取图片类型
  193. getImageType(index) {
  194. const types = ['正面', '反面', '侧面', '扣子', '编号'];
  195. return types[index] || `细节${index - 4}`;
  196. },
  197. // 触摸开始(替代dragstart)
  198. onTouchStart(event, index) {
  199. this.draggingIndex = index;
  200. // 记录触摸起始坐标
  201. this.startX = event.touches[0].clientX;
  202. this.startY = event.touches[0].clientY;
  203. console.log('开始拖拽:', index);
  204. },
  205. // 触摸移动(替代dragover/drop)
  206. onTouchMove(event, currentIndex) {
  207. if (this.draggingIndex === -1) return; // 没有正在拖拽的元素则返回
  208. const moveX = event.touches[0].clientX;
  209. const moveY = event.touches[0].clientY;
  210. const diffX = moveX - this.startX;
  211. const diffY = moveY - this.startY;
  212. // 简单的拖拽距离判断(避免轻微滑动就触发交换)
  213. if (Math.abs(diffX) > 20 || Math.abs(diffY) > 20) {
  214. // 获取当前触摸位置对应的元素索引
  215. const targetIndex = this.getTargetIndexByPosition(moveX, moveY);
  216. if (targetIndex !== -1 && targetIndex !== this.draggingIndex) {
  217. // 交换数组元素(核心排序逻辑)
  218. [this.localDetailImages[this.draggingIndex], this.localDetailImages[targetIndex]] =
  219. [this.localDetailImages[targetIndex], this.localDetailImages[this.draggingIndex]];
  220. // 更新拖拽索引为目标索引(实现连续拖拽)
  221. this.draggingIndex = targetIndex;
  222. // 重置起始坐标
  223. this.startX = moveX;
  224. this.startY = moveY;
  225. }
  226. }
  227. },
  228. // 触摸结束(替代dragend)
  229. onTouchEnd() {
  230. console.log('拖拽结束');
  231. this.draggingIndex = -1; // 重置拖拽状态
  232. },
  233. // 根据触摸坐标获取目标元素索引(核心辅助方法)
  234. getTargetIndexByPosition(x, y) {
  235. // 获取所有图片元素的位置信息
  236. const query = uni.createSelectorQuery().in(this);
  237. return new Promise((resolve) => {
  238. query.selectAll('.detail-image-item').boundingClientRect(rects => {
  239. for (let i = 0; i < rects.length; i++) {
  240. const rect = rects[i];
  241. // 判断坐标是否在元素范围内
  242. if (
  243. x >= rect.left &&
  244. x <= rect.right &&
  245. y >= rect.top &&
  246. y <= rect.bottom
  247. ) {
  248. resolve(i);
  249. return;
  250. }
  251. }
  252. resolve(-1);
  253. }).exec();
  254. });
  255. },
  256. // 下一步按钮点击事件
  257. handleNextClick() {
  258. console.log('page3点击了下一步按钮');
  259. this.$emit('handleNextClick', {
  260. nowPage: 'formThree',
  261. form: {
  262. // detailImages: this.localDetailImages,
  263. // paymentInfo: this.paymentInfo
  264. }
  265. });
  266. },
  267. // 未收按钮点击事件
  268. handleUnpaidClick() {
  269. console.log('点击了未收按钮');
  270. this.unpaidModelShow = true;
  271. },
  272. // 待跟进按钮点击事件
  273. handleFollowUpClick() {
  274. console.log('点击了待跟进按钮');
  275. this.followUpModelShow = true;
  276. },
  277. // 立即支付按钮点击事件
  278. handlePayNowClick() {
  279. console.log('点击了立即支付按钮');
  280. this.payNowModelShow = true;
  281. },
  282. // 确认未收按钮点击事件
  283. confirmUnpaid() {
  284. console.log('确认未收,评分:', this.unpaidRating);
  285. this.unpaidModelShow = false;
  286. // 可以在这里添加提交评分的逻辑
  287. },
  288. // 确认跟进细节按钮点击事件
  289. confirmFollowUp() {
  290. console.log('确认跟进细节:', this.followUpNotes);
  291. this.followUpModelShow = false;
  292. // 可以在这里添加提交跟进细节的逻辑
  293. },
  294. // 确认转账按钮点击事件
  295. confirmTransfer() {
  296. console.log('确认转账');
  297. this.payNowModelShow = false;
  298. // 可以在这里添加转账确认的逻辑
  299. }
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. // 导入公共样式
  305. @import './common.scss';
  306. // 主样式
  307. .page-container {
  308. box-sizing: border-box;
  309. padding: 0;
  310. background-color: map-get($colors, bg);
  311. font-family: map-get($font, family);
  312. -webkit-font-smoothing: map-get($font, smoothing);
  313. font-smoothing: map-get($font, smoothing);
  314. }
  315. .card_wrap {
  316. @include card;
  317. margin-bottom: 20rpx;
  318. &:hover {
  319. @include shadow(2);
  320. }
  321. }
  322. .detail-image-section {
  323. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  324. }
  325. .detail-image-content {
  326. margin-top: 20rpx;
  327. .detail-image-list {
  328. display: flex;
  329. flex-wrap: wrap;
  330. gap: 20rpx;
  331. }
  332. .detail-image-item {
  333. position: relative;
  334. width: 200rpx;
  335. height: 200rpx;
  336. box-sizing: border-box;
  337. touch-action: none; // 禁止浏览器默认触摸行为
  338. transition: opacity 0.2s; // 拖拽时的透明度过渡
  339. &:active {
  340. opacity: 0.7;
  341. }
  342. }
  343. .image-type-tag {
  344. position: absolute;
  345. top: 10rpx;
  346. left: 10rpx;
  347. background-color: rgba(0, 0, 0, 0.6);
  348. color: white;
  349. padding: 5rpx 10rpx;
  350. border-radius: 12rpx;
  351. font-size: 22rpx;
  352. z-index: 1;
  353. }
  354. .detail-delete-btn {
  355. position: absolute;
  356. top: -10rpx;
  357. right: -10rpx;
  358. width: 40rpx;
  359. height: 40rpx;
  360. background-color: #ff4d4f;
  361. color: #fff;
  362. border-radius: 50%;
  363. display: flex;
  364. align-items: center;
  365. justify-content: center;
  366. @include font-styles($size: small, $weight: bold);
  367. z-index: 10;
  368. }
  369. .detail-upload-btn {
  370. width: 200rpx;
  371. height: 200rpx;
  372. border: 8rpx dashed #ddd;
  373. border-radius: 30rpx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. background-color: #f9f9f9;
  378. box-sizing: border-box;
  379. cursor: pointer;
  380. &:hover {
  381. border-color: #108cff;
  382. background-color: rgba(16, 140, 255, 0.05);
  383. }
  384. }
  385. .no-images {
  386. @include font-styles($size: content, $weight: regular, $color: tertiary);
  387. text-align: center;
  388. padding: 80rpx 0;
  389. background-color: #f9f9f9;
  390. border-radius: 12rpx;
  391. margin-top: 20rpx;
  392. }
  393. }
  394. .detail-image-header {
  395. display: flex;
  396. justify-content: space-between;
  397. align-items: center;
  398. margin-bottom: map-get($sizes, margin-sm);
  399. padding-bottom: map-get($sizes, margin-sm);
  400. border-bottom: 1rpx solid map-get($colors, border);
  401. }
  402. .detail-image-title {
  403. @include font-styles($size: content, $weight: bold, $color: primary);
  404. }
  405. /* 支付信息卡片样式 */
  406. .info-card {
  407. @include card;
  408. margin-top: 20rpx;
  409. margin-bottom: 20rpx;
  410. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  411. box-sizing: border-box;
  412. &:hover {
  413. @include shadow(2);
  414. }
  415. .u-col {
  416. padding: 0;
  417. box-sizing: border-box;
  418. }
  419. .u-col:first-child {
  420. padding-right: 15rpx;
  421. }
  422. .u-col:last-child {
  423. padding-left: 15rpx;
  424. }
  425. }
  426. .info-card-title {
  427. @include font-styles($size: title, $weight: bold, $color: primary);
  428. margin-bottom: 25rpx;
  429. padding-bottom: 15rpx;
  430. border-bottom: 1rpx solid map-get($colors, border);
  431. }
  432. .info-row {
  433. margin-bottom: 20rpx;
  434. box-sizing: border-box;
  435. padding: 0;
  436. }
  437. .info-label {
  438. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  439. margin-bottom: 8rpx;
  440. display: block;
  441. }
  442. .info-input {
  443. border-radius: 8rpx;
  444. border: 1rpx solid #e5e7eb;
  445. padding: 12rpx 16rpx;
  446. width: 100%;
  447. box-sizing: border-box;
  448. @include font-styles($size: small, $weight: regular, $color: secondary);
  449. }
  450. /* 支付总额卡片样式 */
  451. .payment-card {
  452. @include card;
  453. margin-top: 20rpx;
  454. margin-bottom: 20rpx;
  455. }
  456. .payment-section {
  457. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  458. }
  459. .payment-total-container {
  460. background-color: #f5f7fa;
  461. border: 2rpx solid #e5e7eb;
  462. border-radius: 12rpx;
  463. padding: 24rpx 30rpx;
  464. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  465. display: flex;
  466. align-items: center;
  467. justify-content: space-between;
  468. margin-bottom: 24rpx;
  469. }
  470. .payment-label {
  471. font-size: 36rpx;
  472. color: map-get($colors, text-primary);
  473. font-weight: 700;
  474. min-width: 140rpx;
  475. }
  476. .payment-amount {
  477. font-size: 48rpx;
  478. font-weight: 600;
  479. color: #f53f3f;
  480. font-family: Consolas, 'Courier New', monospace, -apple-system, BlinkMacSystemFont;
  481. }
  482. /* 支付按钮行样式 */
  483. .payment-buttons-row {
  484. display: flex;
  485. gap: 20rpx;
  486. margin-bottom: 24rpx;
  487. }
  488. .payment-button {
  489. flex: 1;
  490. border-radius: 12rpx;
  491. padding: 24rpx 0;
  492. display: flex;
  493. flex-direction: column;
  494. align-items: center;
  495. justify-content: center;
  496. background-color: #f5f7fa;
  497. border: 2rpx solid #e5e7eb;
  498. cursor: pointer;
  499. transition: all 0.3s ease;
  500. gap: 12rpx;
  501. }
  502. .payment-button:hover {
  503. background-color: #e6f7ed;
  504. border-color: #00b42a;
  505. transform: translateY(-2rpx);
  506. box-shadow: 0 4rpx 12rpx rgba(0, 180, 42, 0.15);
  507. }
  508. /* 立即支付按钮样式 */
  509. .pay-now-button {
  510. width: 100%;
  511. border-radius: 12rpx;
  512. padding: 32rpx 0;
  513. display: flex;
  514. flex-direction: column;
  515. align-items: center;
  516. justify-content: center;
  517. background-color: #108cff;
  518. color: #fff;
  519. cursor: pointer;
  520. transition: all 0.3s ease;
  521. gap: 12rpx;
  522. box-shadow: 0 4rpx 12rpx rgba(16, 140, 255, 0.2);
  523. }
  524. .pay-now-button:hover {
  525. background-color: #007aff;
  526. transform: translateY(-2rpx);
  527. box-shadow: 0 6rpx 16rpx rgba(16, 140, 255, 0.25);
  528. }
  529. .button-text {
  530. font-size: 28rpx;
  531. font-weight: 500;
  532. color: inherit;
  533. }
  534. /* 模态框内容样式 */
  535. .modal-content {
  536. width: 100%;
  537. padding: 40rpx 20rpx;
  538. display: flex;
  539. flex-direction: column;
  540. align-items: center;
  541. }
  542. /* 支付金额显示样式 */
  543. .payment-amount-display {
  544. font-size: 64rpx;
  545. font-weight: bold;
  546. color: #108cff;
  547. text-align: center;
  548. margin-bottom: 40rpx;
  549. width: 100%;
  550. }
  551. /* 支付信息区域样式 */
  552. .payment-info-section {
  553. width: 100%;
  554. background-color: #f5f7fa;
  555. border: 2rpx solid #e5e7eb;
  556. border-radius: 12rpx;
  557. padding: 30rpx 20rpx;
  558. margin-bottom: 40rpx;
  559. }
  560. /* 信息项样式 */
  561. .info-item {
  562. display: flex;
  563. margin-bottom: 20rpx;
  564. align-items: center;
  565. justify-content: space-between;
  566. }
  567. .info-item:last-child {
  568. margin-bottom: 0;
  569. }
  570. .info-label {
  571. font-size: 28rpx;
  572. color: #666;
  573. width: 200rpx;
  574. }
  575. .info-value {
  576. font-size: 28rpx;
  577. color: #333;
  578. }
  579. </style>