123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_coupon = require("../api/coupon.js");
- require("../common/request.js");
- const _sfc_main = {
- name: "getCoupon",
- props: {},
- data: function() {
- return {
- couponId: null,
- item: null,
- isShare: null,
- code: null
- };
- },
- onLoad(options) {
- this.couponId = options.couponId;
- this.code = options.code;
- if (!this.$isEmpty(options.isShare)) {
- this.isShare = options.isShare;
- this.genCode();
- } else {
- common_vendor.index.hideShareMenu();
- }
- console.log(options.couponId);
- this.companyId = common_vendor.index.getStorageSync("companyId");
- this.companyUserId = common_vendor.index.getStorageSync("companyUserId");
- this.getCouponById();
- },
- onShareAppMessage(res) {
- common_vendor.index.showShareMenu({
- withShareTicket: true
- });
- wx.updateShareMenu({
- isPrivateMessage: true,
- withShareTicket: true,
- success(res2) {
- console.log("updateShareMenu: ", res2);
- },
- fail() {
- }
- });
- return {
- title: this.item.title,
- path: "/pages_company/couponDetails?couponId=" + this.item.couponId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId + "&code=" + this.code
- };
- },
- mounted: function() {
- },
- onShow() {
- },
- methods: {
- genCode: function() {
- let that = this;
- var data = { couponId: this.couponId };
- api_coupon.genCode(data).then(function(res) {
- that.code = res.data;
- }).catch(function(err) {
- });
- },
- getCouponById: function() {
- let that = this;
- var data = {
- couponId: this.couponId
- };
- api_coupon.getCouponById(data).then(function(res) {
- that.item = res.data;
- }).catch(function(err) {
- common_vendor.index.showToast({
- title: err.msg,
- icon: "none",
- duration: 2e3
- });
- });
- },
- receive: function() {
- var data = {
- couponId: this.item.couponId,
- companyId: this.companyId,
- companyUserId: this.companyUserId,
- code: this.code
- };
- api_coupon.receive(data).then(function(res) {
- if (res.code == 200) {
- common_vendor.index.showToast({
- title: "\u9886\u53D6\u6210\u529F",
- icon: "success",
- duration: 2e3
- });
- } else {
- common_vendor.index.showToast({
- title: res.msg,
- duration: 2e3
- });
- }
- }).catch(function(err) {
- common_vendor.index.showToast({
- title: err.msg,
- icon: "none",
- duration: 2e3
- });
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: _ctx.item != null
- }, _ctx.item != null ? common_vendor.e({
- b: common_vendor.t(_ctx.item.price.toFixed(2)),
- c: common_vendor.t(_ctx.item.minPrice.toFixed(2)),
- d: common_vendor.t(_ctx.item.title),
- e: common_vendor.t(_ctx.item.limitTime),
- f: _ctx.item.remainNumber > 0
- }, _ctx.item.remainNumber > 0 ? {
- g: common_vendor.o(($event) => $options.receive())
- } : _ctx.item.remainNumber == 0 ? {} : {}, {
- h: _ctx.item.remainNumber == 0
- }) : {});
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-660e495e"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_company/couponDetails.vue"]]);
- _sfc_main.__runtimeHooks = 2;
- wx.createPage(MiniProgramPage);
|