Commit 065dc74b by 谢中龙

修改订单相关

parent d167bd8b
...@@ -91,8 +91,8 @@ App({ ...@@ -91,8 +91,8 @@ App({
const { member } = baseUserInfo const { member } = baseUserInfo
const curMemberTrial = member && member.trial || false const curMemberTrial = member && member.trial || false
wx.setStorageSync('isExperiencer', curMemberTrial) wx.setStorageSync('isExperiencer', curMemberTrial)
// console.log('调用微信开卡组件回调参数---', options)
if (options.referrerInfo && options.referrerInfo.extraData!=null){ if (options.referrerInfo && options.referrerInfo.extraData != null && options.referrerInfo.extraData != undefined){
const { activate_ticket, card_id, code, errCode, wx_activate_after_submit_url } = options.referrerInfo.extraData const { activate_ticket, card_id, code, errCode, wx_activate_after_submit_url } = options.referrerInfo.extraData
let urlData = wx_activate_after_submit_url.split("?"); let urlData = wx_activate_after_submit_url.split("?");
let url = urlData[0]; let url = urlData[0];
......
...@@ -179,6 +179,22 @@ Component({ ...@@ -179,6 +179,22 @@ Component({
} }
} }
if (this.data.skuStock == 0){
wx.showToast({
title: '您所选择的商品规格库存不足,请选择其他规格',
icon : 'none'
})
return ;
}
if (this.data.skuStock < this.data.proNum){
wx.showToast({
title: '您所选择的商品规格库存不足,请选择其他规格',
icon: 'none'
})
return;
}
this.triggerEvent('skuselect', { this.triggerEvent('skuselect', {
skuId: this.data.skuId, skuId: this.data.skuId,
count: this.data.proNum, count: this.data.proNum,
......
...@@ -62,7 +62,7 @@ const needMock = '' // ...@@ -62,7 +62,7 @@ const needMock = '' //
* appId = wxf7bc302c51166dc0 //小程序 appId * appId = wxf7bc302c51166dc0 //小程序 appId
* tunnel-token = //token 杨辰提供 * tunnel-token = //token 杨辰提供
* brandId= 2007 //商户Id * brandId= 2007 //商户Id
* contactUspluginId = 联系我插件id * contactUspluginId = 64bf88d82b3f0d506bd00ed90d5706f1 联系我插件id
*/ */
......
...@@ -29,10 +29,13 @@ wxService.page({ ...@@ -29,10 +29,13 @@ wxService.page({
this.handleGoActivateCard(this.options) this.handleGoActivateCard(this.options)
}, },
handleGoActivateCard(options={}) { handleGoActivateCard(options={}) {
if(!options) { console.log('options------------', options)
if (Object.keys(options).length == 0){
this.goUserCenter() this.goUserCenter()
return false return false
} }
options.activate_ticket = decodeURIComponent(options.activate_ticket) options.activate_ticket = decodeURIComponent(options.activate_ticket)
// 解析 url 参数 {} // 解析 url 参数 {}
const parmasSubmitUrl = utils.parseUrl(options.wx_activate_after_submit_url) const parmasSubmitUrl = utils.parseUrl(options.wx_activate_after_submit_url)
......
...@@ -253,7 +253,10 @@ wxService.page({ ...@@ -253,7 +253,10 @@ wxService.page({
title: `修改成功`, title: `修改成功`,
icon: 'none' icon: 'none'
}) })
wxService.router(`/pages/myAddress/myAddress`)
wx.navigateBack({
delta : 1
})
} }
}).finally(() => { }).finally(() => {
wx.hideLoading() wx.hideLoading()
...@@ -267,7 +270,9 @@ wxService.page({ ...@@ -267,7 +270,9 @@ wxService.page({
title: `保存成功`, title: `保存成功`,
icon: 'none' icon: 'none'
}) })
wxService.router(`/pages/myAddress/myAddress`) wx.navigateBack({
delta: 1
})
} }
}).finally(() => { }).finally(() => {
wx.hideLoading() wx.hideLoading()
......
...@@ -47,47 +47,21 @@ wxService.page({ ...@@ -47,47 +47,21 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
console.log('dddd', app.globalData.isPlusVip)
let pages = getCurrentPages(); let pages = getCurrentPages();
let currPage = pages[pages.length - 1]; let currPage = pages[pages.length - 1];
const { trolleySku2Buy } = this.options;
const { trolleySku2Buy } = this.options
let tradeDto = { let tradeDto = {
trolleySku2Buy: JSON.parse(trolleySku2Buy) trolleySku2Buy: JSON.parse(trolleySku2Buy)
} }
// 下单 && 计算优惠价 // 下单 && 计算优惠价
this.setData({ this.setData({
trolleySku2Buy: tradeDto.trolleySku2Buy trolleySku2Buy: tradeDto.trolleySku2Buy
}, () => { }, () => {
this.initCitys() this.initCitys()
// 地址列表 // 地址列表
this.getAddressList() this.getAddressList()
});
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
let params = {
checkByPremium,
trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
}
this.calPreferentialPrice(params) // 计算优惠价
// if (!this.data.wxAddress){
// this.getAddressList()
// }
})
// this.initCitys()
// // 地址列表
// this.getAddressList()
// // if (!this.data.wxAddress){
// // this.getAddressList()
// // }
}, },
// select 传过来 // select 传过来
updateCoupon(e) { updateCoupon(e) {
...@@ -106,8 +80,7 @@ wxService.page({ ...@@ -106,8 +80,7 @@ wxService.page({
const { orderPrice } = this.data const { orderPrice } = this.data
// couponId---id couponSettingId --sid // couponId---id couponSettingId --sid
let finCouponId = id ? id : sid let finCouponId = id ? id : sid
let finCouponName = id ? 'couponId' : 'couponSettingId' let finCouponName = id ? 'couponId' : 'couponSettingId';
console.log('sele', finCouponName, finCouponId)
if (type == 1) { if (type == 1) {
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
...@@ -179,6 +152,7 @@ console.log('sele', finCouponName, finCouponId) ...@@ -179,6 +152,7 @@ console.log('sele', finCouponName, finCouponId)
}) })
return false; return false;
} }
const { memberId } = wx.getStorageSync('_baseUserInfo') const { memberId } = wx.getStorageSync('_baseUserInfo')
this.setData({ this.setData({
params: { params: {
...@@ -191,10 +165,11 @@ console.log('sele', finCouponName, finCouponId) ...@@ -191,10 +165,11 @@ console.log('sele', finCouponName, finCouponId)
address: e.detail.value.address, address: e.detail.value.address,
type: this.data.isSelect ? 1 : 0 type: this.data.isSelect ? 1 : 0
} }
}) });
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) });
wxService.post(`/member/addressManage/save`, this.data.params).then(res => { wxService.post(`/member/addressManage/save`, this.data.params).then(res => {
const { result } = res.data const { result } = res.data
...@@ -203,7 +178,14 @@ console.log('sele', finCouponName, finCouponId) ...@@ -203,7 +178,14 @@ console.log('sele', finCouponName, finCouponId)
wx.showToast({ wx.showToast({
title: `保存成功`, title: `保存成功`,
icon: 'none' icon: 'none'
}) });
this.data.addressId = res.data.data;
this.setData({
addressId: this.data.addressId
});
// 调起支付 // 调起支付
this.handelGobuy() this.handelGobuy()
} }
...@@ -300,7 +282,6 @@ console.log('sele', finCouponName, finCouponId) ...@@ -300,7 +282,6 @@ console.log('sele', finCouponName, finCouponId)
isSelect: !this.data.isSelect isSelect: !this.data.isSelect
}, () => { }, () => {
const { isSelect } = this.data const { isSelect } = this.data
console.log('isSelect', isSelect)
this.setData({ this.setData({
checkByPremium: isSelect, checkByPremium: isSelect,
defalutCoupon: 0, defalutCoupon: 0,
...@@ -345,11 +326,10 @@ console.log('sele', finCouponName, finCouponId) ...@@ -345,11 +326,10 @@ console.log('sele', finCouponName, finCouponId)
}, },
// 默认地址 // 默认地址
selectAddress() { selectAddress() {
wxService.router('/pages/myAddress/myAddress') wxService.router('/pages/myAddress/myAddress?isFrom=order')
}, },
// 计算优惠价 // 计算优惠价
calPreferentialPrice(params) { calPreferentialPrice(params) {
console.log('params', params)
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
...@@ -381,9 +361,18 @@ console.log('sele', finCouponName, finCouponId) ...@@ -381,9 +361,18 @@ console.log('sele', finCouponName, finCouponId)
// id / couponSettingId // id / couponSettingId
this.setData({ this.setData({
currentOrderList: data, currentOrderList: data,
defalutCoupon: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ? data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponSettingDTO.faceAmount / 100 : data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDiscount, defalutCoupon: data && data.couponDiscountPreviews.length &&
defalutCouponId: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] && data.couponDiscountPreviews[0].couponDTOS[0].id || '', data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ?
couponSettingId: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] && data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '', data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.faceAmount / 100 : data &&
data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] &&
data.couponDiscountPreviews[0].couponDiscount,
defalutCouponId: data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].id || '',
couponSettingId: data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '',
orderInitPrice: data.amount orderInitPrice: data.amount
}, () => { }, () => {
// 实付款 // 实付款
...@@ -395,8 +384,16 @@ console.log('sele', finCouponName, finCouponId) ...@@ -395,8 +384,16 @@ console.log('sele', finCouponName, finCouponId)
}, },
handelGobuy() { handelGobuy() {
// 第一项 defalutCouponId couponId/ // 第一项 defalutCouponId couponId/
const { isSelect, defalutCoupon,trolleySku2Buy, couponId, couponSettingId, addressId, addressInfo, defalutCouponId } = this.data const {
// let NoPlusCouponId = couponId ? couponId : defalutCouponId // couponId / 第一项 id isSelect,
defalutCoupon,
trolleySku2Buy,
couponId,
couponSettingId,
addressId,
addressInfo,
defalutCouponId
} = this.data;
let finCouponName,finCouponId let finCouponName,finCouponId
if(!defalutCoupon) { if(!defalutCoupon) {
...@@ -422,7 +419,16 @@ console.log('sele', finCouponName, finCouponId) ...@@ -422,7 +419,16 @@ console.log('sele', finCouponName, finCouponId)
trolleySku2Buy, trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
} }
console.log('params', params)
//判断addressId是不是有
if (!params.addressId){
wx.showToast({
title: '请添加地址或选择地址',
icon : 'none'
})
return ;
}
this.getBill(params) // 下单 this.getBill(params) // 下单
}, },
// 下单 // 下单
...@@ -437,18 +443,21 @@ console.log('sele', finCouponName, finCouponId) ...@@ -437,18 +443,21 @@ console.log('sele', finCouponName, finCouponId)
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
delete data.appId delete data.appId
console.log('dddd', data.amount)
let amount = data.amount || 0 let amount = data.amount || 0
wx.requestPayment(Object.assign({ wx.requestPayment(Object.assign({
success(res) { success(res) {
wx.hideLoading() wx.hideLoading()
// 支付成功页面 // 支付成功页面
wxService.router(`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}`) wx.redirectTo({
url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}`,
});
}, },
fail(res) { fail(res) {
wx.hideLoading() wx.hideLoading()
// wxService.router(`/subPackage/page/pages/paymentStatus/paymentStatus?status=F`) // wxService.router(`/subPackage/page/pages/paymentStatus/paymentStatus?status=F`)
wxService.router(`/pages/order/order`) wx.redirectTo({
url: '/pages/order/order',
});
// wxService.router(`/pages/orderDetail/orderDetail?id=${id}`) // wxService.router(`/pages/orderDetail/orderDetail?id=${id}`)
} }
}, data.wxParams)) }, data.wxParams))
...@@ -466,17 +475,45 @@ console.log('sele', finCouponName, finCouponId) ...@@ -466,17 +475,45 @@ console.log('sele', finCouponName, finCouponId)
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
if (!data.length) { if (!data.length) {
wx.removeStorageSync('_defalutAddress');
this.data.addressId = '';
this.data.addressInfo = null;
this.setData({ this.setData({
goodsAddress: true goodsAddress: true
}) });
} else { const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
let params = {
checkByPremium,
trolleySku2Buy,
}
this.calPreferentialPrice(params) // 计算优惠价
}
else {
// 缓存有没有地址 // 缓存有没有地址
let hasDefalut = wx.getStorageSync('_defalutAddress') let hasDefalut = wx.getStorageSync('_defalutAddress')
let _defalutAddress = null let _defalutAddress = null
//有默认地址 但是需要判断当前缓存的默认地址在地址列表中还是否存在 如果不存在则删除 存在则使用
if (hasDefalut) { if (hasDefalut){
let id = hasDefalut.id;
let filterArr = data.filter(item => item.id == id);
if(filterArr.length > 0){
_defalutAddress = hasDefalut _defalutAddress = hasDefalut
} else { }
else{
//移除地址
wx.removeStorageSync('_defalutAddress');
this.setData({
goodsAddress: true
});
const { trolleySku2Buy, checkByPremium} = this.data;
let params = {
checkByPremium,
trolleySku2Buy,
}
this.calPreferentialPrice(params)
}
}
else{
data.forEach(item => { data.forEach(item => {
item.fullArea = item.province + ' ' + item.city + ' ' + item.district item.fullArea = item.province + ' ' + item.city + ' ' + item.district
if (item.type == 1) { if (item.type == 1) {
...@@ -485,8 +522,10 @@ console.log('sele', finCouponName, finCouponId) ...@@ -485,8 +522,10 @@ console.log('sele', finCouponName, finCouponId)
}) })
} }
this.data.addressId = _defalutAddress ? _defalutAddress.id : '';
this.setData({ this.setData({
addressInfo: _defalutAddress addressInfo: _defalutAddress,
addressId: this.data.addressId
}, () => { }, () => {
// preview // preview
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
...@@ -495,6 +534,7 @@ console.log('sele', finCouponName, finCouponId) ...@@ -495,6 +534,7 @@ console.log('sele', finCouponName, finCouponId)
trolleySku2Buy, trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
} }
this.calPreferentialPrice(params) // 计算优惠价 this.calPreferentialPrice(params) // 计算优惠价
}) })
} }
...@@ -554,6 +594,4 @@ console.log('sele', finCouponName, finCouponId) ...@@ -554,6 +594,4 @@ console.log('sele', finCouponName, finCouponId)
showSelectCoupon: true showSelectCoupon: true
}) })
} }
}) })
\ No newline at end of file
...@@ -166,7 +166,11 @@ ...@@ -166,7 +166,11 @@
<text class="cost-label">实付款:</text> <text class="cost-label">实付款:</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text> <text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
</view> </view>
<view class="theme-color buy-btn"> <view class="theme-color buy-btn positionRe">
<!-- <button wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
open-type='getUserInfo'
class='positionAbs' ></button> -->
<button form-type="submit" style="display: inline;" class="theme-color buy-btn">立即购买</button> <button form-type="submit" style="display: inline;" class="theme-color buy-btn">立即购买</button>
</view> </view>
</view> </view>
......
...@@ -15,15 +15,19 @@ wxService.page({ ...@@ -15,15 +15,19 @@ wxService.page({
addressList:[], addressList:[],
startX: '', startX: '',
delBtnWidth: 132,//删除按钮宽度单位(rpx) delBtnWidth: 132,//删除按钮宽度单位(rpx)
isFrom : ''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.data.isFrom = options.isFrom;
wx.hideShareMenu() wx.hideShareMenu()
}, },
//处理设为默认按钮
handelCheckShopAddress(e) { handelCheckShopAddress(e) {
if (this.data.isFrom == 'order'){
const index = e.currentTarget.dataset.index const index = e.currentTarget.dataset.index
const item = this.data.addressList[index] const item = this.data.addressList[index]
item.fullArea = item.province + ' ' + item.city + ' ' + item.district item.fullArea = item.province + ' ' + item.city + ' ' + item.district
...@@ -32,11 +36,11 @@ wxService.page({ ...@@ -32,11 +36,11 @@ wxService.page({
let beforePage = pages[pages.length - 2]; let beforePage = pages[pages.length - 2];
beforePage.setData({ beforePage.setData({
wxAddress: false wxAddress: false
}) });
console.log('beforePage+++++++', beforePage)
setTimeout(() => { setTimeout(() => {
wxService.router().back() wxService.router().back()
}, 300) }, 300)
}
}, },
/** /**
...@@ -64,7 +68,6 @@ wxService.page({ ...@@ -64,7 +68,6 @@ wxService.page({
}) })
}, },
//获取微信地址 //获取微信地址
chooseWxAddress() { chooseWxAddress() {
wx.chooseAddress({ wx.chooseAddress({
...@@ -90,7 +93,6 @@ wxService.page({ ...@@ -90,7 +93,6 @@ wxService.page({
//设置默认地址 //设置默认地址
settingDefalutAddress(e){ settingDefalutAddress(e){
const { memberId } = wx.getStorageSync('_baseUserInfo') const { memberId } = wx.getStorageSync('_baseUserInfo')
console.log(e)
let params = { let params = {
userId: memberId, userId: memberId,
id: e.currentTarget.dataset.id id: e.currentTarget.dataset.id
......
...@@ -154,7 +154,9 @@ ...@@ -154,7 +154,9 @@
report-submit report-submit
name='nav' name='nav'
> >
<button disabled="{{productInfo.productStatus != 2}}" class="buy-button get-formId--btn {{productInfo.productStatus != 2 ? 'btn-default' : 'btn-buy'}}" formType="submit">立即购买</button> <button disabled="{{productInfo.productStatus != 2}}"
class="buy-button get-formId--btn {{productInfo.productStatus != 2 ? 'btn-default' : 'btn-buy'}}"
formType="submit">立即购买</button>
</form> </form>
</block> </block>
......
...@@ -13,6 +13,44 @@ export default class InviteFriends { ...@@ -13,6 +13,44 @@ export default class InviteFriends {
posterImgHeight = windowHeight - 200; posterImgHeight = windowHeight - 200;
} }
} }
// explain = ['妍希送你很多豪礼的静安寺到就看', '很好三等奖啊可是很好三等奖啊可是','数据库大吉点击奥斯卡数据库大吉点击奥斯卡'];
let textOneBottom = '', textTwoBottom = '' , textThreeBottom = '';
if(explain.length == 1){
textOneBottom = '80rpx';
if (explain[0].length > 11){
explain[0] = explain[0].substr(0,10) + '..';
}
}
else if (explain.length == 2){
textOneBottom = '100rpx';
textTwoBottom = '70rpx';
if (explain[0].length > 11) {
explain[0] = explain[0].substr(0, 9) + '..';
}
if (explain[1].length > 15) {
explain[1] = explain[1].substr(0, 14) + '..';
}
}
else if (explain.length == 3){
textOneBottom = '108rpx';
textTwoBottom = '78rpx';
textThreeBottom = '50rpx';
if (explain[0].length > 11) {
explain[0] = explain[0].substr(0, 9) + '..';
}
if (explain[1].length > 15) {
explain[1] = explain[1].substr(0, 14) + '..';
}
if (explain[2].length > 15) {
explain[2] = explain[2].substr(0, 14) + '..';
}
}
return ({ return ({
width: '750rpx', width: '750rpx',
height: windowHeight - 100 + 'px', height: windowHeight - 100 + 'px',
...@@ -30,44 +68,43 @@ export default class InviteFriends { ...@@ -30,44 +68,43 @@ export default class InviteFriends {
type: 'image', type: 'image',
url: qrcodeImg, url: qrcodeImg,
css: { css: {
width: '100rpx', width: '140rpx',
height: '100rpx', height: '140rpx',
right: '28rpx', right: '28rpx',
bottom: '43rpx', bottom: '33rpx',
} }
}, },
{ {
type: 'image', type: 'image',
url: avatarUrl, url: avatarUrl,
css: { css: {
width: '50rpx', width: '80rpx',
height: '50rpx', height: '80rpx',
left: '23rpx', left: '28rpx',
bottom: '43rpx', bottom: '53rpx',
borderRadius: '25rpx' borderRadius: '40rpx'
} }
}, },
{ {
type: 'text', type: 'text',
text: userName + explain[0], text: userName + explain[0],
css: { css: {
width: '180rpx', width: '320rpx',
left: '82rpx', left: '120rpx',
bottom: '83rpx', bottom: textOneBottom,
fontSize: '18rpx', fontSize: '28rpx',
color: '#333333' color: '#000000'
}, },
}, },
{ {
type: 'text', type: 'text',
text: explain[1], text: explain[1],
css: { css: {
width: '180rpx', width: '320rpx',
left: '82rpx', left: '120rpx',
bottom: '63rpx', bottom: textTwoBottom,
fontSize: '18rpx', fontSize: '18rpx',
color: '#333333' color: '#666666'
}, },
}, },
...@@ -75,11 +112,11 @@ export default class InviteFriends { ...@@ -75,11 +112,11 @@ export default class InviteFriends {
type: 'text', type: 'text',
text: explain[2], text: explain[2],
css: { css: {
width: '180rpx', width: '320rpx',
left: '82rpx', left: '120rpx',
bottom: '43rpx', bottom: textThreeBottom,
fontSize: '18rpx', fontSize: '18rpx',
color: '#333333' color: '#666666'
}, },
}, },
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": -1, "current": 32,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -253,8 +253,8 @@ ...@@ -253,8 +253,8 @@
"scene": null "scene": null
}, },
{ {
"id": -1, "id": 32,
"name": "分享", "name": "邀请好友编辑海报页面",
"pathName": "subPackage/page/pages/share/share", "pathName": "subPackage/page/pages/share/share",
"query": "", "query": "",
"scene": null "scene": null
......
...@@ -40,7 +40,6 @@ wxService.page({ ...@@ -40,7 +40,6 @@ wxService.page({
this.getMiniCode() this.getMiniCode()
this.getShareImg() this.getShareImg()
wx.hideShareMenu(); wx.hideShareMenu();
}, },
//轮播图的切换事件 //轮播图的切换事件
...@@ -105,6 +104,11 @@ wxService.page({ ...@@ -105,6 +104,11 @@ wxService.page({
this.setData({ this.setData({
posterImgData: initiatorPage, posterImgData: initiatorPage,
explain: explain explain: explain
},() => {
if (this.data.posterImgData.length > 0){
this.data.currentPosterImg = this.data.posterImgData[0];
this.generatePoster();
}
}) })
} }
} }
...@@ -113,12 +117,23 @@ wxService.page({ ...@@ -113,12 +117,23 @@ wxService.page({
//获取二维码 //获取二维码
getMiniCode() { getMiniCode() {
this.saveTentacleContent().then(res => {
if(res){
let tentacleId = res.id;
let inner_tentacleId = Integer.digit(tentacleId, 10, 64);
this.getPageQrcode(inner_tentacleId)
}
});
},
//获取界面二维码
getPageQrcode(t){
const urls = utils.getCurrentPageUrlWithArgs() const urls = utils.getCurrentPageUrlWithArgs()
let _this = this; let _this = this;
let data = { let data = {
"autoColor": true, "autoColor": true,
"page": 'pages/userCenter/userCenter', "page": 'pages/userCenter/userCenter',
"scene": 'type=-1', "scene": 'type=-1&t=' + t,
"width": 100 "width": 100
} }
wxService.post(`/marketing/quickMark/getAppQrCodePicture`, data).then(res => { wxService.post(`/marketing/quickMark/getAppQrCodePicture`, data).then(res => {
...@@ -127,39 +142,15 @@ wxService.page({ ...@@ -127,39 +142,15 @@ wxService.page({
this.setData({ this.setData({
codeImg: app.globalData.imageUrl + data codeImg: app.globalData.imageUrl + data
// codeImg: "https://hwimagecdn.ihotwind.cn/usr/201908/miniQrCode-f00c5051fef7479395efb193431762c4.jpg" // codeImg: "https://hwimagecdn.ihotwind.cn/usr/201908/miniQrCode-f00c5051fef7479395efb193431762c4.jpg"
},()=>{ }, () => {
const { member } = wx.getStorageSync('_baseUserInfo') _this.generatePoster();
const { avatarUrl } = wx.getStorageSync('_userInfo')
wx.getSystemInfo({
success: function (system) {
wx.getImageInfo({
src: _this.data.posterImgData[0],
success: function (res) {
let posterImgWidth = res.width,
posterImgHeight = res.height;
_this.setData({
template: new Card().palette(_this.data.posterImgData[0],
_this.data.codeImg,
member.memberWeixin.nickname,
avatarUrl,
{
posterImgWidth: posterImgWidth,
posterImgHeight: posterImgHeight,
windowWidth: system.windowWidth,
windowHeight: system.windowHeight
}, _this.data.explain),
});
}
})
}
})
}) })
} }
}) })
}, },
// 保存海报 //生成触点对象信息
savePoster(){ saveTentacleContent(){
let tentacleInfo = { let tentacleInfo = {
content: "我的邀请页面", content: "我的邀请页面",
contentType: app.globalData.contants.SHARE_TYPE.INVITE_FRIENDS, //内容类型 contentType: app.globalData.contants.SHARE_TYPE.INVITE_FRIENDS, //内容类型
...@@ -167,22 +158,37 @@ wxService.page({ ...@@ -167,22 +158,37 @@ wxService.page({
type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销 type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
} }
wxService.getTentacleContent(tentacleInfo).then(res => { return wxService.getTentacleContent(tentacleInfo);
if (res && res.id) { },
// 保存海报
savePoster(){
// let tentacleInfo = {
// content: "我的邀请页面",
// contentType: app.globalData.contants.SHARE_TYPE.INVITE_FRIENDS, //内容类型
// title: '我的邀请', //标题
// type: 3// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
// }
// wxService.getTentacleContent(tentacleInfo).then(res => {
// if (res && res.id) {
// }
// })
wx.saveImageToPhotosAlbum({ wx.saveImageToPhotosAlbum({
filePath: this.imagePath, filePath: this.imagePath,
success(res) { success(res) {
setTimeout(()=>{ setTimeout(() => {
wx.showToast({ wx.showToast({
title: '保存成功,请前往相册查看~', title: '保存成功,请前往相册查看~',
icon: 'none' icon: 'none'
},2000) }, 2000)
}) })
}, },
fail(err){ fail(err) {
console.log(err) console.log(err)
let txt = '保存失敗'; let txt = '保存失敗';
if (err.errMsg == 'saveImageToPhotosAlbum:fail auth deny'){ if (err.errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
txt = '获取相册授权失败' txt = '获取相册授权失败'
} }
setTimeout(() => { setTimeout(() => {
...@@ -193,8 +199,6 @@ wxService.page({ ...@@ -193,8 +199,6 @@ wxService.page({
}) })
} }
}); });
}
})
}, },
onImgOK(e) { onImgOK(e) {
this.setData({ this.setData({
......
...@@ -37,17 +37,13 @@ ...@@ -37,17 +37,13 @@
wx:for="{{posterImgData}}" wx:for="{{posterImgData}}"
wx:for-index="idx" wx:for-index="idx"
wx:for-item="navItem" wx:for-item="navItem"
wx:key="idx" wx:key="idx">
>
<view <view
class="scroll-view-item {{currentTab == idx ?'poster-active':''}}" class="scroll-view-item {{currentTab == idx ?'poster-active':''}}"
data-current="{{idx}}" data-current="{{idx}}"
data-img="{{navItem}}" data-img="{{navItem}}"
bindtap="switchPoster" bindtap="switchPoster">
<image class="poster-img" src="{{navItem}}" mode='aspectFit'></image>
>
<image class="poster-img" src="{{navItem}}"></image>
<view class="select-plus" wx:if="{{idx == currentTab}}"> <view class="select-plus" wx:if="{{idx == currentTab}}">
<view class="circle-radio theme-color"> <view class="circle-radio theme-color">
<image class="tick-success" src="/assets/imgs/7_1_0/tick-success.png" mode="widthFix"></image> <image class="tick-success" src="/assets/imgs/7_1_0/tick-success.png" mode="widthFix"></image>
......
...@@ -39,9 +39,9 @@ swiper-item{ ...@@ -39,9 +39,9 @@ swiper-item{
} }
.code-img{ .code-img{
position: absolute; position: absolute;
width: 100rpx; width: 120rpx;
height: 100rpx; height: 120rpx;
bottom: 43rpx; bottom: 23rpx;
right: 24rpx; right: 24rpx;
} }
.active{ .active{
...@@ -90,23 +90,27 @@ swiper-item{ ...@@ -90,23 +90,27 @@ swiper-item{
} }
.scroll-view-item { .scroll-view-item {
display: inline-block; display: inline-block;
width: 125rpx; width: 150rpx;
height: 215rpx; height: 215rpx;
background-color: #d8d8d8; background-color: #d8d8d8;
margin-right: 23rpx; margin-right: 23rpx;
position: relative; position: relative;
} }
.poster-tips{ .poster-tips{
position: fixed; position: fixed;
bottom: 220rpx; bottom: 220rpx;
left: 33rpx; left: 33rpx;
} }
.poster-tips image{ .poster-tips image{
width: 362rpx; width: 362rpx;
} }
.poster-img{ .poster-img{
width: 100%; width: 100%;
height: 215rpx; /* height: 215rpx; */
max-height: 215rpx;
} }
.select-plus{ .select-plus{
position: absolute; position: absolute;
...@@ -161,5 +165,7 @@ swiper-item{ ...@@ -161,5 +165,7 @@ swiper-item{
height: 100vh; height: 100vh;
/* background: #ffffff; */ /* background: #ffffff; */
z-index: -9999; z-index: -9999;
/* z-index: 999999; */
/* top: 0; */
} }
\ No newline at end of file
...@@ -604,7 +604,21 @@ class WXService extends Http { ...@@ -604,7 +604,21 @@ class WXService extends Http {
} }
if (item['scene']) { if (item['scene']) {
pageIsFromShare = true; pageIsFromShare = true;
let idParam = decodeURIComponent(item['scene']).split('&')[0]; let sceneParam = decodeURIComponent(item['scene']);
console.log('sceneParam---', sceneParam)
let tParam = '';
//判断是不是有触点参数
if (sceneParam.indexOf('t=') > -1){
let tArr = sceneParam.split('&');
for (let i = 0; i < tArr.length ; i ++){
if (tArr[i].indexOf('t=') > -1){
tParam = tArr[i].split('t=')[1];
break;
}
}
}
let idParam = sceneParam.split('&')[0];
let shareId = idParam && idParam.split('=')[1] || 0; let shareId = idParam && idParam.split('=')[1] || 0;
// console.log(shareId) // console.log(shareId)
// console.log(idParam) // console.log(idParam)
...@@ -612,10 +626,12 @@ class WXService extends Http { ...@@ -612,10 +626,12 @@ class WXService extends Http {
if (idParam.indexOf('pageId') > -1){ if (idParam.indexOf('pageId') > -1){
item['pageId'] = shareId; item['pageId'] = shareId;
} }
if (tParam){
id = Integer.digit(tParam, 64, 10);
}
// //
if (shareId && shareId !=0){ if (shareId && shareId !=0){
item['id'] = Integer.digit(shareId, 64, 10) item['id'] = Integer.digit(shareId, 64, 10);
id = item['id'];
} }
} }
}); });
...@@ -624,7 +640,6 @@ class WXService extends Http { ...@@ -624,7 +640,6 @@ class WXService extends Http {
//调用接口 //调用接口
_self.getTentacleContentByTentacleId(id); _self.getTentacleContentByTentacleId(id);
} }
config.onLoad && config.onLoad.apply(page, args); config.onLoad && config.onLoad.apply(page, args);
}, },
onShow: function (...args) { onShow: function (...args) {
...@@ -843,6 +858,7 @@ class WXService extends Http { ...@@ -843,6 +858,7 @@ class WXService extends Http {
} }
this.showOpenCardModelLock = true // 避免多次弹出开卡对话窗 this.showOpenCardModelLock = true // 避免多次弹出开卡对话窗
// 开卡 // 开卡
console.log('开卡参数为-----', options)
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wxeb490c6f9b154ef9', // 固定为此 appid,不可改动 appId: 'wxeb490c6f9b154ef9', // 固定为此 appid,不可改动
extraData: options, // 包括 encrypt_card_id, outer_str, biz三个字段,须从 step3 中获得的链接中获取参数 extraData: options, // 包括 encrypt_card_id, outer_str, biz三个字段,须从 step3 中获得的链接中获取参数
...@@ -898,11 +914,19 @@ class WXService extends Http { ...@@ -898,11 +914,19 @@ class WXService extends Http {
openCard() { openCard() {
const baseUserInfo = wx.getStorageSync('_baseUserInfo') const baseUserInfo = wx.getStorageSync('_baseUserInfo')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!baseUserInfo){
reject({
state: 0
})
return ;
}
if (baseUserInfo && baseUserInfo.memberActivateStatus) { if (baseUserInfo && baseUserInfo.memberActivateStatus) {
// console.log('已开卡', baseUserInfo) // console.log('已开卡', baseUserInfo)
wxService.openCardList() wxService.openCardList()
resolve(baseUserInfo) resolve(baseUserInfo)
} else if (!baseUserInfo || !baseUserInfo.memberActivateStatus) { }
else if (!baseUserInfo.memberActivateStatus) {
// console.log('去开卡', baseUserInfo) // console.log('去开卡', baseUserInfo)
return this.navigateToMiniProgram({ return this.navigateToMiniProgram({
biz: baseUserInfo.biz, biz: baseUserInfo.biz,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment