vendor.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages-mine/common/vendor"],{
  2. /***/ 281:
  3. /*!*****************************************************!*\
  4. !*** E:/书嗨项目/book-hi/pages-mine/mixin/btnAction.js ***!
  5. \*****************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. /* WEBPACK VAR INJECTION */(function(uni) {
  10. Object.defineProperty(exports, "__esModule", {
  11. value: true
  12. });
  13. exports.default = void 0;
  14. var _default = {
  15. data: function data() {
  16. return {
  17. actionList: [],
  18. showReportSheet: false,
  19. order: {}
  20. };
  21. },
  22. onShow: function onShow() {
  23. var selectEditAddr = uni.getStorageSync('selectEditAddr');
  24. if (selectEditAddr.id) {
  25. this.handleAddressSubmit(selectEditAddr.id);
  26. }
  27. },
  28. methods: {
  29. //操作成功之后的回调
  30. successFeedback: function successFeedback() {
  31. uni.$emit('btnActionSuccess');
  32. },
  33. //修改地址
  34. handleAddressSubmit: function handleAddressSubmit(addressId) {
  35. var _this = this;
  36. var params = {
  37. orderId: this.order.orderId,
  38. addressId: addressId
  39. };
  40. uni.$u.http.post('/token/order/modifyAddress', params).then(function (res) {
  41. if (res.code === 200) {
  42. uni.showToast({
  43. title: '地址修改成功',
  44. icon: 'none'
  45. });
  46. _this.$emit('success');
  47. _this.successFeedback();
  48. uni.removeStorageSync('selectEditAddr');
  49. } else {
  50. uni.showToast({
  51. title: res.msg,
  52. icon: 'none'
  53. });
  54. }
  55. }).finally(function () {
  56. uni.removeStorageSync('selectEditAddr');
  57. uni.hideLoading();
  58. });
  59. },
  60. //根据code获取字典 /token/common/getDictOptions
  61. getDict: function getDict(code) {
  62. return uni.$u.http.get('/token/common/getDictOptions?type=' + code);
  63. },
  64. //获取一键上报的选项 code user_report_options
  65. getReportOptions: function getReportOptions() {
  66. var _this2 = this;
  67. this.getDict('user_report_options').then(function (res) {
  68. if (res.code === 200) {
  69. _this2.actionList = res.data.map(function (item) {
  70. return {
  71. text: item.dictLabel,
  72. value: item.dictValue
  73. };
  74. });
  75. }
  76. });
  77. },
  78. //一键上报相关操作
  79. handleReportSelect: function handleReportSelect(index) {
  80. var _this$actionList$inde;
  81. this.showReportSheet = false;
  82. var reason = this.actionList[index].value;
  83. if ((_this$actionList$inde = this.actionList[index]) !== null && _this$actionList$inde !== void 0 && _this$actionList$inde.isCancel) {
  84. this.submitCancel(reason);
  85. } else {
  86. this.submitReport(reason);
  87. }
  88. },
  89. submitReport: function submitReport(reason) {
  90. var _this3 = this;
  91. var params = {
  92. orderId: this.order.orderId,
  93. reason: reason
  94. };
  95. uni.$u.http.post('/token/order/userReport', params).then(function (res) {
  96. if (res.code === 200) {
  97. uni.showToast({
  98. title: '一键上报已上报给管理员',
  99. icon: 'none'
  100. });
  101. _this3.$emit('success');
  102. _this3.successFeedback();
  103. }
  104. });
  105. },
  106. //订单取消字典 order_cancel_reason_user
  107. getCancelReason: function getCancelReason() {
  108. var _this4 = this;
  109. this.getDict('order_cancel_reason_user').then(function (res) {
  110. if (res.code === 200) {
  111. _this4.actionList = res.data.map(function (item) {
  112. return {
  113. text: item.dictLabel,
  114. value: item.dictValue,
  115. isCancel: true
  116. };
  117. });
  118. }
  119. });
  120. },
  121. // 订单操作方法
  122. handleAction: function handleAction(_ref) {
  123. var type = _ref.type,
  124. order = _ref.order;
  125. console.log('handleAction', type, order);
  126. this.order = order;
  127. switch (type) {
  128. case 'submit':
  129. uni.navigateTo({
  130. url: "/pages-home/pages/book-order"
  131. });
  132. uni.setStorageSync('orderId', this.order.orderId);
  133. break;
  134. case 'editAddress':
  135. uni.navigateTo({
  136. url: "/pages-mine/pages/address/list?id=".concat(this.order.addressId, "&isSelect=1&editAddress=1")
  137. });
  138. break;
  139. case 'cancel':
  140. this.showReportSheet = true;
  141. this.getCancelReason();
  142. break;
  143. case 'report':
  144. this.showReportSheet = true;
  145. this.getReportOptions();
  146. break;
  147. case 'remindAudit':
  148. this.submitRemindAudit();
  149. break;
  150. case 'complaint':
  151. uni.navigateTo({
  152. url: "/pages-mine/pages/complaint?orderId=".concat(this.order.orderId)
  153. });
  154. break;
  155. case 'compensation':
  156. this.$emit('compensation', this.order);
  157. break;
  158. }
  159. },
  160. submitCancel: function submitCancel(reason) {
  161. var _this5 = this;
  162. var params = {
  163. orderId: this.order.orderId,
  164. reason: reason
  165. };
  166. uni.$u.http.post('/token/order/userCancel', params).then(function (res) {
  167. if (res.code === 200) {
  168. uni.showToast({
  169. title: '您的订单已取消',
  170. icon: 'none'
  171. });
  172. _this5.$emit('success');
  173. _this5.successFeedback();
  174. }
  175. });
  176. },
  177. //提醒审核
  178. submitRemindAudit: function submitRemindAudit() {
  179. uni.$u.http.post('/api/token/order/urgeOrder', {
  180. orderId: this.order.orderId
  181. }).then(function (res) {
  182. if (res.code === 200) {
  183. uni.showToast({
  184. title: '已提醒给管理员进行加急审核',
  185. icon: 'none'
  186. });
  187. } else {
  188. uni.showToast({
  189. title: res.msg,
  190. icon: 'none'
  191. });
  192. }
  193. });
  194. }
  195. }
  196. };
  197. exports.default = _default;
  198. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  199. /***/ })
  200. }]);
  201. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages-mine/common/vendor.js.map