list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <view class="container">
  3. <view class="topview" :style="{ top: tabTop + 'px' }">
  4. <!--订单类型选择-->
  5. <scroll-view scroll-x="true" class="scrollbox">
  6. <view class="order-type u-flex-center">
  7. <view
  8. class="type-name u-font26 u-181818"
  9. :class="{ active: isChange == index }"
  10. v-for="(item, index) in orderType"
  11. :key="index"
  12. @click="clickBtn(index)"
  13. >
  14. {{ item }}
  15. </view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. <view class="plrbottom">
  20. <!--订单列表-->
  21. <view class="order-list" v-for="item in orderList" :key="item.id">
  22. <view class="u-bg-fff order-item" @click="goGbOrderDetails(item)">
  23. <view class="u-shop-teile-pd">
  24. <view class="u-text1 viewWidthTitle">
  25. <text class="iconfont2 u-font34 u-bold" style="color: #fa6138"
  26. >&#xe611;</text
  27. >
  28. <text class="u-1A1A1A u-font30 u-ml15">{{ item.shop_name }}</text>
  29. <text class="u-CCC right-icon iconfont">&#xe6c7;</text>
  30. </view>
  31. <text class="u-FF0000 u-font28" v-if="item.pay_status == 0"
  32. >待付款</text
  33. >
  34. <text
  35. class="u-FF0000 u-font28"
  36. v-if="
  37. item.pay_status == 5 && (item.status == 0 || item.status == 1)
  38. "
  39. >待成团</text
  40. >
  41. <text
  42. class="u-FF0000 u-font28"
  43. v-if="item.pay_status == 5 && item.status == 2"
  44. >组团成功</text
  45. >
  46. <text
  47. class="u-FF0000 u-font28"
  48. v-if="item.status == 3 || item.status == 4"
  49. >组团失败</text
  50. >
  51. </view>
  52. <view class="u-border-one-one"></view>
  53. <view v-if="orderList.length > 0">
  54. <!-- <ldgoods :value="item" :isGroup="true" @click.native="goProductDetails(item)"></ldgoods> -->
  55. <view class="details-top">
  56. <view class="details-left">
  57. <image
  58. :src="`${item.goods_cover}?x-oss-process=style/w_350`"
  59. v-if="item.goods_cover"
  60. class="u-goods200 u-ml15"
  61. mode=""
  62. ></image>
  63. <image
  64. :src="`${item.goods_img}?x-oss-process=style/w_350`"
  65. v-if="item.goods_img"
  66. class="u-goods200 u-ml15"
  67. mode=""
  68. ></image>
  69. </view>
  70. <view class="details-right">
  71. <view class="right-top">
  72. {{ item.goods_title }}
  73. </view>
  74. <view class="specifications">
  75. 规格:{{ item.sku_set_name }}
  76. </view>
  77. <view class="amount-of-money">
  78. <view
  79. style="font-size: 26rpx"
  80. v-if="item.real_price % 1 === 0"
  81. >
  82. ¥{{ item.real_price }}.00
  83. </view>
  84. <view style="font-size: 26rpx" v-else>
  85. ¥{{ item.real_price }}0
  86. </view>
  87. <text class="group">{{ item.group_people_num }}人拼</text>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="u-text-right u-plr30 u-mt20">
  92. <view class="u-flex" style="justify-content: flex-end">
  93. <view class="u-text-right">
  94. 共{{ item.number }}件商品, 总金额
  95. </view>
  96. <view class="u-FF0000">
  97. <rich-text
  98. :nodes="$mUtil.priceBigSmall(item.total_amount)"
  99. ></rich-text>
  100. </view>
  101. <text v-if="item.total_point > 0"
  102. >,总积分:{{ item.total_point }}</text
  103. >
  104. </view>
  105. <view class="u-mt10">含运费¥{{ item.real_freight }}</view>
  106. <view class="u-flex-column-end u-mt30">
  107. <view class="u-flex">
  108. <!--去付款-->
  109. <view class="u-flex-center">
  110. <view v-if="item.pay_status == 0">
  111. <text class="iconfont">&#xe681;</text> 支付剩余({{
  112. item | dateFilter
  113. }})
  114. </view>
  115. <view
  116. class="btn-item u-text-center u-FF0000 br-FF0000"
  117. v-if="item.pay_status == 0"
  118. @click.stop="goGbOrderDetails(item)"
  119. >去付款</view
  120. >
  121. <view
  122. class="btn-item u-text-center u-060606 br-999"
  123. v-if="item.pay_status != 0"
  124. @click.stop="goGbOrderDetails(item)"
  125. >查看详情</view
  126. >
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <loadMore v-if="orderList.length > 0" :status="status"></loadMore>
  135. <nodata v-else :config="{ top: 15, content: '暂无订单~' }"></nodata>
  136. </view>
  137. <!--页面加载动画-->
  138. <ldLoading isFullScreen :active="loading"></ldLoading>
  139. </view>
  140. </template>
  141. <script setup>
  142. import { ref, reactive, onMounted, onUnmounted } from "vue";
  143. import {
  144. onLoad,
  145. onUnload,
  146. onReachBottom,
  147. onPullDownRefresh,
  148. } from "@dcloudio/uni-app";
  149. // 响应式数据
  150. const list = ref(1);
  151. const isChange = ref(0);
  152. const timeCount = ref(0);
  153. const timer = ref(null);
  154. const orderType = ref(["全部订单", "待付款", "待成团", "组团成功", "组团失败"]);
  155. const loading = ref(true);
  156. const orderList = ref([]);
  157. const status = ref("more");
  158. const noData = ref(false);
  159. const parmas = reactive({
  160. page: 1,
  161. limit: 10,
  162. });
  163. const orderid = ref(null);
  164. const currentKey = ref(null);
  165. const tabTop = ref(0);
  166. // 全局变量
  167. let vObj;
  168. const app = getApp();
  169. // 页面生命周期
  170. onLoad((options) => {
  171. vObj = getCurrentInstance().proxy;
  172. timer.value = setInterval(() => {
  173. timeCount.value++;
  174. }, 1000);
  175. tabTop.value = app.globalData.barHeight + 44;
  176. if (options.keys) {
  177. // 处理选项
  178. }
  179. getOrderList();
  180. });
  181. onUnload(() => {
  182. // console.log(66666666);
  183. clearInterval(timer.value);
  184. });
  185. onReachBottom(() => {
  186. status.value = "loading";
  187. parmas.page++;
  188. getOrderList();
  189. });
  190. onPullDownRefresh(() => {
  191. rest();
  192. getOrderList();
  193. });
  194. // 过滤器函数
  195. const dateFilter = (item) => {
  196. let time = item.pay_expire_time - item.now_millis - vObj.timeCount * 1000;
  197. let str = vObj.$mUtil.countDownClock(time);
  198. return str;
  199. };
  200. const payStatus = (val) => {
  201. switch (val) {
  202. case 0:
  203. return "待支付";
  204. case 1:
  205. return "待发货";
  206. case 2:
  207. return "部分发货";
  208. case 3:
  209. return "待收货";
  210. case 4:
  211. return "已收货";
  212. case 5:
  213. return "待评价";
  214. case 6:
  215. return "关闭";
  216. default:
  217. return "";
  218. }
  219. };
  220. const payStatusRight = (val) => {
  221. switch (val) {
  222. case 0:
  223. return "申请退款中";
  224. case 1:
  225. return "商家同意";
  226. case 4:
  227. return "商家发起退款支付";
  228. case 5:
  229. return "退款成功";
  230. case 6:
  231. return "商家拒绝";
  232. default:
  233. return "";
  234. }
  235. };
  236. const payStatusRights = (val) => {
  237. switch (val) {
  238. case 0:
  239. return "申请退款/退货中";
  240. case 1:
  241. return "等待买家发货";
  242. case 2:
  243. return "待商家收货";
  244. case 3:
  245. return "商家已收货";
  246. case 4:
  247. return "商家待打款";
  248. case 5:
  249. return "退款/退货成功";
  250. case 6:
  251. return "商家拒绝";
  252. case 7:
  253. return "自动关闭";
  254. case 8:
  255. return "撤销";
  256. default:
  257. return "";
  258. }
  259. };
  260. // 方法定义
  261. const goGbOrderDetails = (item) => {
  262. if (item.pay_status == 0) {
  263. uni.navigateTo({
  264. url: `./gbOrderDetails?id=${item.pay_order_id}&status=waitpay`,
  265. });
  266. } else {
  267. uni.navigateTo({
  268. url: `./gbOrderDetails?id=${item.order_id}&groupId=${item.id}&status=pay`,
  269. });
  270. }
  271. };
  272. const goProductDetails = (item) => {
  273. uni.navigateTo({
  274. url: "/pages/product/goods/puzzleGoods?id=" + item.group_buy_goods_id,
  275. });
  276. };
  277. const goPhone = (phone) => {
  278. if (phone) {
  279. uni.makePhoneCall({
  280. phoneNumber: phone,
  281. });
  282. }
  283. };
  284. const lookLoginsList = (orderid, num, img, type) => {
  285. uni.navigateTo({
  286. url: `../logistics?id=${orderid}&num=${num}&img=${img}&type=${type}`,
  287. });
  288. };
  289. const goRefundType = (i, code, time, list, orderid, childid) => {
  290. uni.setStorageSync("blackgoodsList", list);
  291. if (i == 1) {
  292. uni.navigateTo({
  293. url: `applicationDrawback?keystatus=${i}&title=申请退款&orderid=${orderid}`,
  294. });
  295. } else {
  296. uni.navigateTo({
  297. url: `refundType?order_code=${code}&format_order_time=${time}&keystatus=${i}&orderid=${orderid}&childid=${childid}`,
  298. });
  299. }
  300. };
  301. const sureGetOrder = (id, k) => {
  302. uni.showModal({
  303. title: "提示",
  304. content: "确定已经收到了该商品?",
  305. success: (res) => {
  306. if (res.confirm) {
  307. globalThis.$http
  308. .post("/order/receipt", {
  309. order_id: id,
  310. })
  311. .then((res) => {
  312. if (res && res.code == 200) {
  313. globalThis.$mUtil.toast("收货成功");
  314. rest();
  315. if (k == 1) {
  316. getOrderList();
  317. } else if (k == 2) {
  318. otherPay(currentKey.value);
  319. }
  320. }
  321. });
  322. }
  323. },
  324. });
  325. };
  326. const otherFun = (object) => {
  327. if (object) {
  328. console.log(object.addressid);
  329. globalThis.$http
  330. .put("/order/update-receipt/" + orderid.value + "/" + object.addressid)
  331. .then((res) => {
  332. if (res && res.code == 200) {
  333. globalThis.$mUtil.toast("修改成功");
  334. }
  335. });
  336. }
  337. };
  338. const changeAddress = (id) => {
  339. orderid.value = id;
  340. uni.navigateTo({
  341. url: "/pages/user/address/addressList",
  342. });
  343. };
  344. const rest = () => {
  345. parmas.page = 1;
  346. orderList.value = [];
  347. };
  348. const getOrderList = () => {
  349. globalThis.$http.get("/groupbuy/team/my", parmas).then((res) => {
  350. loading.value = false;
  351. if (res && res.code == 200) {
  352. uni.stopPullDownRefresh();
  353. orderList.value = orderList.value.concat(res.page.list);
  354. if (orderList.value.length == 0) {
  355. noData.value = true;
  356. } else {
  357. noData.value = false;
  358. }
  359. if (res.page.totalPage <= res.page.currPage) {
  360. status.value = "noMore";
  361. } else {
  362. status.value = "more";
  363. }
  364. }
  365. });
  366. };
  367. const clickBtn = (index) => {
  368. rest();
  369. isChange.value = index;
  370. if (index > 0) {
  371. parmas.status = index;
  372. } else {
  373. delete parmas.status;
  374. }
  375. getOrderList();
  376. };
  377. const waitpayOrder = (id, total_amount, expired_pay_time) => {
  378. uni.navigateTo({
  379. url: `../../order/pay?id=${id}&total_amount=${total_amount}&expired_pay_time=${expired_pay_time}`,
  380. });
  381. };
  382. const goOrderDetails = (id) => {
  383. uni.navigateTo({
  384. url: `orderDetails?id=${id}&status=pay`,
  385. });
  386. };
  387. const gotoBalckDetail = (id, shopid, type, status) => {
  388. uni.navigateTo({
  389. url: `orderblackDetails?id=${id}&shopid=${shopid}&type=${type}&status=${status}`,
  390. });
  391. };
  392. const goOrderDetailsPay = (id) => {
  393. uni.navigateTo({
  394. url: `orderDetails?id=${id}&status=waitpay`,
  395. });
  396. };
  397. const otherPay = (key) => {
  398. // 需要实现 otherPay 方法
  399. console.log("otherPay called with key:", key);
  400. };
  401. </script>
  402. <style>
  403. page {
  404. background-color: #f5f5f5;
  405. }
  406. </style>
  407. <style lang="scss" scoped>
  408. .u-border-one-one {
  409. border-top: 3rpx solid #e7e7e7;
  410. margin-bottom: 30rpx;
  411. }
  412. .right-icon {
  413. font-size: 25rpx;
  414. }
  415. .details-top {
  416. display: flex;
  417. .details-right {
  418. margin-left: 30rpx;
  419. display: flex;
  420. flex-direction: column;
  421. justify-content: space-between;
  422. .right-top {
  423. font-size: 28rpx;
  424. color: #1a1a1a;
  425. font-weight: 400;
  426. }
  427. .specifications {
  428. font-size: 22rpx;
  429. color: #999999;
  430. font-weight: 400;
  431. margin-top: 40rpx;
  432. margin-left: 2rpx;
  433. }
  434. .amount-of-money {
  435. display: flex;
  436. font-size: 26rpx;
  437. color: #1a1a1a;
  438. font-weight: 400;
  439. .group {
  440. margin-left: 20rpx;
  441. color: #999999;
  442. font-weight: 400;
  443. font-size: 26rpx;
  444. }
  445. }
  446. }
  447. }
  448. .shop-icon {
  449. font-size: 40rpx;
  450. color: #0b844a;
  451. }
  452. .order-list {
  453. margin-bottom: 30rpx;
  454. }
  455. .order-list .order-item {
  456. padding-bottom: 20px;
  457. }
  458. .u-shop-teile-pd {
  459. display: flex;
  460. justify-content: space-between;
  461. }
  462. .plrbottom {
  463. padding: 110rpx 30rpx 0;
  464. }
  465. .topview {
  466. background-color: #f5f5f5;
  467. height: 110rpx;
  468. width: 100%;
  469. position: fixed;
  470. left: 0;
  471. box-sizing: border-box;
  472. padding: 0 30rpx;
  473. z-index: 66;
  474. }
  475. .scrollbox {
  476. white-space: nowrap;
  477. }
  478. .pt-pb {
  479. padding: 30rpx;
  480. }
  481. .pt15-pb24 {
  482. padding-top: 24rpx;
  483. padding-bottom: 24rpx;
  484. }
  485. .br-FF0000 {
  486. border: 1px solid #ff0000;
  487. }
  488. .br-999 {
  489. border: 1px solid #999999;
  490. }
  491. .order-type {
  492. margin-top: 30rpx;
  493. margin-bottom: 26rpx;
  494. display: inline-block;
  495. .active {
  496. background: #fa6138;
  497. color: #ffffff;
  498. }
  499. .type-name {
  500. border-radius: 30px;
  501. padding: 12rpx 18rpx;
  502. display: inline-block;
  503. }
  504. }
  505. .listImg {
  506. padding: 20rpx 0 0 16rpx;
  507. }
  508. .listimgGroup {
  509. width: 200rpx;
  510. height: 200rpx;
  511. margin: 0 25rpx 25rpx 0;
  512. }
  513. .order-item {
  514. .btn-type {
  515. padding-bottom: 25rpx;
  516. .pay-time {
  517. line-height: 70rpx;
  518. margin-left: auto;
  519. }
  520. }
  521. .btn-item {
  522. width: 200rpx;
  523. height: 70rpx;
  524. line-height: 68rpx;
  525. border-radius: 35px;
  526. margin-left: 22rpx;
  527. }
  528. }
  529. .childBox {
  530. background-color: #ffffff;
  531. border-radius: 20rpx;
  532. margin-bottom: 30rpx;
  533. }
  534. </style>