goods.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_order = require("../api/order.js");
  4. var api_live = require("../api/live.js");
  5. require("../common/request.js");
  6. const popupBottom = () => "../components/px-popup-bottom/px-popup-bottom.js";
  7. const _sfc_main = {
  8. components: {
  9. popupBottom
  10. },
  11. data() {
  12. return {
  13. totalNum: 1,
  14. orderKey: null,
  15. type: null,
  16. liveOrderList: [],
  17. liveId: null,
  18. serviceList: ["\u514D\u90AE\u53D1\u8D27", "\u836F\u5E08\u670D\u52A1", "\u9690\u79C1\u4FDD\u62A4"],
  19. editShow: false,
  20. productId: null,
  21. goosDetail: {},
  22. loadding: true,
  23. buyText: "\u7ACB\u5373\u8D2D\u4E70",
  24. showStorePicker: false,
  25. goodsNum: 0,
  26. productValueSelect: {
  27. price: 0,
  28. serviceFee: 0
  29. },
  30. attrs: [],
  31. values: [],
  32. stores: [],
  33. storeNames: [],
  34. storeIdx: 0,
  35. storeName: "",
  36. product: {
  37. price: 0,
  38. otPrice: 0
  39. },
  40. showModal: false,
  41. activeBanner: 1,
  42. cartCount: 0,
  43. specVisible: false,
  44. specNum: 1,
  45. config: null,
  46. showServiceFee: false,
  47. selectVal: "",
  48. urlStoreId: void 0,
  49. storePriceList: [],
  50. storeSelectInfo: {},
  51. choseSpecSubIndex: 0,
  52. choseSpecIndex: 0
  53. };
  54. },
  55. onLoad(options) {
  56. if (options.productId) {
  57. this.productId = options.productId;
  58. console.log("\u63A5\u6536\u5230\u7684productId:", this.productId);
  59. }
  60. this.liveId = options.liveId;
  61. },
  62. mounted() {
  63. this.getliveGoods();
  64. var userInfo = common_vendor.index.getStorageSync("userInfo");
  65. console.log("\u4E4B\u524D\u7684\u6570\u636E\u5728\u8FD9\u91CC", userInfo);
  66. },
  67. onShow() {
  68. },
  69. methods: {
  70. getKey() {
  71. api_order.liveOrderKey().then((res) => {
  72. if (res.code == 200) {
  73. console.log("\u4E0B\u8BA2\u5355\u7684key>>>>", res);
  74. this.orderKey = res.orderKey;
  75. console.log("key>>>>", this.orderKey);
  76. common_vendor.index.navigateTo({
  77. url: "/pages_shop/confirmCreateOrder?orderKey=" + this.orderKey + "&liveId=" + this.liveId + "&productId=" + this.productId + "&totalNum=" + this.totalNum + "&price=" + this.goosDetail.price
  78. });
  79. } else {
  80. common_vendor.index.showToast({
  81. title: res.msg,
  82. icon: "none"
  83. });
  84. }
  85. }, (rej) => {
  86. });
  87. },
  88. operateOrder(type) {
  89. let orderId = this.liveOrderList;
  90. console.log("orderId>>", orderId);
  91. },
  92. goodsNumChange(e) {
  93. console.log("\u5F53\u524D\u9009\u62E9\u5546\u54C1\u6570\u91CF\u4E3A: " + e.value);
  94. this.totalNum = e.value;
  95. },
  96. submit() {
  97. this.specVisible = false;
  98. this.getKey();
  99. },
  100. addCart(type) {
  101. this.type = type;
  102. this.specVisible = true;
  103. },
  104. navgetTo(url) {
  105. console.log("\u8DF3\u8F6C");
  106. common_vendor.index.navigateTo({
  107. url
  108. });
  109. },
  110. openEditMoney() {
  111. this.editShow = true;
  112. },
  113. getliveGoods() {
  114. api_live.liveGoodsDetail(this.productId).then((res) => {
  115. if (res.code == 200) {
  116. console.log("\u5C0F\u9EC4\u8F66 \u5546\u54C1\u8BE6\u60C5>>>>", res);
  117. this.goosDetail = res.data;
  118. } else {
  119. common_vendor.index.showToast({
  120. title: res.msg,
  121. icon: "none"
  122. });
  123. }
  124. }, (rej) => {
  125. });
  126. }
  127. }
  128. };
  129. if (!Array) {
  130. const _component_uni_badge = common_vendor.resolveComponent("uni-badge");
  131. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  132. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  133. const _easycom_u_number_box2 = common_vendor.resolveComponent("u-number-box");
  134. const _component_popupBottom = common_vendor.resolveComponent("popupBottom");
  135. (_component_uni_badge + _easycom_u_icon2 + _easycom_u_popup2 + _easycom_u_number_box2 + _component_popupBottom)();
  136. }
  137. const _easycom_u_icon = () => "../uni_modules/uview-plus/components/u-icon/u-icon.js";
  138. const _easycom_u_popup = () => "../uni_modules/uview-plus/components/u-popup/u-popup.js";
  139. const _easycom_u_number_box = () => "../uni_modules/uview-plus/components/u-number-box/u-number-box.js";
  140. if (!Math) {
  141. (_easycom_u_icon + _easycom_u_popup + _easycom_u_number_box)();
  142. }
  143. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  144. var _a;
  145. return common_vendor.e({
  146. a: $data.goosDetail.imgUrl,
  147. b: $data.product.productType == 2
  148. }, $data.product.productType == 2 ? {} : {}, {
  149. c: common_vendor.t($data.goosDetail.price),
  150. d: common_vendor.t($data.goosDetail.otPrice),
  151. e: common_vendor.t($data.goosDetail.sales),
  152. f: common_vendor.f($data.serviceList, (item, index, i0) => {
  153. return {
  154. a: common_vendor.t(item),
  155. b: index
  156. };
  157. }),
  158. g: common_vendor.o(($event) => $options.openEditMoney()),
  159. h: $data.editShow
  160. }, $data.editShow ? {
  161. i: common_vendor.o(($event) => _ctx.cancelEditMoney()),
  162. j: common_vendor.o(($event) => _ctx.cancelEditMoney()),
  163. k: common_vendor.o(($event) => _ctx.cancelEditMoney())
  164. } : {}, {
  165. l: common_vendor.t(),
  166. m: common_vendor.o(($event) => $options.navgetTo("/pages_shop/store?liveId=" + $data.liveId)),
  167. n: $data.product.description,
  168. o: common_vendor.o(($event) => $options.navgetTo("./store")),
  169. p: common_vendor.p({
  170. size: "small",
  171. text: $data.cartCount,
  172. absolute: "rightTop",
  173. type: "error"
  174. }),
  175. q: common_vendor.o(($event) => $options.navgetTo("./cart")),
  176. r: common_vendor.o(($event) => $options.addCart("cart")),
  177. s: common_vendor.t($data.buyText),
  178. t: common_vendor.o(($event) => $options.addCart("buy")),
  179. v: ((_a = $data.goosDetail) == null ? void 0 : _a.imgUrl) || _ctx.$img.img,
  180. w: common_vendor.t($data.goosDetail.productName),
  181. x: common_vendor.t($data.goosDetail.price ? $data.goosDetail.price.toFixed(2) : "0.00"),
  182. y: common_vendor.t($data.goosDetail.sales),
  183. z: common_vendor.f($data.storePriceList, (item, index, i0) => {
  184. return {
  185. a: common_vendor.t(item.price.toFixed(2)),
  186. b: common_vendor.t(_ctx.utils.formatSalesNum(item.sales)),
  187. c: common_vendor.t(item.storeName),
  188. d: "14e5f6c8-3-" + i0 + ",14e5f6c8-2",
  189. e: index,
  190. f: common_vendor.n($data.productValueSelect.storeId == item.storeId ? "item hover" : "item"),
  191. g: common_vendor.o(($event) => _ctx.pickerStore(item, index), index)
  192. };
  193. }),
  194. A: common_vendor.p({
  195. name: "arrow-right",
  196. color: "#000",
  197. size: "14"
  198. }),
  199. B: common_vendor.p({
  200. show: $data.showStorePicker,
  201. round: 16,
  202. mode: "bottom"
  203. }),
  204. C: common_vendor.o($options.goodsNumChange),
  205. D: common_vendor.o(($event) => $data.goodsNum = $event),
  206. E: common_vendor.p({
  207. bgColor: "#ececec",
  208. modelValue: $data.goodsNum
  209. }),
  210. F: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
  211. G: common_vendor.sr("popup", "14e5f6c8-1"),
  212. H: common_vendor.p({
  213. visible: $data.specVisible,
  214. title: " ",
  215. radius: "32",
  216. maxHeight: "800"
  217. })
  218. });
  219. }
  220. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages_shop/goods.vue"]]);
  221. wx.createPage(MiniProgramPage);