order.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. "use strict";
  2. const common_vendor = require("../common/vendor.js");
  3. const api_order = require("../api/order.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. status: "",
  8. orderList: [],
  9. tabList: [
  10. {
  11. name: "全部",
  12. status: ""
  13. },
  14. {
  15. name: "待支付",
  16. status: "1"
  17. },
  18. {
  19. name: "待发货",
  20. status: "2"
  21. },
  22. {
  23. name: "待收货",
  24. status: "3"
  25. },
  26. {
  27. name: "待评价",
  28. status: "4"
  29. },
  30. {
  31. name: "已完成",
  32. status: "5"
  33. }
  34. ]
  35. };
  36. },
  37. mounted() {
  38. this.getliveOrderList(this.status);
  39. },
  40. methods: {
  41. // 确认收货
  42. confirmReceipt(item) {
  43. var that = this;
  44. common_vendor.index.showModal({
  45. title: "提示",
  46. content: "确认收到货了吗",
  47. success: function(res) {
  48. if (res.confirm) {
  49. var data = {
  50. orderId: item.orderId
  51. };
  52. api_order.finishOrder(data).then((res2) => {
  53. if (res2.code == 200) {
  54. common_vendor.index.showToast({
  55. icon: "success",
  56. title: "操作成功"
  57. });
  58. that.getliveOrderList(that.status);
  59. } else {
  60. common_vendor.index.showToast({
  61. icon: "none",
  62. title: res2.msg
  63. });
  64. }
  65. });
  66. } else if (res.cancel)
  67. ;
  68. }
  69. });
  70. },
  71. // 取消订单
  72. cancel(item) {
  73. var that = this;
  74. common_vendor.index.showModal({
  75. title: "提示",
  76. content: "确定取消订单吗",
  77. success: function(res) {
  78. if (res.confirm) {
  79. var data = {
  80. orderId: item.orderId
  81. };
  82. api_order.cancelOrder(data).then((res2) => {
  83. if (res2.code == 200) {
  84. common_vendor.index.showToast({
  85. icon: "success",
  86. title: "操作成功"
  87. });
  88. that.getliveOrderList(that.status);
  89. } else {
  90. common_vendor.index.showToast({
  91. icon: "none",
  92. title: res2.msg
  93. });
  94. }
  95. });
  96. } else if (res.cancel)
  97. ;
  98. }
  99. });
  100. },
  101. // 申请售后
  102. refund(item) {
  103. common_vendor.index.navigateTo({
  104. url: "./refundOrderProduct?orderId=" + item.orderId
  105. });
  106. },
  107. // tab切换
  108. tabsClick(item) {
  109. this.getliveOrderList(item.status);
  110. this.status = item.status;
  111. },
  112. // 订单列表
  113. getliveOrderList(status) {
  114. let data = {
  115. pageSize: 10,
  116. page: 1,
  117. status
  118. // 添加状态参数
  119. };
  120. api_order.liveOrderList(data).then(
  121. (res) => {
  122. if (res.code == 200) {
  123. console.log("订单列表数据>>>>", res);
  124. this.orderList = res.rows;
  125. } else {
  126. common_vendor.index.showToast({
  127. title: res.msg,
  128. icon: "none"
  129. });
  130. }
  131. },
  132. (rej) => {
  133. console.log("rej:" + JSON.stringify(rej));
  134. }
  135. );
  136. }
  137. }
  138. };
  139. if (!Array) {
  140. const _easycom_u_tabs2 = common_vendor.resolveComponent("u-tabs");
  141. _easycom_u_tabs2();
  142. }
  143. const _easycom_u_tabs = () => "../uni_modules/uview-plus/components/u-tabs/u-tabs.js";
  144. if (!Math) {
  145. _easycom_u_tabs();
  146. }
  147. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  148. return {
  149. a: common_vendor.o($options.tabsClick),
  150. b: common_vendor.p({
  151. itemStyle: "width:33%;height:100rpx;",
  152. list: $data.tabList,
  153. lineColor: "#FF5C03"
  154. }),
  155. c: common_vendor.f($data.orderList, (item, index, i0) => {
  156. return common_vendor.e({
  157. a: common_vendor.t(item.orderCode),
  158. b: item.status == -1
  159. }, item.status == -1 ? {} : item.status == -2 ? {} : item.status == 1 ? {} : item.status == 2 ? {} : item.status == 3 ? {} : item.status == 4 ? {} : item.status == 5 ? {} : item.status == -3 ? {} : {}, {
  160. c: item.status == -2,
  161. d: item.status == 1,
  162. e: item.status == 2,
  163. f: item.status == 3,
  164. g: item.status == 4,
  165. h: item.status == 5,
  166. i: item.status == -3,
  167. j: common_vendor.f(item.orderItemList, (itm, idx, i1) => {
  168. return {
  169. a: itm.imgUrl,
  170. b: common_vendor.t(itm.productName),
  171. c: common_vendor.t(itm.sales),
  172. d: common_vendor.t(itm.num),
  173. e: idx
  174. };
  175. }),
  176. k: common_vendor.t(item.totalPrice),
  177. l: item.status == 1
  178. }, item.status == 1 ? {
  179. m: common_vendor.o(($event) => $options.cancel(item), index)
  180. } : {}, {
  181. n: item.status !== 1
  182. }, item.status !== 1 ? {
  183. o: common_vendor.o(($event) => $options.refund(item), index)
  184. } : {}, {
  185. p: item.status == 1
  186. }, item.status == 1 ? {
  187. q: common_vendor.o(($event) => _ctx.pay(item), index)
  188. } : {}, {
  189. r: item.status == 2
  190. }, item.status == 2 ? {
  191. s: common_vendor.o(($event) => _ctx.urgeShipment(item), index)
  192. } : {}, {
  193. t: item.status == 3
  194. }, item.status == 3 ? {
  195. v: common_vendor.o(($event) => $options.confirmReceipt(item), index)
  196. } : {}, {
  197. w: item.status == 4
  198. }, item.status == 4 ? {
  199. x: common_vendor.o(($event) => _ctx.evaluate(item), index)
  200. } : {}, {
  201. y: index
  202. });
  203. })
  204. };
  205. }
  206. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-11bfd2e6"]]);
  207. wx.createPage(MiniProgramPage);