add.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_api_trade_order = require("../../../sheep/api/trade/order.js");
  5. require("../../../sheep/api/index.js");
  6. require("../../../sheep/api/distri/score.js");
  7. require("../../../sheep/request/index.js");
  8. require("../../../sheep/config/index.js");
  9. require("../../../sheep/store/index.js");
  10. require("../../../sheep/store/app.js");
  11. require("../../../sheep/api/promotion/diy.js");
  12. require("../../../sheep/platform/index.js");
  13. require("../../../sheep/platform/provider/wechat/index.js");
  14. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  15. require("../../../sheep/api/member/auth.js");
  16. require("../../../sheep/api/member/social.js");
  17. require("../../../sheep/api/member/user.js");
  18. require("../../../sheep/platform/provider/apple/index.js");
  19. require("../../../sheep/platform/share.js");
  20. require("../../../sheep/router/index.js");
  21. require("../../../sheep/hooks/useModal.js");
  22. require("../../../sheep/helper/index.js");
  23. require("../../../sheep/helper/test.js");
  24. require("../../../sheep/helper/digit.js");
  25. require("../../../sheep/api/member/signin.js");
  26. require("../../../sheep/helper/throttle.js");
  27. require("../../../sheep/url/index.js");
  28. require("../../../sheep/platform/pay.js");
  29. require("../../../sheep/api/pay/order.js");
  30. require("../../../sheep/store/user.js");
  31. require("../../../sheep/store/cart.js");
  32. require("../../../sheep/api/trade/cart.js");
  33. require("../../../sheep/api/pay/wallet.js");
  34. require("../../../sheep/api/promotion/coupon.js");
  35. require("../../../sheep/store/sys.js");
  36. require("../../../sheep/store/modal.js");
  37. require("../../../sheep/api/distri/share.js");
  38. require("../../../sheep/api/distri/team.js");
  39. require("../../../sheep/api/infra/file.js");
  40. require("../../../sheep/api/member/address.js");
  41. require("../../../sheep/api/member/point.js");
  42. require("../../../sheep/api/migration/app.js");
  43. require("../../../sheep/api/migration/chat.js");
  44. require("../../../sheep/api/migration/index.js");
  45. require("../../../sheep/api/migration/third.js");
  46. require("../../../sheep/api/pay/channel.js");
  47. require("../../../sheep/api/product/category.js");
  48. require("../../../sheep/api/product/comment.js");
  49. require("../../../sheep/api/product/favorite.js");
  50. require("../../../sheep/api/product/history.js");
  51. require("../../../sheep/api/product/spu.js");
  52. require("../../../sheep/api/promotion/activity.js");
  53. require("../../../sheep/api/promotion/article.js");
  54. require("../../../sheep/api/promotion/bargain.js");
  55. require("../../../sheep/api/promotion/combination.js");
  56. require("../../../sheep/api/promotion/rewardActivity.js");
  57. require("../../../sheep/api/promotion/seckill.js");
  58. require("../../../sheep/api/system/area.js");
  59. require("../../../sheep/api/system/voice.js");
  60. require("../../../sheep/api/trade/afterSale.js");
  61. require("../../../sheep/api/trade/brokerage.js");
  62. require("../../../sheep/api/trade/config.js");
  63. require("../../../sheep/api/trade/delivery.js");
  64. require("../../../sheep/config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
  67. const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
  68. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  69. const _easycom_s_uploader2 = common_vendor.resolveComponent("s-uploader");
  70. const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  71. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  72. (_easycom_s_goods_item2 + _easycom_uni_rate2 + _easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_su_fixed2 + _easycom_s_layout2)();
  73. }
  74. const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.js";
  75. const _easycom_uni_rate = () => "../../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
  76. const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  77. const _easycom_s_uploader = () => "../../../sheep/components/s-uploader/s-uploader.js";
  78. const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
  79. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  80. if (!Math) {
  81. (_easycom_s_goods_item + _easycom_uni_rate + _easycom_uni_easyinput + _easycom_s_uploader + _easycom_su_fixed + _easycom_s_layout)();
  82. }
  83. const _sfc_main = {
  84. __name: "add",
  85. setup(__props) {
  86. const state = common_vendor.reactive({
  87. orderInfo: {},
  88. commentList: [],
  89. id: null
  90. });
  91. async function onSubmit() {
  92. common_vendor.index.showModal({
  93. title: "提示",
  94. content: "是否评论?",
  95. success: async function(res) {
  96. if (!res.confirm) {
  97. return;
  98. }
  99. for (const comment of state.commentList) {
  100. await sheep_api_trade_order.OrderApi.createOrderItemComment(comment);
  101. }
  102. sheep_index.sheep.$router.back();
  103. }
  104. });
  105. }
  106. common_vendor.onLoad(async (options) => {
  107. if (!options.id) {
  108. sheep_index.sheep.$helper.toast(`缺少订单信息,请检查`);
  109. return;
  110. }
  111. state.id = options.id;
  112. const {
  113. code,
  114. data
  115. } = await sheep_api_trade_order.OrderApi.getOrder(state.id);
  116. if (code !== 0) {
  117. sheep_index.sheep.$helper.toast("无待评价订单");
  118. return;
  119. }
  120. data.items.forEach((item) => {
  121. state.commentList.push({
  122. anonymous: false,
  123. orderItemId: item.id,
  124. descriptionScores: 5,
  125. benefitScores: 5,
  126. content: "",
  127. picUrls: []
  128. });
  129. });
  130. state.orderInfo = data;
  131. });
  132. return (_ctx, _cache) => {
  133. return {
  134. a: common_vendor.f(state.orderInfo.items, (item, index, i0) => {
  135. return {
  136. a: "c66153cb-1-" + i0 + ",c66153cb-0",
  137. b: common_vendor.p({
  138. img: item.picUrl,
  139. title: item.spuName,
  140. skuText: item.properties.map((property) => property.valueName).join(" "),
  141. price: item.payPrice,
  142. num: item.count
  143. }),
  144. c: "c66153cb-2-" + i0 + ",c66153cb-0",
  145. d: common_vendor.o(($event) => state.commentList[index].descriptionScores = $event, item.id),
  146. e: common_vendor.p({
  147. modelValue: state.commentList[index].descriptionScores
  148. }),
  149. f: "c66153cb-3-" + i0 + ",c66153cb-0",
  150. g: common_vendor.o(($event) => state.commentList[index].benefitScores = $event, item.id),
  151. h: common_vendor.p({
  152. modelValue: state.commentList[index].benefitScores
  153. }),
  154. i: "c66153cb-4-" + i0 + ",c66153cb-0",
  155. j: common_vendor.o(($event) => state.commentList[index].content = $event, item.id),
  156. k: common_vendor.p({
  157. inputBorder: false,
  158. type: "textarea",
  159. maxlength: "120",
  160. autoHeight: true,
  161. placeholder: "宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~",
  162. modelValue: state.commentList[index].content
  163. }),
  164. l: "c66153cb-5-" + i0 + ",c66153cb-0",
  165. m: common_vendor.o(($event) => state.commentList[index].picUrls = $event, item.id),
  166. n: common_vendor.p({
  167. fileMediatype: "image",
  168. limit: "9",
  169. mode: "grid",
  170. imageStyles: {
  171. width: "168rpx",
  172. height: "168rpx"
  173. },
  174. url: state.commentList[index].picUrls
  175. }),
  176. o: item.id
  177. };
  178. }),
  179. b: common_vendor.o(onSubmit),
  180. c: common_vendor.p({
  181. bottom: true,
  182. placeholder: true
  183. }),
  184. d: common_vendor.p({
  185. title: "评价"
  186. })
  187. };
  188. };
  189. }
  190. };
  191. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c66153cb"], ["__file", "D:/zx/mall-front-app/pages/goods/comment/add.vue"]]);
  192. wx.createPage(MiniProgramPage);