info.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. // pages/order/admin/info/info.js
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. loading: true,
  9. isStraumann: false,
  10. checkId: null,
  11. active: false,
  12. selectIndex: 0,
  13. orderList: [],
  14. userInfo: wx.getStorageSync('userInfo')
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. async onLoad(options) {
  20. this.setData({
  21. checkId: options.checkId,
  22. isStraumann: wx.getStorageSync('isStraumann')
  23. })
  24. await this.initData();
  25. },
  26. /**
  27. * 生命周期函数--监听页面初次渲染完成
  28. */
  29. onReady() {
  30. },
  31. /**
  32. * 生命周期函数--监听页面显示
  33. */
  34. onShow() {
  35. },
  36. async initData() {
  37. let that = this;
  38. let {
  39. data
  40. } = await app.ajax.gets(`/admin/bxdordercheck/${this.data.checkId}`);
  41. let orderList =
  42. await Promise.all(data.data.map(async v => {
  43. v['check'] = await that.getCheckOrder(v.orderCheckId);
  44. v.bxdOrderItem = v.bxdOrderItem.map(v1 => {
  45. v1["picArr"] = v1.pic ? v1.pic.split(",") : [];
  46. return v1;
  47. });
  48. return v;
  49. }));
  50. this.setData({
  51. orderList: orderList,
  52. loading: false
  53. });
  54. },
  55. async getCheckOrder(orderCheckId) {
  56. let {
  57. data: check
  58. } = await app.ajax.gets(`/admin/bxdauditlog/getByCheckId/${orderCheckId}`);
  59. return check.data;
  60. },
  61. activeOrder() {
  62. this.setData({
  63. active: !this.data.active
  64. })
  65. },
  66. chooseOrder(e) {
  67. if (this.data.selectIndex == e.currentTarget.dataset.index) {
  68. return;
  69. }
  70. this.setData({
  71. active: !this.data.active
  72. })
  73. },
  74. chooseOrderItem(e) {
  75. if (this.data.selectIndex == e.currentTarget.dataset.index) {
  76. return;
  77. }
  78. this.setData({
  79. active: !this.data.active,
  80. selectIndex: e.currentTarget.dataset.index
  81. })
  82. },
  83. async approve(e) {
  84. let row = e.currentTarget.dataset.item;
  85. let data = await wx.showModal({
  86. // title: '提示',
  87. title: `确认审核通过订单吗?`,
  88. editable: true,
  89. placeholderText: "请输入审核意见",
  90. });
  91. if (data.cancel) {
  92. return;
  93. }
  94. await app.ajax.post({
  95. url: "/admin/bxdordercheck/audit",
  96. data: {
  97. checkId: this.data.orderList[0].orderCheckId,
  98. checkReason: data.content,
  99. checkStatus: 1
  100. }
  101. });
  102. wx.showToast({
  103. title: '审核通过成功',
  104. });
  105. this.setData({
  106. orderList: [],
  107. current: 0
  108. })
  109. setTimeout(async () => {
  110. wx.navigateBack({
  111. delta: 1
  112. })
  113. // await that.initData();
  114. }, 1000);
  115. },
  116. async approve2(e) {
  117. let row = e.currentTarget.dataset.item;
  118. let that = this;
  119. wx.showModal({
  120. // title: '提示',
  121. title: `确认终止订单(${this.data.orderList[0].orderCheckNumber})吗?`,
  122. editable: true,
  123. placeholderText: "请输入终止订单原因",
  124. complete: async (res) => {
  125. if (res.confirm) {
  126. if (!res.content) {
  127. wx.showToast({
  128. title: '请填写终止订单原因!',
  129. icon: "none"
  130. })
  131. return;
  132. }
  133. await app.ajax.post({
  134. url: "/admin/bxdordercheck/audit",
  135. data: {
  136. checkId: that.data.orderList[0].orderCheckId,
  137. checkReason: res.content,
  138. checkStatus: 2,
  139. }
  140. });
  141. wx.showToast({
  142. title: '中止订单成功',
  143. });
  144. that.setData({
  145. orderList: [],
  146. current: 0
  147. })
  148. setTimeout(async () => {
  149. // await that.initData();
  150. wx.navigateBack({
  151. delta: 1
  152. })
  153. }, 1000);
  154. }
  155. }
  156. })
  157. },
  158. /**
  159. * 生命周期函数--监听页面隐藏
  160. */
  161. onHide() {
  162. },
  163. /**
  164. * 生命周期函数--监听页面卸载
  165. */
  166. onUnload() {
  167. },
  168. /**
  169. * 页面相关事件处理函数--监听用户下拉动作
  170. */
  171. onPullDownRefresh() {
  172. },
  173. /**
  174. * 页面上拉触底事件的处理函数
  175. */
  176. onReachBottom() {
  177. },
  178. /**
  179. * 用户点击右上角分享
  180. */
  181. onShareAppMessage() {
  182. }
  183. })