fundsOrder.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. <template>
  2. <view class="page-container">
  3. <!-- <up-tabs
  4. class="tabs-box"
  5. :list="tabsList"
  6. lineColor="#cc9933"
  7. @click="click"
  8. ></up-tabs> -->
  9. <z-paging
  10. empty-view-error-text="暂无订单"
  11. :style="{
  12. marginTop: computedMarginTop,
  13. }"
  14. ref="pagingRef"
  15. class="pagingRef-container"
  16. :use-refresher-status-bar-placeholder="true"
  17. @query="handleQuery"
  18. v-model="dataList"
  19. >
  20. <template #top>
  21. <view class="tabs-container">
  22. <Tabs
  23. :tabsList="tabsList"
  24. :activeName="title"
  25. @tab-click="onTabClick"
  26. activeLineWidth="112rpx"
  27. activeLineColor="#f8c007"
  28. activeLineHeight="6rpx"
  29. ></Tabs>
  30. </view>
  31. <view
  32. v-if="title == '确认单' && role == '买家' && dataList.length"
  33. class="address acea-row row-between-wrapper"
  34. @tap="onAddress"
  35. >
  36. <view class="addressCon" v-if="addressInfo.realName">
  37. <view class="name"
  38. >{{ addressInfo.realName }}
  39. <text class="phone">{{ addressInfo.phone }}</text>
  40. </view>
  41. <view class="acea-row">
  42. <text class="default font-color" v-if="addressInfo.isDefault"
  43. >[默认]</text
  44. >
  45. <text class="line2"
  46. >{{ addressInfo.province }}{{ addressInfo.city
  47. }}{{ addressInfo.district }}{{ addressInfo.detail }}</text
  48. >
  49. </view>
  50. </view>
  51. <view class="addressCon" v-else>
  52. <view class="setaddress">设置收货地址</view>
  53. </view>
  54. <view class="iconfont icon-jiantou"></view>
  55. </view>
  56. </template>
  57. <view class="order-info-box animated">
  58. <view
  59. class="order-info-item"
  60. v-for="item in dataList"
  61. :key="item.orderNo"
  62. >
  63. <view class="title-box">
  64. <view class="order-num">订单号:{{ item.orderNo }}</view>
  65. <view class="order-time">{{ item.createTime }}</view>
  66. <view class="order-status" v-if="item.status == 0">待审核</view>
  67. </view>
  68. <!-- 待找款 /完成单-->
  69. <view class="order-container" style="width: 100%">
  70. <view class="order-content">
  71. <view class="image-box" @click="previewImage(item.images)">
  72. <image :src="item.images[0]"></image>
  73. </view>
  74. <view class="ordser-info-desc">
  75. <block v-if="title !== '完成单' && title !== '待评分'">
  76. <view class="info-desc-item">
  77. 预估克重:{{ item.estimatedWeight }}g
  78. </view>
  79. <view class="info-desc-item">
  80. 理想工费:{{ item.idealWage }}元/g
  81. </view>
  82. <view class="info-desc-item">
  83. 购买件数:{{ item.numberOfUnits }}件
  84. </view>
  85. <view
  86. class="info-desc-item buyer-message"
  87. v-if="title !== '完成单'"
  88. >买家留言:{{ item.description }}
  89. </view>
  90. </block>
  91. <block v-else>
  92. <view class="info-desc-item">
  93. 实际克重:{{ item.practicalWeight }}g
  94. </view>
  95. <view class="info-desc-item">
  96. 实际工费:{{ item.quoteWage }}元/g
  97. </view>
  98. <view class="info-desc-item">
  99. 购买件数:{{ item.numberOfUnits }}件
  100. </view>
  101. <view class="info-desc-item" v-if="title !== '完成单'">
  102. 买家留言:请帮我买一个有设计感的款式
  103. </view>
  104. <view
  105. class="info-desc-item"
  106. v-if="title == '完成单' && role == '买家'"
  107. >
  108. <up-copy :content="item.trackingNumber">
  109. 快递单号:{{
  110. item.trackingNumber
  111. ? item.trackingNumber
  112. : "暂无物流信息"
  113. }}
  114. </up-copy>
  115. </view>
  116. </block>
  117. <!-- 买家评分 -->
  118. <view class="rate" v-if="title === '完成单' && role === '代购'">
  119. <view class="lable">买家评分:</view>
  120. <!-- <up-rate
  121. :count="count"
  122. readonly
  123. v-model="item.score"
  124. activeColor="#cc9933"
  125. ></up-rate> -->
  126. <uni-rate
  127. readonly
  128. :value="item.score"
  129. color="#bbb"
  130. active-color="#f96400"
  131. />
  132. </view>
  133. </view>
  134. </view>
  135. <!-- 代购 -->
  136. <view
  137. class="Purchasing"
  138. v-if="role === '代购' && title === '待找款'"
  139. >
  140. <view class="Purchasing-btn" @click="takeOrderHandle(item)">
  141. <image
  142. class="sb-btn-img"
  143. src="/static/images/sb_btn.png"
  144. ></image>
  145. <text>点击接单</text>
  146. </view>
  147. <view class="Purchasing-tips"
  148. >温馨提示:48小时内需找到产品,切勿盲目接单。</view
  149. >
  150. </view>
  151. <view
  152. class="border-line"
  153. v-if="role === '买家' && title === '完成单'"
  154. ></view>
  155. <!-- 买家 -->
  156. <view
  157. class="Buyers"
  158. v-if="
  159. role === '买家' && (title === '完成单' || title == '待评分')
  160. "
  161. >
  162. <view class="Buyers-tips" v-show="!item.isScore">
  163. 请给我们打个服务分吧!</view
  164. >
  165. <view class="Buyers-rate-box">
  166. <text>订单评分</text>
  167. <!-- <up-rate
  168. :count="count"
  169. activeColor="#cc9933"
  170. gutter="1"
  171. v-model="item.score"
  172. :value="buyRate"
  173. @change="changeRate"
  174. :readonly="item.isScore ? true : false"
  175. ></up-rate> -->
  176. <uni-rate
  177. activeColor="#f96400"
  178. :value="item.isScore ? item.score : buyRate"
  179. @change="changeRate"
  180. :readonly="item.isScore ? true : false"
  181. />
  182. </view>
  183. <view
  184. class="Buyers-btn"
  185. v-show="!item.isScore"
  186. @click="submitRateHandle(item)"
  187. :class="{ disabled: item.isScore }"
  188. >
  189. <image
  190. v-show="!item.isScore"
  191. class="sb-btn-img"
  192. src="/static/images/sb_btn.png"
  193. ></image>
  194. <image
  195. v-show="item.isScore"
  196. class="sb-btn-img"
  197. src="/static/images/sb_refuse_btn.png"
  198. ></image>
  199. <text>提交评分</text>
  200. </view>
  201. </view>
  202. </view>
  203. <!-- 已接单 -->
  204. <view
  205. class="order-receive"
  206. v-if="title === '已接单' && role === '代购'"
  207. >
  208. <view class="find-funds-info">
  209. <view class="title-box">
  210. <view class="title">请上传1~3张产品图</view>
  211. <view class="f-title">图片越清晰越容易识别款式哦~</view>
  212. </view>
  213. <!-- 上传 -->
  214. <!-- 上传 -->
  215. <view class="upload-box">
  216. <up-upload
  217. :fileList="imageList"
  218. uploadIcon="plus"
  219. @afterRead="afterRead"
  220. @delete="deletePic"
  221. name="1"
  222. multiple
  223. :maxCount="3"
  224. >
  225. <template #trigger>
  226. <view class="upload-block">
  227. <uni-icons
  228. size="38"
  229. color="#ccc"
  230. type="plusempty"
  231. ></uni-icons>
  232. </view>
  233. </template>
  234. </up-upload>
  235. </view>
  236. <!-- 信息 -->
  237. <view class="info-box">
  238. <view class="info-item">
  239. <view class="info-label">实际重量(g)</view>
  240. <view class="info-input">
  241. <input type="number" v-model="practicalWeight" />
  242. </view>
  243. </view>
  244. <view class="info-item">
  245. <view class="info-label">报价工费(/g)</view>
  246. <view class="info-input">
  247. <input type="number" v-model="quoteWage" />
  248. </view>
  249. </view>
  250. <view class="info-item">
  251. <view class="info-label">卖家留言</view>
  252. </view>
  253. <view class="info-input info-item-message">
  254. <up-textarea
  255. v-model="acceptorText"
  256. placeholder="请输入您的留言"
  257. ></up-textarea>
  258. </view>
  259. </view>
  260. </view>
  261. </view>
  262. <!-- 确认单 -->
  263. <view class="order-confirm" v-if="title === '确认单'">
  264. <view class="image-box">
  265. <image v-for="p in item.productImages" :key="p" :src="p"></image>
  266. </view>
  267. <view class="confirm-info">
  268. <view class="confirm-info-left">
  269. <view class="label">实际重量:</view>
  270. <view class="value">{{ item.practicalWeight }}g</view>
  271. </view>
  272. <view class="confirm-info-right">
  273. <view class="label">报价工费:</view>
  274. <view class="value">{{ item.quoteWage }}元/g</view>
  275. </view>
  276. </view>
  277. <!-- 卖家留言 -->
  278. <view class="confirm-message">
  279. <view class="label">卖家留言:</view>
  280. <view class="value">
  281. {{ item.acceptorText }}
  282. </view>
  283. </view>
  284. <view
  285. class="express-box"
  286. v-if="title === '确认单' && role === '买家'"
  287. >
  288. <view class="info-item">
  289. <view class="info-label" @click="exShowPopup = true"
  290. >选择快递方式:
  291. {{
  292. selectedExpress?.label
  293. ? selectedExpress.label
  294. : "请选择快递公司"
  295. }}</view
  296. >
  297. </view>
  298. </view>
  299. <!-- 买家是否确认支付 -->
  300. <view
  301. class="confirm-pay-box"
  302. v-if="role === '买家' && title === '确认单'"
  303. >
  304. <view class="confirm pay" @tap="opPopup(item)">
  305. <image
  306. class="sb-btn-img"
  307. src="/static/images/sb_btn.png"
  308. ></image>
  309. <text>确认支付</text>
  310. </view>
  311. <view class="refuse pay" @click="refuse(item.id)">
  312. <image
  313. class="sb-btn-img"
  314. src="/static/images/sb_refuse_btn.png"
  315. ></image>
  316. <text>取消订单</text>
  317. </view>
  318. </view>
  319. </view>
  320. <!-- 提交信息等待买家确认 -->
  321. <view
  322. class="btn"
  323. v-if="title === '已接单' && role === '代购'"
  324. @click="submitFindFundsHandle(item)"
  325. >
  326. <image class="sb-btn-img" src="/static/images/sb_btn.png"></image>
  327. <text>提交信息等待买家确认</text>
  328. </view>
  329. </view>
  330. </view>
  331. </z-paging>
  332. <!-- 选择支付方式弹窗 -->
  333. <!-- <up-popup :show="show" closeOnClickOverlay @close="close">
  334. <view class="pay-list">
  335. <view class="pay-title">选择支付方式</view>
  336. <view
  337. class="pay-item"
  338. v-for="item in payments"
  339. :key="item.value"
  340. :class="{ active: item.value === payChannel }"
  341. @tap="changePayChannel(item)"
  342. >
  343. <view class="iconfont" :class="item.icon"> </view>
  344. <view class="pay-name">{{ item.name }}</view>
  345. </view>
  346. <view class="comfirm-btn" @tap="confirmPay"> 确认支付 </view>
  347. </view>
  348. </up-popup> -->
  349. <WPayment
  350. :payMode="payments"
  351. :showPopup="showPopup"
  352. @payComplete="payComplete"
  353. @close="payClose"
  354. :orderId="orderbanceId"
  355. :totalPrice="totalPrice"
  356. :addresssId="addressId"
  357. :mallType="0"
  358. :orderUserInfo="orderUserInfo"
  359. :goldType="goldType"
  360. @change="handlePaymentChange"
  361. :switchStatus="switchStatus"
  362. ref="paymentRef"
  363. ></WPayment>
  364. <!-- 取消订单支付弹出框 -->
  365. <up-modal
  366. :show="show"
  367. :content="content"
  368. :showCancelButton="true"
  369. @cancel="close"
  370. @confirm="confirm"
  371. ></up-modal>
  372. <!-- 收货地址组件 -->
  373. <addressWindow
  374. ref="addressWindowRef"
  375. :address="address"
  376. :pagesUrl="pagesUrl"
  377. @OnDefaultAddress="OnDefaultAddress"
  378. @OnChangeAddress="OnChangeAddress"
  379. @changeClose="changeClose"
  380. />
  381. <!-- 快递组件 -->
  382. <view class="express-popup">
  383. <up-popup :show="exShowPopup" @close="exShowPopup = false">
  384. <up-cell-group>
  385. <up-cell
  386. class="item-cell"
  387. v-for="item in expressList"
  388. :key="item.value"
  389. :title="`${item.label}¥${
  390. appStore.userInfo.svip ? item.value / 2 : item.value
  391. }`"
  392. @click="chooseExpress(item)"
  393. />
  394. <up-cell
  395. class="item-cell cancel"
  396. title="取消"
  397. @click="exShowPopup = false"
  398. />
  399. </up-cell-group>
  400. </up-popup>
  401. </view>
  402. <view class="white"></view>
  403. </view>
  404. </template>
  405. <script setup>
  406. import { reactive, ref, nextTick, computed } from "vue";
  407. import { onLoad, onShow } from "@dcloudio/uni-app";
  408. import Tabs from "@/components//tabsView/index.vue";
  409. import { useAppStore } from "@/stores/app";
  410. import { useToast } from "@/hooks/useToast";
  411. // 快递相关
  412. const selectedExpress = ref({});
  413. const exShowPopup = ref(false);
  414. const expressList = ref([
  415. { label: "顺丰陆运", value: 15, type: 2 },
  416. { label: "顺丰空运", value: 24, type: 3 },
  417. { label: "顺丰到付", value: 0, type: 4 },
  418. ]);
  419. const chooseExpress = (item) => {
  420. selectedExpress.value = item;
  421. exShowPopup.value = false;
  422. };
  423. // 导入地址选择组件
  424. import addressWindow from "@/components/addressWindow";
  425. // 导入用户地址详情API接口
  426. import { getAddressDetail, getAddressDefault } from "@/api/user.js";
  427. const { Toast } = useToast();
  428. // 地址相关
  429. //
  430. const textareaStatus = ref(true);
  431. const pagesUrl = ref("");
  432. const addressWindowRef = ref(null);
  433. const address = ref({
  434. address: false,
  435. addressId: 0,
  436. }); // 地址组件
  437. const addressInfo = ref({}); // 地址信息
  438. const addressId = ref(0); // 地址id
  439. // 首次进入页面时展示默认地址
  440. const OnDefaultAddress = (e) => {
  441. console.log("保存默认地址详情");
  442. addressInfo.value = e; // 保存默认地址详情
  443. address.value.addressId = e.id; // 更新选中地址ID
  444. };
  445. // 打开地址选择弹窗
  446. const onAddress = () => {
  447. textareaStatus.value = false; // 隐藏备注框
  448. address.value.address = true; // 显示地址弹窗
  449. // 设置地址页面跳转链接
  450. pagesUrl.value = "/pages/users/user_address_list/index";
  451. nextTick(() => {
  452. addressWindowRef.value.fetchAddressList();
  453. });
  454. };
  455. // 选择地址后触发的事件
  456. const OnChangeAddress = (e) => {
  457. console.log("OnChangeAddress", e);
  458. addressInfo.value = e; // 保存选中的地址详情
  459. address.value.addressId = e.id; // 更新选中地址ID
  460. textareaStatus.value = true; // 显示备注框
  461. address.value.address = false; // 关闭地址弹窗
  462. };
  463. // 获取默认地址或指定地址详情
  464. const getaddressInfo = () => {
  465. if (addressId.value) {
  466. // 若有指定地址ID,获取该地址详情
  467. getAddressDetail(addressId.value).then((res) => {
  468. if (res.data) {
  469. // 若地址存在
  470. res.data.isDefault = parseInt(res.data.isDefault); // 转换默认地址标识为数字
  471. addressInfo.value = res.data || {}; // 保存地址详情
  472. addressId.value = res.data.id || 0; // 更新地址ID
  473. address.value.addressId = res.data.id || 0; // 更新选中地址ID
  474. }
  475. });
  476. } else {
  477. // 若没有指定地址ID,获取默认地址
  478. getAddressDefault().then((res) => {
  479. // 注意:原代码中未导入getAddressDefault,可能是遗漏
  480. if (res.data) {
  481. // 若默认地址存在
  482. res.data.isDefault = parseInt(res.data.isDefault);
  483. addressInfo.value = res.data || {};
  484. addressId.value = res.data.id || 0;
  485. address.value.addressId = res.data.id || 0;
  486. }
  487. });
  488. }
  489. };
  490. // 关闭地址弹窗
  491. const changeClose = () => {
  492. address.value.address = false; // 隐藏地址弹窗
  493. };
  494. const computedMarginTop = computed(() => {
  495. return "50rpx";
  496. });
  497. onLoad(() => {
  498. // 若已登录且非支付页面,则获取地址信息(注释掉的逻辑,预留)
  499. if (appStore.isLogin) {
  500. // console.log(1111);
  501. getaddressInfo();
  502. // 等待DOM更新后,调用地址组件的方法获取地址列表
  503. nextTick(() => {
  504. addressWindowRef.value.fetchAddressList();
  505. });
  506. }
  507. });
  508. // 找款接口
  509. import {
  510. getUserFindFundsAPI,
  511. submitFindFundsAPI,
  512. acceptFindFundsAPI,
  513. cancelFindFundsAPI,
  514. paylFindFundsBalanceAPI,
  515. submitFindFundsRateAPI,
  516. } from "@/api/find_fund";
  517. // 导入支付相关工具(封装的支付逻辑,如提交支付、验证支付渠道等)
  518. import WPayment from "@/components/WPayment";
  519. import { usePayment } from "@/hooks/usePayment.js";
  520. import { useImageUpload } from "@/hooks/useImageUpload";
  521. // 初始化支付工具(获取支付相关方法)
  522. const { submitPayment, paymentConfig, getAvailableChannels } = usePayment();
  523. const { imageList, afterRead, deletePic, uploadLoading } = useImageUpload({
  524. pid: 11,
  525. model: "resubmit",
  526. });
  527. const appStore = useAppStore();
  528. console.log(appStore);
  529. const title = ref("全部");
  530. const count = ref(5);
  531. const message = ref("");
  532. const role = ref("买家");
  533. // 控制组件显示/隐藏
  534. const showPopup = ref(false);
  535. const totalPrice = ref("99");
  536. // 创建响应式数据
  537. const tabsList = reactive([
  538. { name: "全部", status: 6 },
  539. { name: "待找款", status: 1 },
  540. { name: "已接单", status: 2 },
  541. { name: "确认单", status: 3 },
  542. { name: "待评分", status: 5 },
  543. { name: "完成单", status: 4 },
  544. ]);
  545. // z-paing绑定数据
  546. const dataList = ref([]);
  547. const articleType = ref(6); // 订单类型(找款)
  548. const payChannel = ref("alipay");
  549. // 响应式变量:支付方式列表(包含支付宝、微信、余额等支付方式配置)
  550. const payments = reactive([
  551. // {
  552. // name: "支付宝支付", // 支付方式名称
  553. // icon: "icon-zhifubao", // 图标类名
  554. // value: "alipay", // 支付标识值
  555. // title: "支付宝快捷支付", // 支付说明
  556. // payType: "alipay", // 支付类型
  557. // payStatus: 1, // 支付状态(1-可用,0-不可用)
  558. // },
  559. // {
  560. // name: "微信支付",
  561. // icon: "icon-wechat",
  562. // value: "weixin",
  563. // title: "微信快捷支付",
  564. // payType: "weixin",
  565. // payStatus: 1,
  566. // },
  567. {
  568. name: "余额支付",
  569. icon: "icon-balance",
  570. value: "yue",
  571. title: "可用余额:",
  572. payType: "yue",
  573. payStatus: 1,
  574. },
  575. ]);
  576. const pagingRef = ref();
  577. // tabs点击事件
  578. const onTabClick = (item) => {
  579. title.value = item.name;
  580. articleType.value = item.status;
  581. pagingRef.value.reload();
  582. };
  583. async function handleQuery(page, pageSize) {
  584. try {
  585. uni.showLoading({ title: "加载中" });
  586. // 请求参数
  587. const params = {
  588. page: page,
  589. limit: pageSize,
  590. status: articleType.value,
  591. userId: appStore.uid,
  592. };
  593. const { data } = await getUserFindFundsAPI(params);
  594. const { list: originalList, total } = data.page;
  595. // 关键:为list中的每个项添加新属性(例如添加isNew: false)
  596. const processedList = originalList.map((item) => ({
  597. ...item, // 保留原有属性
  598. productImages: JSON.parse(item.acceptorImgs),
  599. images: JSON.parse(item.purchaserImgs),
  600. }));
  601. // console.log(processedList);
  602. // 角色判断逻辑
  603. data.is_by ? (role.value = "代购") : (role.value = "买家");
  604. uni.hideLoading();
  605. // 将处理后的列表传给z-paging,不影响分页功能
  606. pagingRef.value.complete(processedList, total);
  607. } catch (e) {
  608. pagingRef.value.complete(false);
  609. uni.hideLoading();
  610. console.error("查询失败:", e);
  611. }
  612. }
  613. // 点击接单
  614. const takeOrderHandle = async (order) => {
  615. const res = await acceptFindFundsAPI(order.id);
  616. // console.log(res);
  617. if (res.code == 200) {
  618. Toast({ title: "接单成功" });
  619. title.value = "已接单";
  620. articleType.value = 2;
  621. pagingRef.value.reload();
  622. }
  623. // console.log("点击接单", order);
  624. // title.value = "已接单";
  625. };
  626. // 提供给买家的信息
  627. const practicalWeight = ref("");
  628. const quoteWage = ref("");
  629. const acceptorText = ref("");
  630. // 提交信息等待买家确认
  631. const submitFindFundsHandle = async (order) => {
  632. console.log(order);
  633. const params = {
  634. orderId: order.id,
  635. practicalWeight: practicalWeight.value,
  636. quoteWage: quoteWage.value,
  637. acceptorText: acceptorText.value,
  638. acceptorImgs: imageList.value.map((v) => v.info.url),
  639. };
  640. const res = await submitFindFundsAPI(params);
  641. if (res.code == 200) {
  642. Toast({ title: "提交信息成功" });
  643. title.value = "确认单";
  644. articleType.value = 3;
  645. pagingRef.value.reload();
  646. }
  647. };
  648. // 取消支付
  649. const show = ref(false);
  650. const content = ref("确定取消订单?");
  651. const orderId = ref(null);
  652. const refuse = (id) => {
  653. orderId.value = id;
  654. show.value = true;
  655. };
  656. const confirm = async () => {
  657. const res = await cancelFindFundsAPI(orderId.value);
  658. if (res.code == 200) {
  659. Toast({ title: "取消订单成功" });
  660. pagingRef.value.reload();
  661. show.value = false;
  662. }
  663. };
  664. // 关闭弹窗
  665. function close() {
  666. show.value = false;
  667. }
  668. // 支付相关逻辑
  669. const goldType = ref("au");
  670. const orderbanceId = ref(null);
  671. const orderUserInfo = ref({});
  672. // 确认支付
  673. const opPopup = (item) => {
  674. if (!addressInfo.value.id) {
  675. return Toast({ title: "请选择收货地址" });
  676. }
  677. if (!selectedExpress.value.label) {
  678. return Toast({ title: "请选择快递公司" });
  679. }
  680. goldType.value = item.metalType;
  681. // goldType.value = "pt";
  682. orderbanceId.value = item.id;
  683. showPopup.value = true;
  684. getPayBalanceInfo(orderbanceId.value, false, selectedExpress.value.type);
  685. };
  686. const switchStatus = ref(false);
  687. const handlePaymentChange = async (value) => {
  688. // console.log("从子组件接收的开关状态:", value);
  689. const res = await paylFindFundsBalanceAPI(
  690. orderbanceId.value,
  691. value,
  692. selectedExpress.value.type
  693. );
  694. orderUserInfo.value = res.data;
  695. };
  696. // 获取订单金额/用户信息
  697. const getPayBalanceInfo = async (id, type) => {
  698. const res = await paylFindFundsBalanceAPI(
  699. id,
  700. type,
  701. selectedExpress.value.type
  702. );
  703. orderUserInfo.value = res.data;
  704. };
  705. const confirmPay = async () => {
  706. showPopup.value = true;
  707. };
  708. // 切换支付方式
  709. const changePayChannel = (item) => {
  710. payChannel.value = item.value;
  711. };
  712. // 关闭组件弹窗
  713. function payComplete() {
  714. payClose();
  715. title.value = "待评分";
  716. articleType.value = 5;
  717. pagingRef.value.reload();
  718. }
  719. const paymentRef = ref(null);
  720. function payClose() {
  721. showPopup.value = false;
  722. paymentRef.value.triggerChange(false);
  723. }
  724. const buyRate = ref(0);
  725. // 提交买家评分
  726. const submitRateHandle = async (item) => {
  727. if (item.isScore) {
  728. return Toast({ title: "您已评分,请勿重复操作" });
  729. }
  730. const res = await submitFindFundsRateAPI({
  731. orderId: item.id,
  732. rating: buyRate.value,
  733. });
  734. Toast({ title: "评分成功" });
  735. title.value = "完成单";
  736. articleType.value = 4;
  737. pagingRef.value.reload();
  738. };
  739. const changeRate = (e) => {
  740. // console.log(value);
  741. buyRate.value = e.value;
  742. };
  743. // 预览图片
  744. const previewImage = (item) => {
  745. console.log(item[0]);
  746. // 预览图片,支持多张图片传数组
  747. uni.previewImage({
  748. urls: item,
  749. current: item[0],
  750. });
  751. };
  752. </script>
  753. <style lang="scss" scoped>
  754. .express-popup {
  755. .item-cell {
  756. text-align: center;
  757. }
  758. }
  759. .tabs-container {
  760. width: 100%;
  761. // margin-top: 20rpx;
  762. }
  763. ::v-deep .top-nav {
  764. .u-navbar__content {
  765. background-color: $header-color !important;
  766. }
  767. }
  768. ::v-deep .pagingRef-container {
  769. margin-top: 50rpx;
  770. // background-color: #f8f8f8;
  771. // position: relative;
  772. }
  773. // 快递盒子
  774. .express-box {
  775. margin: 30rpx 0;
  776. }
  777. ::v-deep .u-radio-group--row {
  778. justify-content: space-between;
  779. }
  780. .page-container {
  781. width: 100%;
  782. height: auto;
  783. padding: 20rpx 30rpx;
  784. display: flex;
  785. flex-direction: column;
  786. align-items: center;
  787. min-height: 100vh;
  788. background: $uni-bg-primary;
  789. .upload-box {
  790. margin-top: 40rpx;
  791. .upload-block {
  792. width: 160rpx;
  793. height: 160rpx;
  794. border: 1px solid #ccc;
  795. border-radius: 10rpx;
  796. display: flex;
  797. flex-direction: column;
  798. justify-content: center;
  799. align-items: center;
  800. color: #ccc;
  801. font-weight: 700;
  802. font-size: 26rpx;
  803. }
  804. }
  805. .order-info-box {
  806. width: 100%;
  807. margin-top: 50rpx;
  808. padding: 0 30rpx;
  809. box-sizing: border-box;
  810. .order-info-item {
  811. height: auto;
  812. background-color: #ffffff;
  813. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  814. border-radius: 20rpx;
  815. box-sizing: border-box;
  816. display: flex;
  817. flex-direction: column;
  818. margin: 20rpx 0;
  819. align-items: center;
  820. padding-bottom: 30rpx;
  821. .title-box {
  822. width: 100%;
  823. display: flex;
  824. height: 78rpx;
  825. background-color: #f2f2f2;
  826. border-radius: 20rpx 20rpx 0rpx 0rpx;
  827. align-items: center;
  828. justify-content: space-between;
  829. box-sizing: border-box;
  830. font-size: 22rpx;
  831. color: #000000;
  832. padding: 0 20rpx;
  833. .order-status {
  834. padding: 5rpx;
  835. background: #cc9933;
  836. color: #fff;
  837. border-radius: 5rpx;
  838. font-size: 20rpx;
  839. }
  840. }
  841. .order-content {
  842. width: 100%;
  843. height: 344rpx;
  844. display: flex;
  845. align-items: center;
  846. box-sizing: border-box;
  847. padding: 0 25rpx;
  848. .image-box {
  849. width: 259rpx;
  850. height: 259rpx;
  851. border-radius: 10rpx;
  852. border: solid 1rpx #c2c2c2;
  853. image {
  854. width: 100%;
  855. height: 100%;
  856. }
  857. }
  858. .ordser-info-desc {
  859. margin-left: 25rpx;
  860. display: flex;
  861. flex-direction: column;
  862. justify-content: space-between;
  863. .info-desc-item {
  864. width: 325rpx;
  865. font-size: 25rpx;
  866. color: #000000;
  867. margin-bottom: 15rpx;
  868. white-space: normal;
  869. }
  870. .buyer-message {
  871. white-space: pre-wrap;
  872. word-wrap: break-word;
  873. word-break: break-all;
  874. line-height: 1.4;
  875. }
  876. .rate {
  877. font-size: 25rpx;
  878. color: #000000;
  879. display: flex;
  880. align-items: center;
  881. }
  882. }
  883. }
  884. .Purchasing {
  885. display: flex;
  886. flex-direction: column;
  887. align-items: center;
  888. width: 100%;
  889. .Purchasing-btn {
  890. width: 270rpx;
  891. height: 66rpx;
  892. position: relative;
  893. .sb-btn-img {
  894. width: 100%;
  895. height: 100%;
  896. }
  897. text {
  898. position: absolute;
  899. top: 50%;
  900. left: 50%;
  901. transform: translate(-50%, -50%);
  902. }
  903. }
  904. .Purchasing-tips {
  905. font-size: 20rpx;
  906. color: #7c7c7c;
  907. margin: 30rpx 0;
  908. }
  909. }
  910. .Buyers {
  911. margin-top: 40rpx;
  912. width: 100%;
  913. display: flex;
  914. align-items: center;
  915. flex-direction: column;
  916. .Buyers-tips {
  917. font-size: 25rpx;
  918. color: #000000;
  919. }
  920. .Buyers-rate-box {
  921. font-size: 25rpx;
  922. color: #000000;
  923. display: flex;
  924. align-items: center;
  925. margin: 30rpx 0;
  926. text {
  927. margin-right: 10rpx;
  928. }
  929. }
  930. .Buyers-btn {
  931. width: 269rpx;
  932. height: 66rpx;
  933. font-size: 28rpx;
  934. color: #000;
  935. margin: 30rpx 0 40rpx 0;
  936. position: relative;
  937. .sb-btn-img {
  938. width: 100%;
  939. height: 100%;
  940. }
  941. text {
  942. position: absolute;
  943. top: 50%;
  944. left: 50%;
  945. transform: translate(-50%, -50%);
  946. white-space: nowrap;
  947. }
  948. &.disabled {
  949. opacity: 0.6;
  950. cursor: not-allowed;
  951. background-color: #c2c2c2;
  952. }
  953. }
  954. }
  955. .border-line {
  956. width: 100%;
  957. height: 0rpx;
  958. border: dashed 1rpx #acacac;
  959. }
  960. .find-funds-info {
  961. width: 682rpx;
  962. height: 1069rpx;
  963. background-color: #ffffff;
  964. box-sizing: border-box;
  965. padding: 40rpx;
  966. .title-box {
  967. display: flex;
  968. flex-direction: column;
  969. align-items: center;
  970. // padding: 30rpx;
  971. box-sizing: border-box;
  972. background: #ffffff;
  973. .title {
  974. font-size: 28rpx;
  975. color: #000000;
  976. }
  977. .f-title {
  978. font-size: 21rpx;
  979. color: #848484;
  980. }
  981. }
  982. .upload-box {
  983. margin-top: 40rpx;
  984. }
  985. .info-box {
  986. .info-item {
  987. display: flex;
  988. align-items: center;
  989. margin: 40rpx 0rpx;
  990. position: relative;
  991. .info-label {
  992. font-size: 26rpx;
  993. color: #000000;
  994. width: 200rpx;
  995. }
  996. .info-input {
  997. width: 437rpx;
  998. height: 69rpx;
  999. background-color: #f3f3f3;
  1000. border-radius: 10rpx;
  1001. display: flex;
  1002. align-items: center;
  1003. input {
  1004. width: 100%;
  1005. height: 100%;
  1006. padding-left: 10rpx;
  1007. }
  1008. }
  1009. }
  1010. }
  1011. }
  1012. // 确认单
  1013. .order-confirm {
  1014. width: 100%;
  1015. margin-top: 30rpx;
  1016. padding: 0 25rpx;
  1017. .image-box {
  1018. display: flex;
  1019. justify-content: space-between;
  1020. image {
  1021. width: 195rpx;
  1022. height: 195rpx;
  1023. border-radius: 10rpx;
  1024. }
  1025. }
  1026. .confirm-info {
  1027. display: flex;
  1028. align-items: center;
  1029. margin: 40rpx 0;
  1030. .confirm-info-left {
  1031. flex: 1;
  1032. display: flex;
  1033. justify-content: center;
  1034. }
  1035. .confirm-info-right {
  1036. flex: 1;
  1037. display: flex;
  1038. justify-content: center;
  1039. }
  1040. }
  1041. .confirm-message {
  1042. display: flex;
  1043. // height: auto;
  1044. align-items: center;
  1045. .value {
  1046. width: 468rpx;
  1047. font-size: 26rpx;
  1048. color: #7c7c7c;
  1049. white-space: normal;
  1050. overflow-wrap: break-word;
  1051. }
  1052. }
  1053. .confirm-pay-box {
  1054. display: flex;
  1055. justify-content: space-between;
  1056. align-items: center;
  1057. width: 100%;
  1058. .pay {
  1059. width: 269rpx;
  1060. height: 66rpx;
  1061. position: relative;
  1062. color: #000;
  1063. .sb-btn-img {
  1064. width: 100%;
  1065. height: 100%;
  1066. }
  1067. text {
  1068. position: absolute;
  1069. top: 50%;
  1070. left: 50%;
  1071. transform: translate(-50%, -50%);
  1072. white-space: nowrap;
  1073. }
  1074. }
  1075. }
  1076. }
  1077. .btn {
  1078. width: 367rpx;
  1079. height: 73rpx;
  1080. font-size: 28rpx;
  1081. color: #000;
  1082. margin-bottom: 100rpx;
  1083. position: relative;
  1084. .sb-btn-img {
  1085. width: 100%;
  1086. height: 100%;
  1087. }
  1088. text {
  1089. position: absolute;
  1090. top: 50%;
  1091. left: 50%;
  1092. transform: translate(-50%, -50%);
  1093. white-space: nowrap;
  1094. }
  1095. }
  1096. .white {
  1097. height: 100rpx;
  1098. }
  1099. }
  1100. }
  1101. }
  1102. // 弹出框样式
  1103. .pay-list {
  1104. width: 100%;
  1105. // height: auto;
  1106. height: auto;
  1107. padding: 30rpx;
  1108. .pay-title {
  1109. font-size: 32rpx;
  1110. color: #cc9933;
  1111. margin: 10rpx 0;
  1112. }
  1113. .pay-item {
  1114. display: flex;
  1115. align-items: center;
  1116. width: 100%;
  1117. margin-bottom: 10rpx;
  1118. height: 80rpx;
  1119. border-radius: 30rpx;
  1120. padding: 0 30rpx;
  1121. box-sizing: border-box;
  1122. border: 1px solid transparent;
  1123. transition: all 0.3s ease;
  1124. &.active {
  1125. border-color: #e8c279;
  1126. }
  1127. .iconfont {
  1128. width: 44rpx;
  1129. height: 44rpx;
  1130. border-radius: 50%;
  1131. text-align: center;
  1132. line-height: 44rpx;
  1133. background-color: #fe960f;
  1134. color: #fff;
  1135. font-size: 30rpx;
  1136. margin-right: 15rpx;
  1137. &.icon-wechat {
  1138. background-color: #41b035;
  1139. }
  1140. &.icon-zhifubao {
  1141. background-color: #06b4fd;
  1142. }
  1143. }
  1144. }
  1145. .comfirm-btn {
  1146. width: 200rpx;
  1147. height: 60rpx;
  1148. display: flex;
  1149. justify-content: center;
  1150. align-items: center;
  1151. color: #fff;
  1152. background: #e8c279;
  1153. margin: 0 auto;
  1154. border-radius: 30rpx;
  1155. }
  1156. }
  1157. // 地址相关样式
  1158. .address {
  1159. width: 690rpx;
  1160. max-height: 180rpx;
  1161. padding: 28rpx;
  1162. background-color: #fff;
  1163. box-sizing: border-box;
  1164. border-radius: 30rpx;
  1165. margin: 0 auto;
  1166. margin-top: 20rpx;
  1167. .addressCon {
  1168. width: 596rpx;
  1169. font-size: 26rpx;
  1170. color: #666;
  1171. .name {
  1172. font-size: 30rpx;
  1173. color: #282828;
  1174. font-weight: bold;
  1175. margin-bottom: 10rpx;
  1176. .phone {
  1177. margin-left: 50rpx;
  1178. }
  1179. }
  1180. .default {
  1181. margin-right: 12rpx;
  1182. }
  1183. .setaddress {
  1184. color: #333;
  1185. font-size: 28rpx;
  1186. }
  1187. }
  1188. .iconfont {
  1189. font-size: 35rpx;
  1190. color: #707070;
  1191. }
  1192. }
  1193. </style>