vendor.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 _this5 = this;
  124. var type = _ref.type,
  125. order = _ref.order;
  126. console.log("handleAction", type, order);
  127. this.order = order;
  128. switch (type) {
  129. case "submit":
  130. uni.navigateTo({
  131. url: "/pages-home/pages/book-order"
  132. });
  133. uni.setStorageSync("orderId", this.order.orderId);
  134. break;
  135. case "editAddress":
  136. uni.navigateTo({
  137. url: "/pages-mine/pages/address/list?id=".concat(this.order.addressId, "&isSelect=1&editAddress=1")
  138. });
  139. break;
  140. case "cancel":
  141. uni.showModal({
  142. title: "提示",
  143. content: "确定取消订单吗?",
  144. success: function success(res) {
  145. if (res.confirm) {
  146. _this5.showReportSheet = true;
  147. _this5.getCancelReason();
  148. }
  149. }
  150. });
  151. break;
  152. case "report":
  153. this.showReportSheet = true;
  154. this.getReportOptions();
  155. break;
  156. case "remindAudit":
  157. this.submitRemindAudit();
  158. break;
  159. case "complaint":
  160. uni.navigateTo({
  161. url: "/pages-mine/pages/complaint?orderId=".concat(this.order.orderId)
  162. });
  163. break;
  164. case "compensation":
  165. this.$emit("compensation", this.order);
  166. break;
  167. }
  168. },
  169. submitCancel: function submitCancel(reason) {
  170. var _this6 = this;
  171. var params = {
  172. orderId: this.order.orderId,
  173. reason: reason
  174. };
  175. uni.$u.http.post("/token/order/userCancel", params).then(function (res) {
  176. if (res.code === 200) {
  177. uni.showToast({
  178. title: "您的订单已取消",
  179. icon: "none"
  180. });
  181. _this6.$emit("success");
  182. _this6.successFeedback();
  183. }
  184. });
  185. },
  186. //提醒审核
  187. submitRemindAudit: function submitRemindAudit() {
  188. uni.$u.http.post("/api/token/order/urgeOrder", {
  189. orderId: this.order.orderId
  190. }).then(function (res) {
  191. if (res.code === 200) {
  192. uni.showToast({
  193. title: "已提醒给管理员进行加急审核",
  194. icon: "none"
  195. });
  196. } else {
  197. uni.showToast({
  198. title: res.msg,
  199. icon: "none"
  200. });
  201. }
  202. });
  203. }
  204. }
  205. };
  206. exports.default = _default;
  207. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  208. /***/ })
  209. }]);
  210. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages-mine/common/vendor.js.map