orderForm.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view>
  3. <u-navbar @leftClick="rightClick" bgColor="#f4f4f4">
  4. <view class="tab" slot="center">
  5. <view
  6. style="
  7. width: 450rpx;
  8. margin-right: 150rpx;
  9. background-color: #fff;
  10. border-radius: 50rpx;
  11. "
  12. >
  13. <u--input
  14. placeholder="搜索我的订单"
  15. border="surround"
  16. shape="circle"
  17. v-model="keywords"
  18. @change="searchOrder"
  19. class="inp"
  20. ></u--input>
  21. </view>
  22. </view>
  23. </u-navbar>
  24. <view class="content">
  25. <view class="top-tab">
  26. <view
  27. :class="{ commodity: follow == '' }"
  28. class="tab"
  29. @click="tabSwitch('')"
  30. >
  31. 全部
  32. </view>
  33. <view
  34. :class="{ commodity: follow == 'unpaid' }"
  35. class="tab"
  36. @click="tabSwitch('unpaid')"
  37. >
  38. 待付款
  39. </view>
  40. <view
  41. :class="{ commodity: follow == 'unreview' }"
  42. class="tab"
  43. @click="tabSwitch('unreview')"
  44. >
  45. 拼团中
  46. </view>
  47. <view
  48. :class="{ commodity: follow == 'undelivered' }"
  49. class="tab"
  50. @click="tabSwitch('undelivered')"
  51. >
  52. 待发货
  53. </view>
  54. <view
  55. :class="{ commodity: follow == 'undifference' }"
  56. class="tab"
  57. @click="tabSwitch('undifference')"
  58. >
  59. 待补差价
  60. </view>
  61. <view
  62. :class="{ commodity: follow == 'delivered' }"
  63. class="tab"
  64. @click="tabSwitch('delivered')"
  65. >
  66. 待收货
  67. </view>
  68. <view
  69. :class="{ commodity: follow == 'finished' }"
  70. class="tab"
  71. @click="tabSwitch('finished')"
  72. >
  73. 已完成
  74. </view>
  75. <view
  76. :class="{ commodity: follow == 'closed' }"
  77. class="tab"
  78. @click="tabSwitch('closed')"
  79. >
  80. 已取消
  81. </view>
  82. <view
  83. :class="{ commodity: follow == 'refund' }"
  84. class="tab"
  85. @click="tabSwitch('refund')"
  86. >
  87. 退款/售后
  88. </view>
  89. </view>
  90. <view v-for="(item, index) in orderList" :key="index">
  91. <view v-if="follow != 'refund'">
  92. <OrderInofrmation
  93. ref="orderInformation"
  94. :itemInfo="item"
  95. @toDetail="toDetail"
  96. @cancellationOrder="cancellationOrder"
  97. @confirm="confirm"
  98. @toPay="toPay"
  99. @toEvaluate="toEvaluate"
  100. @unreviewAfter="unreviewAfter"
  101. @toLogistics="toLogistics"
  102. @againOrder="againOrder"
  103. @deleteOrder="deleteOrder"
  104. />
  105. </view>
  106. <view v-else>
  107. <RefundCard
  108. :itemInfo="item"
  109. :refundDetail="refundDetail"
  110. @toRefundDetail="toRefundDetail"
  111. @unreviewAfter="unreviewAfter"
  112. @deleteAfterOrder="deleteAfterOrder"
  113. />
  114. </view>
  115. </view>
  116. </view>
  117. <AgreePopup :agreeShow="agreeShow" @close="close" :title="title" />
  118. </view>
  119. </template>
  120. <script>
  121. import OrderInofrmation from "./component/orderInofrmation.vue";
  122. import RefundCard from "./component/refundCard.vue";
  123. import AgreePopup from "../mineComponent/agreePopup.vue";
  124. export default {
  125. components: {
  126. OrderInofrmation,
  127. RefundCard,
  128. AgreePopup,
  129. },
  130. data() {
  131. return {
  132. orderList: [],
  133. follow: "",
  134. refundDetail: {
  135. status: 1,
  136. },
  137. page: 1,
  138. total: 0,
  139. status: "",
  140. agreeShow: false,
  141. title: "",
  142. cancellation: {},
  143. keywords: "", //搜索关键字
  144. };
  145. },
  146. computed: {
  147. i18n() {
  148. return this.$t("index");
  149. },
  150. },
  151. onLoad(option) {
  152. this.follow = option.followId;
  153. },
  154. methods: {
  155. rightClick() {
  156. console.log(111);
  157. uni.switchTab({
  158. url: "/pages/mine/mine",
  159. });
  160. },
  161. //切换搜索订单状态
  162. tabSwitch(num) {
  163. this.page = 1;
  164. this.follow = num;
  165. this.getOrderList(1);
  166. },
  167. //跳转订单详情
  168. toDetail(value) {
  169. uni.navigateTo({
  170. url: `/pageC/orderFormDetail/orderFormDetail?orderId=${value.order.id}`,
  171. });
  172. },
  173. //查看物流进度
  174. toLogistics(value) {
  175. uni.navigateTo({
  176. url: `/pageD/logisticsProgress/logisticsProgress?package=${value.order_goods.length}`,
  177. });
  178. },
  179. //跳转评价
  180. toEvaluate(value) {
  181. uni.navigateTo({
  182. url: `/pageD/evaluate/evaluate?orderId=${value.order.id}`,
  183. });
  184. },
  185. //拼团中售后
  186. unreviewAfter(value) {
  187. uni.navigateTo({
  188. url: `/pageC/applicationRefund/applicationRefund?orderId=${value.id}`,
  189. });
  190. },
  191. //确认收货
  192. confirm(value) {
  193. this.agreeShow = true;
  194. this.title = "是否确认收货";
  195. this.cancellation = value;
  196. },
  197. //跳转支付
  198. toPay(value) {
  199. uni.navigateTo({
  200. url: `/pageA/payorder?sum=${value.order.amount}&orderid=${value.order.id}`,
  201. });
  202. },
  203. //再来一单 or 再次购买
  204. againOrder(item) {
  205. uni.navigateTo({
  206. url: `/pageD/newBulitOrder/newBulitOrder?orderId=${item.order.id}`,
  207. });
  208. },
  209. //删除订单
  210. deleteOrder(item) {
  211. uni.$u.http
  212. .post(`/api/order/order_del`, { order_id: item.order.id })
  213. .then((res) => {
  214. this.getOrderList(1);
  215. this.$refs.orderInformation.more();
  216. uni.showToast({
  217. title: "删除成功",
  218. icon: "none",
  219. });
  220. });
  221. },
  222. //关闭确认弹窗
  223. close(value) {
  224. this.agreeShow = false;
  225. if (value) {
  226. if (this.title == "是否确认取消订单") {
  227. uni.$u.http
  228. .post(`/api/order/cancel/${this.cancellation.order.id}`)
  229. .then((res) => {
  230. uni.showToast({
  231. title: "订单已取消",
  232. icon: "none",
  233. });
  234. this.getOrderList(1);
  235. });
  236. } else if (this.title == "是否确认收货") {
  237. uni.$u.http
  238. .post(`/api/order/receive/${this.cancellation.order.id}`)
  239. .then((res) => {
  240. uni.showToast({
  241. title: "订单已收货",
  242. icon: "none",
  243. });
  244. this.getOrderList(1);
  245. });
  246. }
  247. }
  248. },
  249. //搜索
  250. searchOrder(e) {
  251. this.keywords = e;
  252. console.log(e);
  253. this.page = 1;
  254. this.getOrderList(1);
  255. },
  256. //取消订单
  257. cancellationOrder(item) {
  258. this.agreeShow = true;
  259. this.cancellation = item;
  260. this.title = "是否确认取消订单";
  261. // uni.$u.http.post(`/api/order/cancel/${item.order.id}`).then((res) => {
  262. // console.log(res);
  263. // });
  264. },
  265. //售后订单详情
  266. toRefundDetail(value) {
  267. if (value.refund) {
  268. uni.navigateTo({
  269. url: `/pageC/refundDetail/refundDetail?orderId=${value.refund.id}`,
  270. });
  271. }
  272. },
  273. //删除售后订单
  274. deleteAfterOrder(item) {
  275. uni.$u.http
  276. .post(`api/order/refund_order_del`, {
  277. order_refund_id: item.refund.id,
  278. })
  279. .then((res) => {
  280. this.getOrderList(1);
  281. uni.showToast({
  282. title: "删除成功",
  283. icon: "none",
  284. });
  285. });
  286. },
  287. getOrderList(value) {
  288. uni.$u.http
  289. .get(
  290. `/api/order/order_list?status=${this.follow}&page=${this.page}&limit=10&keywords=${this.keywords}`
  291. )
  292. .then((res) => {
  293. //确定是触底还是点击tab栏
  294. if (value) {
  295. this.orderList = res.data;
  296. } else {
  297. if (this.orderList.length == 0) {
  298. this.orderList = res.data;
  299. } else {
  300. this.orderList = this.orderList.concat(res.data);
  301. }
  302. }
  303. this.total = res.total;
  304. });
  305. },
  306. },
  307. onShow() {
  308. this.page = 0;
  309. this.getOrderList(1);
  310. },
  311. onReachBottom() {
  312. //商品总数量小于当前获取到的商品数量
  313. if (this.total > this.orderList.length) {
  314. this.page++;
  315. this.getOrderList(0);
  316. }
  317. },
  318. mounted() {},
  319. };
  320. </script>
  321. <style lang="scss" scoped>
  322. .inp {
  323. background-color: #fff;
  324. border-radius: 40rpx;
  325. width: 402rpx;
  326. padding: 0 20rpx;
  327. height: 68rpx;
  328. }
  329. .content {
  330. padding: 0 24rpx 50rpx;
  331. }
  332. .top-tab {
  333. margin-top: 180rpx;
  334. display: flex;
  335. justify-content: space-between;
  336. overflow-y: auto;
  337. // flex-shrink: 1;
  338. width: 100vw;
  339. .tab {
  340. margin-right: 40rpx;
  341. font-size: 26rpx;
  342. color: rgba(34, 34, 34, 0.8);
  343. flex-shrink: 0;
  344. height: 44rpx;
  345. display: flex;
  346. align-items: flex-end;
  347. }
  348. .commodity {
  349. position: relative;
  350. font-weight: 600;
  351. font-size: 32rpx;
  352. }
  353. .commodity::before {
  354. content: "";
  355. display: block;
  356. height: 8rpx;
  357. width: 100%;
  358. background: linear-gradient(to right, #f83224, #fff);
  359. position: absolute;
  360. bottom: 5rpx;
  361. opacity: 0.8;
  362. }
  363. }
  364. </style>