You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
8.5 KiB

1 week ago
const app = getApp<IAppOption>();
Page({
data: {
id: "",
detail: {},
specVecItem: {} as any,
num: 1,
allPrice: "",
toastShow: false,
toastType: "giftEnter",
toastParams: {
doc: "",
},
protocol: false,
},
onLoad(options) {
this.setData({
id: options.id,
toastParams: {
doc: `<p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">为让用户更好的享受再鼎gMG给力加油站的服务,gMG给力加油站平台向用户提供了能量兑换服务,并提供了丰富的礼品,平台注册用户可使用有效的能量兑换礼品。</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">gMG给力加油站的礼品库将提供:</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">1) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">查看用户在能量商城选择兑换的商品信息;</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">2) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">确认兑换商品的订单信息;</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">3) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">实施兑换商品的物流配送服务。</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">基于以上服务内容,我们在此特别声明:</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">gMG给力加油站非常重视用户个人信息保护,我们制定了详细的<a style="color:#00A4ED" href="/pages/privacyAgreement/index?page=/gift/pages/giftDetail/index&id=${options.id}">《知情同意书》</a></span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">,我们将按照公示的政策及相关法律法规的要求,对您的个人信息予以保护。为了完整的向您提供能量的商品兑换服务,gMG给力加油站将需要您提供用户真实姓名、手机号、地址信息,以便完成您所兑换商品的物流配送。其中,当用户准备对兑换商品进行结算时,平台会生成兑换该商品的订单,同时该订单中会载明订单号、所兑换的商品或服务信息、应支付的能量值。以上所有信息构成用户的“订单信息”,平台将使用订单信息来进行用户的身份核验、确定交易、支付结算、完成配送。</span></p><p style="text-indent: 24pt; line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">用户点击本协议的"同意"按钮即视为完全接受以上声明条款,在点击之前请用户再次确认已知悉并完全理解声明的全部内容。</span></p>`,
// doc:` <p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">为让用户更好的享受再鼎gMG给力加油站的服务,gMG给力加油站平台向用户提供了能量兑换服务,并提供了丰富的礼品,平台注册用户可使用有效的能量兑换礼品。</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">gMG给力加油站的礼品库将提供:</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">1) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">查看用户在能量商城选择兑换的商品信息;</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">2) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">确认兑换商品的订单信息;</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 微软雅黑;">3) </span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">实施兑换商品的物流配送服务。</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">基于以上服务内容,我们在此特别声明:</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">gMG给力加油站非常重视用户个人信息保护,我们制定了详细的<a style="color:#00A4ED" href="/pages/privacyAgreement/index?page=/gift/pages/giftDetail/index&id=${options.id}">《知情同意书》</a></span><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">,我们将按照公示的政策及相关法律法规的要求,对您的个人信息予以保护。为了完整的向您提供能量的商品兑换服务,gMG给力加油站将需要您提供用户真实姓名、手机号、地址信息,以便完成您所兑换商品的物流配送。其中,当用户准备对兑换商品进行结算时,平台会生成兑换该商品的订单,同时该订单中会载明订单号、所兑换的商品或服务信息、应支付的能量值。以上所有信息构成用户的“订单信息”,平台将使用订单信息来进行用户的身份核验、确定交易、支付结算、完成配送。</span></p><p style="line-height: 1.5;"><span style="color: rgb(89, 89, 89); font-size: 14px; font-family: 宋体;">用户点击本协议的"同意"按钮即视为完全接受以上声明条款,在点击之前请用户再次确认已知悉并完全理解声明的全部内容。</span></p>`
},
});
app.waitLogin().then(() => {
this.setView();
this.getDetail();
this.getProtocol();
});
},
setView() {
wx.ajax({
method: "POST",
3 days ago
url: "?r=igg4/gift-spu/set-visit-num",
1 week ago
data: { spuId: this.data.id },
showMsg: false,
});
},
getDetail() {
wx.ajax({
method: "GET",
3 days ago
url: "?r=igg4/gift-spu/get-detail",
1 week ago
data: {
spuId: this.data.id,
},
}).then((res) => {
this.setData({
detail: {
...res,
detailList: JSON.parse(res.detail),
},
specVecItem: res.specVec[0],
allPrice: res.specVec[0].score,
num: res.specVec[0].stock >= 1 ? 1 : 0,
});
});
},
getProtocol() {
wx.ajax({
method: "GET",
3 days ago
url: "?r=igg4/agreement/get-user-agreement",
1 week ago
data: {},
}).then((res) => {
this.setData({
protocol: res,
});
});
},
setProtocol() {
wx.ajax({
method: "POST",
3 days ago
url: "?r=igg4/agreement/set-user-agreement",
1 week ago
data: {},
});
},
handleSpec(e: any) {
const { index } = e.currentTarget.dataset;
const specVecItem: any = this.data.detail.specVec[index];
console.log(specVecItem.stock>=1)
this.setData({
specVecItem: specVecItem,
allPrice: specVecItem.score,
num: specVecItem.stock >= 1 ? 1 : 0,
});
},
onChangeNumber(e: any) {
this.setData({
num: e.detail,
allPrice: this.data.specVecItem.score * e.detail,
});
},
handleDoc() {
this.setData({
toastShow: true,
toastType: "giftEnter",
});
},
handleToastOk(e) {
if (!e.detail.protocol) {
wx.showToast({
title: "请先勾选《用户须知》",
icon: "none",
});
return;
}
this.setProtocol();
this.setData({
protocol: e.detail.protocol,
});
this.handleToastCancel();
},
handleToastCancel() {
this.setData({
toastShow: false,
toastType: "",
});
},
handleProtocol() {
if (!this.data.protocol) {
this.setProtocol();
}
this.setData({
protocol: !this.data.protocol,
});
},
handleSubmit() {
if (!this.data.protocol) {
wx.showToast({
icon: "none",
title: "请先同意《用户须知》",
});
return;
}
wx.ajax({
method: "POST",
3 days ago
url: "?r=igg4/gift-order/place-order",
1 week ago
data: {
giftId: this.data.specVecItem.giftId,
count: this.data.num,
},
loading: true,
}).then((res) => {
wx.navigateTo({
url: `/gift/pages/conformOrder/index?id=${res}`,
});
});
},
});