list.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. // pages/order/user/list/list.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. statusUserList: [{
  9. id: '',
  10. name: "全部"
  11. }, {
  12. id: 0,
  13. name: "待审核"
  14. },
  15. {
  16. id: 1,
  17. name: "已审核"
  18. },
  19. {
  20. id: 2,
  21. name: "审核终止"
  22. },
  23. {
  24. id: 3,
  25. name: "已发货"
  26. },
  27. {
  28. id: 4,
  29. name: "已签收"
  30. },
  31. {
  32. id: 5,
  33. name: "已取消"
  34. },
  35. ],
  36. statusAdminList: [{
  37. id: '',
  38. name: "全部"
  39. }, {
  40. id: 0,
  41. name: "待审核"
  42. },
  43. {
  44. id: 1,
  45. name: "审核通过"
  46. },
  47. {
  48. id: 2,
  49. name: "已终止"
  50. },
  51. {
  52. id: 3,
  53. name: "超时自动取消"
  54. },
  55. {
  56. id: 4,
  57. name: "人工取消"
  58. }
  59. ],
  60. queryList: [{
  61. column: "orderNumber",
  62. name: "订单编号",
  63. text: "请输入订单编号"
  64. },
  65. {
  66. column: "dvyFlowId",
  67. name: "快递单号",
  68. text: "请输入快递单号"
  69. },
  70. {
  71. column: "prodName",
  72. name: "商品名称",
  73. text: "请输入商品名称"
  74. },
  75. {
  76. column: "createTime",
  77. name: "下单时间",
  78. text: "开始日期 - 结束日期",
  79. type: 1
  80. },
  81. ],
  82. valueText: "",
  83. queryIndex: 3,
  84. queryShow: false,
  85. skuCode: "", //商品编码SKU
  86. status: 0, //订单状态
  87. orderNumber: "", //订单编号
  88. dvyFlowId: "", //快递单号
  89. prodName: "", //商品名称
  90. createTimeEnd: "",
  91. createTimeStart: "",
  92. current: 0,
  93. orderList: [],
  94. current: 0,
  95. pages: null,
  96. loading: true,
  97. pageHide: false
  98. },
  99. /**
  100. * 生命周期函数--监听页面加载
  101. */
  102. onLoad(options) {
  103. this.setData({
  104. status: options.status != '' && options.status != null && options.status != undefined ? Number(options.status) + 1 : 0
  105. })
  106. },
  107. /**
  108. * 生命周期函数--监听页面初次渲染完成
  109. */
  110. onReady() {
  111. },
  112. /**
  113. * 生命周期函数--监听页面显示
  114. */
  115. async onShow() {
  116. // if (this.data.pageHide) {
  117. // return;
  118. // }
  119. this.setData({
  120. current: 0,
  121. orderList: [],
  122. pages: null
  123. });
  124. if (!wx.getStorageSync('userInfo')) {
  125. return;
  126. }
  127. await this.initData();
  128. this.setData({
  129. loading: false
  130. })
  131. },
  132. async initData(d) {
  133. let userInfo = wx.getStorageSync('userInfo');
  134. this.setData({
  135. current: this.data.current + 1,
  136. loadding: true
  137. });
  138. let {
  139. data
  140. } = await app.ajax.get({
  141. url: `/admin/bxdorder/queryPage`,
  142. data: {
  143. orderSaleId: wx.getStorageSync('userInfo').roleType === "0" ? '' : userInfo.userId,
  144. status: this.data.statusUserList[this.data.status].id,
  145. orderNumber: this.data.orderNumber,
  146. createTimeEnd: this.data.createTimeEnd ? this.data.createTimeEnd + ' 23:59:59' : '',
  147. createTimeStart: this.data.createTimeStart ? this.data.createTimeStart + ' 00:00:00' : '',
  148. dvyFlowId: this.data.dvyFlowId,
  149. current: d && d.current != undefined ? d.current : this.data.current,
  150. size: 20,
  151. }
  152. });
  153. this.setData({
  154. current: this.data.current,
  155. orderList: this.data.orderList.concat(data.data.records),
  156. pages: data.data.pages || null,
  157. loadding: false
  158. })
  159. // admin/bxdorder/query?activityImgs=&companyId=56&companyName=HZRCS&createTime=&current=1&desc=create_time&mobile=&orderorderNumber=&orderNumber=&orderSaleName&receiverName=&size=10&status=
  160. },
  161. async queryData(e) {
  162. this.setData({
  163. orderList: [],
  164. status: 0
  165. })
  166. await this.initData({
  167. current: 0
  168. });
  169. },
  170. chooseQuery(e) {
  171. //console.log(e)
  172. if (this.data.queryIndex == e.currentTarget.dataset.index) {
  173. return;
  174. }
  175. if (e.currentTarget.dataset.index != undefined) {
  176. this.setData({
  177. orderNumber: "", //订单编号
  178. dvyFlowId: "", //快递单号
  179. prodName: "", //商品名称
  180. createTimeEnd: "",
  181. createTimeStart: "",
  182. valueText: "",
  183. })
  184. }
  185. this.setData({
  186. queryShow: !this.data.queryShow
  187. })
  188. },
  189. chooseQueryItem(e) {
  190. if (this.data.queryIndex == e.currentTarget.dataset.index) {
  191. return;
  192. }
  193. this.setData({
  194. orderNumber: "", //订单编号
  195. dvyFlowId: "", //快递单号
  196. prodName: "", //商品名称
  197. createTimeEnd: "",
  198. createTimeStart: "",
  199. valueText: "",
  200. })
  201. this.setData({
  202. queryShow: !this.data.queryShow,
  203. queryIndex: e.currentTarget.dataset.index
  204. })
  205. },
  206. async changeTabbar(e, a) {
  207. if (this.data.status == e.detail.index) {
  208. return;
  209. }
  210. this.setData({
  211. orderList: [],
  212. current: 0,
  213. status: e.detail.index
  214. })
  215. await this.initData(0);
  216. },
  217. bindinputchange(e) {
  218. this.setData({
  219. valueText: e.detail.value,
  220. [e.currentTarget.dataset.name]: e.detail.value
  221. })
  222. },
  223. bindchange1(e) {
  224. this.setData({
  225. createTimeEnd: e.detail.value
  226. })
  227. },
  228. bindchange2(e) {
  229. this.setData({
  230. createTimeStart: e.detail.value
  231. })
  232. },
  233. cleanDate(e) {
  234. this.setData({
  235. orderNumber: "", //订单编号
  236. dvyFlowId: "", //快递单号
  237. prodName: "", //商品名称
  238. createTimeEnd: "",
  239. createTimeStart: "",
  240. valueText: "",
  241. })
  242. },
  243. async approve(e) {
  244. let row = e.currentTarget.dataset.item;
  245. let that = this;
  246. wx.showModal({
  247. // title: '提示',
  248. title: `确认取消订单${row.orderNumber}吗?`,
  249. editable: true,
  250. placeholderText: "请输入取消订单原因",
  251. complete: async (res) => {
  252. if (res.confirm) {
  253. if (!res.content) {
  254. wx.showToast({
  255. title: '请填写取消订单原因!',
  256. icon: "none"
  257. })
  258. return;
  259. }
  260. await app.ajax.post({
  261. url: "/admin/bxdorder/cancel",
  262. data: {
  263. orderId: row.orderId,
  264. cancelReason: res.content,
  265. }
  266. });
  267. setTimeout(async () => {
  268. wx.showToast({
  269. title: '取消订单成功!',
  270. });
  271. }, 200);
  272. that.setData({
  273. orderList: [],
  274. current: 0,
  275. pages: null
  276. })
  277. await that.initData();
  278. }
  279. }
  280. })
  281. },
  282. copyText(e) {
  283. wx.setClipboardData({
  284. data: e.currentTarget.dataset.ordernumber,
  285. });
  286. },
  287. goWuliu(e) {
  288. let item = e.currentTarget.dataset.item;
  289. wx.navigateTo({
  290. url: `/pages/order/logistics/logistics?dvyFlowId=${item.dvyFlowId}&logisticsCode=${item.logisticsCode}&mobile=${item.mobile}`,
  291. })
  292. },
  293. /**
  294. * 生命周期函数--监听页面隐藏
  295. */
  296. onHide() {
  297. this.setData({
  298. pageHide: true
  299. })
  300. },
  301. /**
  302. * 生命周期函数--监听页面卸载
  303. */
  304. onUnload() {
  305. this.setData({
  306. pageHide: false
  307. })
  308. },
  309. /**
  310. * 页面相关事件处理函数--监听用户下拉动作
  311. */
  312. onPullDownRefresh() {
  313. },
  314. /**
  315. * 页面上拉触底事件的处理函数
  316. */
  317. onReachBottom() {
  318. },
  319. /**
  320. * 用户点击右上角分享
  321. */
  322. onShareAppMessage() {
  323. }
  324. })