Commit 7b268d39 by 杨北旺

甄选/领取

1 parent 3a972622
...@@ -64,9 +64,9 @@ module.exports = { ...@@ -64,9 +64,9 @@ module.exports = {
/**免费领取体验卡 */ /**免费领取体验卡 */
tolqFreecard(data) { tolqFreecard(data) {
return api.post({ return api.post({
method: `scrm.api.equity.h5.free.card.receive`, method: `scrm.api.equity.h5.free.card.receive`,
...data ...data
}, },
true true
) )
}, },
...@@ -87,10 +87,10 @@ module.exports = { ...@@ -87,10 +87,10 @@ module.exports = {
/**领取优惠券 */ /**领取优惠券 */
receiveCoupon(data) { receiveCoupon(data) {
return api.post({ return api.post({
method: `scrm.api.coupon.share.receive`, method: `scrm.api.coupon.share.receive`,
...data, ...data,
receiveSource: 4 receiveSource: 4
}, },
true true
) )
}, },
...@@ -166,4 +166,25 @@ module.exports = { ...@@ -166,4 +166,25 @@ module.exports = {
receiveSource: 3 receiveSource: 3
}) })
}, },
// 获取优惠券和商品详情
getEquityCouponsDetail(data) {
return api.post({
method: `scrm.api.coupon.brand.detail`,
...data
})
},
// 领取权益优惠券
getEquityCoupons(data) {
return api.post({
method: `scrm.api.coupon.user.url.get`,
...data
})
},
//批量领取门店发现商城优惠券
batchGetMerchantCouponsApi(data) {
return api.post({
method: `scrm.api.coupon.discover.goods.list.batch.receive`,
...data
})
},
} }
\ No newline at end of file \ No newline at end of file
...@@ -113,9 +113,7 @@ ...@@ -113,9 +113,7 @@
"pages": [ "pages": [
"pages/index/index" "pages/index/index"
], ],
"plugins": { "plugins": {}
}
}, },
{ {
"root": "packageStrategy", "root": "packageStrategy",
...@@ -140,7 +138,8 @@ ...@@ -140,7 +138,8 @@
"pages": [ "pages": [
"pages/road/index/index", "pages/road/index/index",
"pages/road/roadInfo/roadInfo", "pages/road/roadInfo/roadInfo",
"pages/freecard/freecard" "pages/freecard/freecard",
"pages/gCoupons/index"
] ]
} }
], ],
......
@import "assets/style/common.wxss"; @import "assets/style/common.wxss";
@import "style/sprite.wxss"; @import "style/sprite.wxss";
@import "style/common.wxss";
page { page {
background-color: #F8F8F8 !important; background-color: #F8F8F8 !important;
......
// packageEquity/pages/gCoupons/index.js
Page({
data: {
},
onLoad(options) {
this.getEquityCouponsDetail(10785)
},
// 查询优惠券详情
getEquityCouponsDetail(id){
wx.p.api.couponsApi.getEquityCouponsDetail({couponId:id}).then(res=>{
console.log(res);
this.setData({
detailInfo:res
})
this.couponId = id
})
},
// 领取
toGet(){
const {
detailInfo
} = this.data
wx.p.wxApi.showLoading()
wx.p.api.couponsApi.getEquityCoupons({couponId:this.couponId,merchantId:detailInfo.merchantId}).then(res=>{
console.log(res);
wx.hideLoading();
})
},
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<button bind:tap="toGet">领取</button>
\ No newline at end of file \ No newline at end of file
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
const navStyle = 'background-color: transparent;' const navStyle = 'background-color: transparent;'
let navBarHeight = 38 let navBarHeight = 38
import NP from 'number-precision' import NP from 'number-precision'
import USERAPI from '~/api/usersApi/index' import USERAPI from "~/api/usersApi/index";
import { IMG_URL } from '~/config';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMGURL: wx.p.IMGURL, IMGURL: IMG_URL,
navStyle, navStyle,
bannerIndex: 0, bannerIndex: 0,
contactInfo: {}, contactInfo: {},
...@@ -139,7 +140,7 @@ Page({ ...@@ -139,7 +140,7 @@ Page({
item.map(i => { item.map(i => {
if (i.resType == 1) urls.push(i.content) if (i.resType == 1) urls.push(i.content)
}) })
wx.$api.previewImage({ wx.p.wxApi.previewImage({
current, current,
urls urls
}) })
...@@ -153,7 +154,7 @@ Page({ ...@@ -153,7 +154,7 @@ Page({
item.map(i => { item.map(i => {
urls.push(i) urls.push(i)
}) })
wx.$api.previewImage({ wx.p.wxApi.previewImage({
current, current,
urls urls
}) })
...@@ -163,7 +164,7 @@ Page({ ...@@ -163,7 +164,7 @@ Page({
url, url,
isChooseAddress isChooseAddress
} = e.currentTarget.dataset } = e.currentTarget.dataset
wx.$router.go(url, { wx.p.router.go(url, {
isChooseAddress isChooseAddress
}) })
}, },
...@@ -231,7 +232,7 @@ Page({ ...@@ -231,7 +232,7 @@ Page({
hasCouponFlag hasCouponFlag
} = this.options } = this.options
if ((upgrade || isCarOwner) && hasCouponFlag) { if ((upgrade || isCarOwner) && hasCouponFlag) {
wx.$router.go(`/packageShopmall/packageMall/pages/getCoupon/getCoupon?discoverGoodsType=${upgrade? 1: 2}&from=${upgrade? 1: 2}`, { wx.p.router.go(`/packageMall/pages/getCoupon/getCoupon?discoverGoodsType=${upgrade? 1: 2}&from=${upgrade? 1: 2}`, {
notIntercept: true notIntercept: true
}); });
} else { } else {
...@@ -309,7 +310,7 @@ Page({ ...@@ -309,7 +310,7 @@ Page({
goodsList.goodsId = goodsList.id goodsList.goodsId = goodsList.id
} }
console.log(this.data.goodsInfo, 'goodsInfo') console.log(this.data.goodsInfo, 'goodsInfo')
wx.$router.go('/packageDiscovery/pages/pay/index', { wx.p.router.go('/packageDiscovery/pages/pay/index', {
goodsList: upgrade ? goodsList : [goodsList] , goodsList: upgrade ? goodsList : [goodsList] ,
deliveryType: upgrade ? 1 : 0, deliveryType: upgrade ? 1 : 0,
showAddr: (isCarOwner && this.data.goodsInfo.deliveryType == 1) ? 0 : 1, showAddr: (isCarOwner && this.data.goodsInfo.deliveryType == 1) ? 0 : 1,
...@@ -319,7 +320,7 @@ Page({ ...@@ -319,7 +320,7 @@ Page({
}) })
return return
} }
wx.$router.go('/packageShopmall/packageMall/pages/pay/pay', { wx.p.router.go('/packageMall/pages/pay/pay', {
isPay: true, isPay: true,
isActivity, isActivity,
contactInfo, contactInfo,
...@@ -357,7 +358,7 @@ Page({ ...@@ -357,7 +358,7 @@ Page({
}) })
}, },
back() { back() {
wx.$router.back() wx.p.router.back()
}, },
changeBanner(e) { changeBanner(e) {
this.setData({ this.setData({
...@@ -366,7 +367,7 @@ Page({ ...@@ -366,7 +367,7 @@ Page({
}, },
//查看全部评价 //查看全部评价
openEvaluation() { openEvaluation() {
wx.$router.go('/packageShopmall/packageMall/pages/comment/comment', { wx.p.router.go('/packageMall/pages/comment/comment', {
...this.data ...this.data
}) })
}, },
...@@ -397,7 +398,6 @@ Page({ ...@@ -397,7 +398,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
// debugger
console.log(options,'options'); console.log(options,'options');
if(options&&options.openId){ if(options&&options.openId){
this.shareOpenId = options.openId this.shareOpenId = options.openId
...@@ -430,7 +430,7 @@ Page({ ...@@ -430,7 +430,7 @@ Page({
view: 1 view: 1
}) })
} else { } else {
wx.$router.getData(({ wx.p.router.getData(({
id, id,
isActivity = true isActivity = true
}) => { }) => {
...@@ -459,7 +459,7 @@ Page({ ...@@ -459,7 +459,7 @@ Page({
options.item_type = options.isActivity ? 3 : 1 options.item_type = options.isActivity ? 3 : 1
options.action_type = 1 options.action_type = 1
options.item_id = options.id options.item_id = options.id
wx.$util.reportData(options, false, false, true) // wx.$util.reportData(options, false, false, true)
wx.p.storage.set('shareStaff', JSON.stringify(shareStaff)) wx.p.storage.set('shareStaff', JSON.stringify(shareStaff))
wx.p.storage.set('shareStaffTracker', JSON.stringify(options)) wx.p.storage.set('shareStaffTracker', JSON.stringify(options))
} }
...@@ -467,7 +467,7 @@ Page({ ...@@ -467,7 +467,7 @@ Page({
if (options.activity_id) { if (options.activity_id) {
this.data.options = options this.data.options = options
wx.p.storage.set('miaoshatrack', encodeURIComponent(JSON.stringify(options))) wx.p.storage.set('miaoshatrack', encodeURIComponent(JSON.stringify(options)))
wx.$util.reportData(options, true, false) // wx.$util.reportData(options, true, false)
} }
// 配置升级 // 配置升级
if (options && options.isUpgrade) { if (options && options.isUpgrade) {
...@@ -676,7 +676,7 @@ Page({ ...@@ -676,7 +676,7 @@ Page({
// if (res.confirm) { // if (res.confirm) {
// this.getGoodsDetail(id) // this.getGoodsDetail(id)
// } else { // } else {
// wx.$router.back() // wx.p.router.back()
// } // }
// }) // })
} }
...@@ -709,7 +709,7 @@ Page({ ...@@ -709,7 +709,7 @@ Page({
}) })
}, },
setMediaInfo(goodsDescList) { setMediaInfo(goodsDescList) {
wx.$api.getSystemInfo(({ wx.p.wxApi.getSystemInfo(({
windowWidth windowWidth
}) => { }) => {
goodsDescList.map((e, index) => { goodsDescList.map((e, index) => {
...@@ -727,7 +727,9 @@ Page({ ...@@ -727,7 +727,9 @@ Page({
}) })
}) })
}, },
getUserAddressList() { async getUserAddressList() {
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
wx.p.api.mineApi.getUserAddressList().then(data => { wx.p.api.mineApi.getUserAddressList().then(data => {
if (!data.length) { if (!data.length) {
this.setData({ this.setData({
...@@ -742,7 +744,9 @@ Page({ ...@@ -742,7 +744,9 @@ Page({
} }
}) })
}, },
getUserAddressDefault() { async getUserAddressDefault() {
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
wx.p.api.mineApi.getUserAddressDefault().then(({ wx.p.api.mineApi.getUserAddressDefault().then(({
code, code,
data data
......
...@@ -123,9 +123,9 @@ ...@@ -123,9 +123,9 @@
<view>销售: {{goodsInfo.goodsStatistics.saleAmount || 0}}</view> <view>销售: {{goodsInfo.goodsStatistics.saleAmount || 0}}</view>
</view> </view>
</block> </block>
<block wx:if="{{isCarOwner&&goodsInfo.giveIntegral}}"> <!-- <block wx:if="{{isCarOwner&&goodsInfo.giveIntegral}}">
<view class="carOwner_jf">赠养车积分:{{goodsInfo.giveIntegral}}</view> <view class="carOwner_jf">赠养车积分:{{goodsInfo.giveIntegral}}</view>
</block> </block> -->
</view> </view>
<view class="goods-param box"> <view class="goods-param box">
......
// packageShopmall/packageMall/pages/getCoupon/getCoupon.js // packageShopmall/packageMall/pages/getCoupon/getCoupon.js
import { couponsApi,userApi } from "~/api/index"; import { userApi } from "~/api/index";
import { centsToyuan } from '~/utils/format'
// import USER from '~/api/usersApi/index' // import USER from '~/api/usersApi/index'
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
// console.log(couponsApi,'couponsApi'); import { IMG_URL } from '~/config';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMGURL: wx.p.IMGURL, IMGURL: IMG_URL,
navStyle, navStyle,
showSuccessDialog: false, showSuccessDialog: false,
isLogin: false, isLogin: false,
...@@ -69,10 +68,10 @@ Page({ ...@@ -69,10 +68,10 @@ Page({
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => { wx.p.api.couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
if(res?.length) { if(res?.length) {
res.forEach(item =>{ res.forEach(item =>{
item.denomination = Number(centsToyuan(item.denomination||0)) item.denomination = Number(wx.p.format.centsToyuan(item.denomination||0))
}) })
this.setData({ this.setData({
couponList : res couponList : res
...@@ -86,8 +85,8 @@ Page({ ...@@ -86,8 +85,8 @@ Page({
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
let couponIds = this.data.couponList?.map(item => item.couponId) let couponIds = this.data.couponList?.map(item => item.couponId)
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
couponsApi.batchGetMerchantCouponsApi({merchantId,couponIds,discoverGoodsType:this.options.discoverGoodsType}).then(res => { wx.p.api.couponsApi.batchGetMerchantCouponsApi({merchantId,couponIds,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
wx.p.api.hideLoading() wx.hideLoading()
if(res){ if(res){
this.setData({ this.setData({
showSuccessDialog: true showSuccessDialog: true
...@@ -158,7 +157,7 @@ Page({ ...@@ -158,7 +157,7 @@ Page({
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => { wx.p.api.couponsApi.getMerchantCouponsListApi({merchantId,discoverGoodsType:this.options.discoverGoodsType}).then(res => {
if(res?.length) { if(res?.length) {
this.receiveCoupon() this.receiveCoupon()
} }
......
/* packageMall/pages/getCoupon/getCoupon.wxss */
\ No newline at end of file \ No newline at end of file
...@@ -21,7 +21,7 @@ Page({ ...@@ -21,7 +21,7 @@ Page({
// videoContext.play() //视频播放 // videoContext.play() //视频播放
}, },
goDetailPage(){ goDetailPage(){
wx.$router.go('/packageShopmall/packageMall/pages/detail/detail', { wx.p.router.go('/packageMall/pages/detail/detail', {
id: this.data.goodsInfo.id, id: this.data.goodsInfo.id,
isCarOwner: true, isCarOwner: true,
notIntercept: true, notIntercept: true,
...@@ -29,7 +29,7 @@ Page({ ...@@ -29,7 +29,7 @@ Page({
}) })
}, },
toBack() { toBack() {
wx.$router.back() wx.p.router.back()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -42,7 +42,7 @@ Page({ ...@@ -42,7 +42,7 @@ Page({
}) })
}, },
goAgreement() { goAgreement() {
wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/hmd/privacy.html', true) wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/privacy.html', true)
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
......
import { IMG_URL } from '~/config';
Page({ Page({
data: { data: {
...@@ -12,20 +12,24 @@ Page({ ...@@ -12,20 +12,24 @@ Page({
id: 4, id: 4,
}, { }, {
id: 5, id: 5,
},] },],
showModal: false,
IMG_URL: IMG_URL
}, },
onLoad(options) { onLoad(options) {
this.toCheckMember()
}, },
toJump(e) { toJump(e) {
const flag = this.checkLogin()
if (flag) return
const { id } = e.currentTarget.dataset const { id } = e.currentTarget.dataset
let url = '' let url = ''
const shareCode = '5759S2m7h' const shareCode = '5759S2m7h'
switch (id) { switch (id) {
case 1: case 1:
url = `plugin://collectionPlugin/sbkHome?shareCode=${shareCode}&userId=ooPYo45el_GJ55vqhdME5-tqQmaw` url = `plugin://collectionPlugin/sbkHome?shareCode=${shareCode}`
break; break;
case 2: case 2:
url = `plugin://collectionPlugin/sbkHome?shareCode=${shareCode}` url = `plugin://collectionPlugin/sbkHome?shareCode=${shareCode}`
...@@ -46,11 +50,38 @@ Page({ ...@@ -46,11 +50,38 @@ Page({
wx.navigateTo({ wx.navigateTo({
url, url,
}) })
}, },
// 检查是否已登录 // 检查是否已登录/会员
checkLogin(){ async checkLogin() {
const authStatus = wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept()
console.log(authStatus); if (authStatus) return authStatus
if (!this.open) {
this.setData({
showModal: true
})
return true
}
},
async toCheckMember() {
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
wx.p.api.equityApi.checkOpenMember().then(res => {
let flag = false
if (res.code == 0 && res.data) {
flag = true
}
this.open = flag
})
},
closeModal() {
this.setData({
showModal: false,
});
},
toOpenPage() {
wx.p.router.go('/packageSaveMoney/pages/open/open', {
notIntercept: true
})
}, },
}) })
...@@ -6,4 +6,68 @@ ...@@ -6,4 +6,68 @@
height: 268rpx; height: 268rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
}
.modal_widget {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
.popup-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .6);
}
.box_cover {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 638rpx;
height: 888rpx;
.max_cover {
width: 638rpx;
height: 888rpx;
}
.close_icon {
position: absolute;
right: 32rpx;
top: 64rpx;
width: 32rpx;
height: 32rpx;
}
.btn {
width: 526rpx;
height: 80rpx;
background-image: linear-gradient(90deg, #464646 0%, #191919 100%);
border-radius: 48rpx;
font-weight: 600;
font-size: 32rpx;
color: #FDECE1;
position: absolute;
left: 50%;
bottom: 104rpx;
transform: translateX(-50%);
}
.text_btn {
font-weight: 400;
font-size: 28rpx;
color: #666666;
position: absolute;
left: 50%;
bottom: 40rpx;
transform: translateX(-50%);
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,3 +3,13 @@ ...@@ -3,3 +3,13 @@
<glsx-image bind:tap="toJump" data-id="{{item.id}}" class="cover" webp src="equity/plugin/equity_plugin_{{index}}.png"></glsx-image> <glsx-image bind:tap="toJump" data-id="{{item.id}}" class="cover" webp src="equity/plugin/equity_plugin_{{index}}.png"></glsx-image>
</block> </block>
</view> </view>
<!-- 弹框 -->
<view wx:if="{{showModal}}" class="modal_widget">
<view bind:tap="closeModal" class="popup-bg"></view>
<view class="box_cover">
<image class="max_cover" src="{{IMG_URL}}equity/plugin/plugin_modal_bg.png" />
<image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}equity/plugin/plugin_modal_close_icon.png" />
<view bind:tap="toOpenPage" class="btn flex_cc">去开通</view>
<view bind:tap="closeModal" class="text_btn">我再想想</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -7,9 +7,12 @@ Page({ ...@@ -7,9 +7,12 @@ Page({
onLoad(options) { onLoad(options) {
console.log(options); console.log(options);
if(options&&options.openId){ if (options && options.openId) {
this.shareOpenId = options.openId this.shareOpenId = options.openId
} }
if (options && options.share_guest_no) {
this.share_guest_no = options.share_guest_no
}
this.data.enter_time = new Date().format('yyyy-MM-dd hh:mm:ss') this.data.enter_time = new Date().format('yyyy-MM-dd hh:mm:ss')
this.firstEnter = true this.firstEnter = true
this.getStrategyDetail(options.id); this.getStrategyDetail(options.id);
...@@ -51,6 +54,7 @@ Page({ ...@@ -51,6 +54,7 @@ Page({
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
let data = { let data = {
open_id: openId || null, open_id: openId || null,
create_time: this.firstEnter create_time: this.firstEnter
...@@ -66,6 +70,7 @@ Page({ ...@@ -66,6 +70,7 @@ Page({
merchant_id: merchantId, merchant_id: merchantId,
guest_no: wx.p.$Track.getGuestNo(), //游客ID, guest_no: wx.p.$Track.getGuestNo(), //游客ID,
user_open_id: this.shareOpenId || "", user_open_id: this.shareOpenId || "",
share_guest_no: this.share_guest_no || ''
}; };
this.firstEnter = false; this.firstEnter = false;
const jsonList = [JSON.stringify(data)]; const jsonList = [JSON.stringify(data)];
...@@ -98,11 +103,11 @@ Page({ ...@@ -98,11 +103,11 @@ Page({
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
const userInfo = wx.p.cache.userInfo.getUserInfo(); const userInfo = wx.p.cache.userInfo.getUserInfo();
let { strategyDetailObj } = this.data, let { strategyDetailObj } = this.data,
open_id = ""; open_id = "", share_guest_no = wx.p.$Track.getGuestNo();
if (userInfo) open_id = userInfo.openId; if (userInfo) open_id = userInfo.openId;
let path = `id=${strategyDetailObj.id}&openId=${open_id}`; let path = `id=${strategyDetailObj.id}&openId=${open_id}&share_guest_no=${share_guest_no}`;
if (merchantId) path = `${path}&merchantId=${merchantId}`; if (merchantId) path = `${path}&merchantId=${merchantId}`;
this.shareTitle = strategyDetailObj.strategyName; this.shareTitle = strategyDetailObj.strategyName;
this.shareImage = strategyDetailObj.strategyImg this.shareImage = strategyDetailObj.strategyImg
......
...@@ -30,7 +30,7 @@ Page({ ...@@ -30,7 +30,7 @@ Page({
const { const {
name name
} = e.currentTarget.dataset } = e.currentTarget.dataset
wx.p.router.jumpH5(`https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/hmd/${name}.html`, true) wx.p.router.jumpH5(`https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/${name}.html`, true)
}, },
async onLoad() { async onLoad() {
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
......
const baseUrl = 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/' const baseUrl = 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
// import {componentsMixin} from '../../mixins/index' import { IMG_URL } from '~/config';
Component({ Component({
// behaviors: [componentsMixin], // behaviors: [componentsMixin],
...@@ -17,7 +17,7 @@ Component({ ...@@ -17,7 +17,7 @@ Component({
data: { data: {
errImage:baseUrl+'loading_icon.gif', errImage:baseUrl+'loading_icon.gif',
curErrorIndex:-1, curErrorIndex:-1,
IMGURL:wx.$imgUrl IMGURL:IMG_URL
}, },
/** /**
......
...@@ -151,7 +151,7 @@ Page({ ...@@ -151,7 +151,7 @@ Page({
const needShowEquity = ['星巴克', '瑞幸咖啡', '奈雪の茶', '麦当劳', '肯德基'] const needShowEquity = ['星巴克', '瑞幸咖啡', '奈雪の茶', '麦当劳', '肯德基']
const needShowEquity2 = ['猫眼电影', '爱奇艺', '优酷', '网易云音乐', '喜马拉雅'] const needShowEquity2 = ['猫眼电影', '爱奇艺', '优酷', '网易云音乐', '喜马拉雅']
const needShowEquity3 = ['高德打车', '曹操出行'] const needShowEquity3 = ['高德打车', '曹操出行']
if (env == 'production') { if (env == 'production' || env == 'develop') {
let all = [] let all = []
equityList.forEach(el => { equityList.forEach(el => {
if (el.equityGoodsGroupDescDtos) { if (el.equityGoodsGroupDescDtos) {
......
...@@ -106,7 +106,7 @@ Page({ ...@@ -106,7 +106,7 @@ Page({
const merchantObj = { const merchantObj = {
'develop': [44211227, 44209845], 'develop': [44211227, 44209845],
'test': [44212577, 44210895, 44212578, 44210956], 'test': [44212577, 44210895, 44212578, 44210956],
'beta': [], 'beta': [44211427,44211428],
'production': [44209566, 44209565], 'production': [44209566, 44209565],
} }
const MerchantList = merchantObj[env] const MerchantList = merchantObj[env]
...@@ -130,7 +130,7 @@ Page({ ...@@ -130,7 +130,7 @@ Page({
bannerList, bannerList,
merchantId: el merchantId: el
}) })
if (storeList.length == 2) { if (storeList.length > 1) {
storeList.forEach((ele, i) => { storeList.forEach((ele, i) => {
console.log(i, this.defaultMerchant); console.log(i, this.defaultMerchant);
if (this.defaultMerchant == i) { if (this.defaultMerchant == i) {
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
decimal, decimal,
centsToyuan centsToyuan
} from '~/utils/format' } from '~/utils/format'
import {eventbus} from '~/utils/index' import { eventbus } from '~/utils/index'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -23,10 +23,10 @@ Component({ ...@@ -23,10 +23,10 @@ Component({
}, },
}, },
merchantid: { merchantid: {
type: [String,Number], type: [String, Number],
observer: function (val) { observer: function (val) {
if (val) { if (val) {
this.init() this.init()
// this.setList(val); // this.setList(val);
} }
}, },
...@@ -73,7 +73,7 @@ Component({ ...@@ -73,7 +73,7 @@ Component({
getCategoryList() { getCategoryList() {
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
const _params = { const _params = {
merchantId, merchantId,
categoryType: '2' categoryType: '2'
...@@ -94,7 +94,7 @@ Component({ ...@@ -94,7 +94,7 @@ Component({
async getCategoryGoodsList(categoryId) { async getCategoryGoodsList(categoryId) {
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
let _para = { let _para = {
merchantId, merchantId,
categoryId, categoryId,
...@@ -114,61 +114,60 @@ Component({ ...@@ -114,61 +114,60 @@ Component({
curPlayIdx: idx > -1 ? idx : 0 curPlayIdx: idx > -1 ? idx : 0
}) })
}, },
scrollFn(e){ scrollFn(e) {
// console.log(e.scrollTop) // console.log(e.scrollTop)
// try { // try {
// let idx = this.data.goodsItemTopList.findIndex(item => e.scrollTop+300 < item) // let idx = this.data.goodsItemTopList.findIndex(item => e.scrollTop+300 < item)
// this.setData({ // this.setData({
// curPlayIdx: idx >-1 ? idx : 0 // curPlayIdx: idx >-1 ? idx : 0
// }) // })
// } catch (error) { // } catch (error) {
// console.log(error) // console.log(error)
// } // }
// let curPlayId = 'video' + this.data.curPlayIdx // let curPlayId = 'video' + this.data.curPlayIdx
// let videoContext = wx.createvideoContext(curPlayId); // let videoContext = wx.createvideoContext(curPlayId);
// videoContext.stop(); // videoContext.stop();
if(this.data.categoryStyle!=3) return; if (this.data.categoryStyle != 3) return;
const query = wx.createSelectorQuery().in(this) const query = wx.createSelectorQuery().in(this)
query.selectAll('.goods_box').boundingClientRect((rect) => { query.selectAll('.goods_box').boundingClientRect((rect) => {
if(rect?.length){ if (rect?.length) {
let curPlayIdx = -1 let curPlayIdx = -1
let goodsItemTopList = rect.map(item => item.top) let goodsItemTopList = rect.map(item => item.top)
let idx = goodsItemTopList.findIndex(item => item > 300) let idx = goodsItemTopList.findIndex(item => item > 300)
curPlayIdx = idx-1 >-1 ? idx-1 : 0 curPlayIdx = idx - 1 > -1 ? idx - 1 : 0
const _targetItem = this.data.goodsList[curPlayIdx] || {} const _targetItem = this.data.goodsList[curPlayIdx] || {}
if(!(_targetItem?.commerceVideo || _targetItem?.goodsVideo)){ if (!(_targetItem?.commerceVideo || _targetItem?.goodsVideo)) {
for(let i = idx; i<this.data.goodsList.length;i++){ for (let i = idx; i < this.data.goodsList.length; i++) {
if(this.data.goodsList[i]?.commerceVideo || this.data.goodsList[i]?.goodsVideo){ if (this.data.goodsList[i]?.commerceVideo || this.data.goodsList[i]?.goodsVideo) {
curPlayIdx = i curPlayIdx = i
break; break;
} }
} }
} }
this.setData({ this.setData({
curPlayIdx: curPlayIdx>-1 ? curPlayIdx : 0 curPlayIdx: curPlayIdx > -1 ? curPlayIdx : 0
}) })
} }
}).exec() ; }).exec();
}, },
// 跳转商品详情 // 跳转商品详情
toGoodsDetail(e) { toGoodsDetail(e) {
// debugger
const { const {
item item
} = e.currentTarget.dataset } = e.currentTarget.dataset
const B_userInfo = wx.p.storage.get('userInfo') const B_userInfo = wx.p.storage.get('userInfo')
if (B_userInfo && B_userInfo.userType) { if (B_userInfo && B_userInfo.userType) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/Login/Login' url: '/pages/Login/Login'
}) })
return return
} }
if(item.commerceVideo){ if (item.commerceVideo) {
const {coverUrl, commerceVideo, commerceDescribe, activityPrice, originalPrice, goodsName, goodsImage,id} = item const { coverUrl, commerceVideo, commerceDescribe, activityPrice, originalPrice, goodsName, goodsImage, id } = item
wx.p.router.go(`packageMall/pages/goodsVideo/goodsVideo`, { wx.p.router.go(`/packageMall/pages/goodsVideo/goodsVideo`, {
id, id,
notIntercept:true, notIntercept: true,
coverUrl: goodsImage, coverUrl: goodsImage,
commerceVideo, commerceVideo,
commerceDescribe, commerceDescribe,
...@@ -177,7 +176,7 @@ Component({ ...@@ -177,7 +176,7 @@ Component({
goodsName, goodsName,
hasCouponFlag: this.data.hasCarOwnerCouponFlag hasCouponFlag: this.data.hasCarOwnerCouponFlag
}); });
}else{ } else {
wx.p.router.go('/packageMall/pages/detail/detail', { wx.p.router.go('/packageMall/pages/detail/detail', {
id: item.id, id: item.id,
hasCouponFlag: this.data.hasCarOwnerCouponFlag, hasCouponFlag: this.data.hasCarOwnerCouponFlag,
...@@ -214,69 +213,76 @@ Component({ ...@@ -214,69 +213,76 @@ Component({
// }, // },
// 获取购物车列表 // 获取购物车列表
async getBuyCarList() { async getBuyCarList() {
const authStatus = await wx.p.router.intercept(false)
if (authStatus) return
const B_userInfo = wx.p.storage.get('userInfo') const B_userInfo = wx.p.storage.get('userInfo')
if (B_userInfo && B_userInfo.userType) return; if (B_userInfo && B_userInfo.userType) return;
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
const res = await shopmallApi.getShoppingcartList({ const res = await shopmallApi.getShoppingcartList({
cartType: 4, cartType: 4,
merchantId merchantId
}) })
eventbus.emit('getBuyCarList', res) eventbus.emit('getBuyCarList', res)
}, },
// 加入购物车 // 加入购物车
async toAddBuuCar(e) { async toAddBuuCar(e) {
if (wx.$authStatus) {
if(this.data.hasCarOwnerCouponFlag){
wx.p.router.go(`packageMall/pages/getCoupon/getCoupon?discoverGoodsType=2&from=2`, { notIntercept:true });
}else{
wx.navigateTo({
url: 'pages/Login/Login'
})
}
return
}
const { const {
item item
} = e.currentTarget.dataset } = e.currentTarget.dataset
let _para = { const authStatus = await wx.p.router.intercept()
goodsId: item.id, if (authStatus) return
goodsNumber: 1, if (this.data.hasCarOwnerCouponFlag) {
cartType: 4 wx.p.router.go(`/packageMall/pages/getCoupon/getCoupon?discoverGoodsType=2&from=2`, { notIntercept: true });
return
} }
const res = await shopmallApi.addShoppingcart(_para)
if (res) { let _para = {
wx.p.wxApi.showToast('添加成功') goodsList: {
this.getBuyCarList() ...item,
goodsNumber: 1
},
isCarOwner: true,
showAddr: item.deliveryType == 1 ? 0 : 1,
buyType: 'pay',
discoverGoodsSource: item.discoverGoodsSource,
deliveryType:item.deliveryType == 1 ? 0 : 1
} }
console.log(_para);
wx.p.router.go('/packageDiscovery/pages/pay/index', _para)
// const res = await shopmallApi.addShoppingcart(_para)
// if (res) {
// wx.p.wxApi.showToast('添加成功')
// this.getBuyCarList()
// }
}, },
getCarOwnerCouponList(){ getCarOwnerCouponList() {
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
couponsApi.getMerchantCouponsListApi({merchantId, discoverGoodsType: 2}).then(res => { couponsApi.getMerchantCouponsListApi({ merchantId, discoverGoodsType: 2 }).then(res => {
if(res?.length){ if (res?.length) {
this.setData({ this.setData({
hasCarOwnerCouponFlag: !!res?.length hasCarOwnerCouponFlag: !!res?.length
}) })
} }
}) })
}, },
onShow(){ onShow() {
this.getBuyCarList() this.getBuyCarList()
}, },
init () { init() {
this.getCategoryList() this.getCategoryList()
const B_userInfo = wx.p.storage.get('userInfo') const B_userInfo = wx.p.storage.get('userInfo')
if(B_userInfo && B_userInfo.userType)return if (B_userInfo && B_userInfo.userType) return
this.getBuyCarList() this.getBuyCarList()
this.getCarOwnerCouponList() this.getCarOwnerCouponList()
} }
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
// this.init() // this.init()
} }
} }
}) })
<view> <view>
<view class="category_wrapper"> <view class="category_wrapper">
<view class="inner"> <view class="inner">
<scroll-view scroll-into-view="{{toSeri}}" class="scroll" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-x="{{true}}" scroll-with-animation> <scroll-view scroll-into-view="{{toSeri}}" class="scroll" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-x="{{true}}" scroll-with-animation>
<block wx:for="{{categoryList}}" wx:key="index"> <block wx:for="{{categoryList}}" wx:key="index">
...@@ -19,55 +19,64 @@ ...@@ -19,55 +19,64 @@
<view wx:if="{{categoryStyle>-1}}" class="{{ categoryStyle=='2' ? 'goods_ctnr_waterfall': categoryStyle=='3' ? 'goods_ctnr_grass_B' : categoryStyle=='1' ? 'goods_ctnr_row' : 'goods_ctnr_col' }}"> <view wx:if="{{categoryStyle>-1}}" class="{{ categoryStyle=='2' ? 'goods_ctnr_waterfall': categoryStyle=='3' ? 'goods_ctnr_grass_B' : categoryStyle=='1' ? 'goods_ctnr_row' : 'goods_ctnr_col' }}">
<view wx:if="{{categoryStyle==0 || categoryStyle==1}}" class="goods_wrap"> <view wx:if="{{categoryStyle==0 || categoryStyle==1}}" class="goods_wrap">
<view catch:tap="toGoodsDetail" data-item="{{item}}" class="goods_box" wx:for="{{goodsList}}" wx:key="index"> <view catch:tap="toGoodsDetail" data-item="{{item}}" class="goods_box" wx:for="{{goodsList}}" wx:key="index">
<image mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}"/> <image mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<view class="info {{categoryStyle?'flex_cccb':''}}"> <view class="info {{categoryStyle?'flex_cccb':''}}">
<text class="name">{{item.goodsName}}</text> <text class="name">{{item.goodsName}}</text>
<block wx:if="{{categoryStyle}}"> <!-- <block wx:if="{{categoryStyle}}">
<text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text>
</block> </block> -->
<view class="price_wrap"> <view class="price_wrap">
<text> <text>
<text class="unit">¥</text> <text class="unit">¥</text>
<text class="new_price">{{item.activityPrice}}</text> <text class="new_price">{{item.activityPrice}}</text>
<text class="old_price">{{item.originalPrice}}</text> <text class="old_price">{{item.originalPrice}}</text>
</text> </text>
<glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_13_0/add_buyCar_icon.png"></glsx-image> <!-- <glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_13_0/add_buyCar_icon.png"></glsx-image> -->
<view wx:if="{{categoryStyle==1}}" catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn flex_cc">
立即抢购
</view>
</view> </view>
<block wx:if="{{!categoryStyle}}"> <!-- <block wx:if="{{!categoryStyle}}">
<text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text>
</block> </block> -->
</view> </view>
</view> </view>
</view> </view>
<!-- 种草 -->
<view wx:elif="{{categoryStyle==3}}" class="goods_wrap"> <view wx:elif="{{categoryStyle==3}}" class="goods_wrap">
<view catch:tap="toGoodsDetail" data-item="{{item}}" wx:for="{{goodsList}}" wx:key="index"> <view catch:tap="toGoodsDetail" data-item="{{item}}" wx:for="{{goodsList}}" wx:key="index">
<image wx:if="{{item.styleBImg}}" mode="aspectFill" class="publicity-img" src="{{item.styleBImg}}"/> <image wx:if="{{item.styleBImg}}" mode="aspectFill" class="publicity-img" src="{{item.styleBImg}}" />
<view class="goods_box"> <view class="goods_box">
<video show-fullscreen-btn="{{false}}" show-play-btn="{{false}}" wx:if="{{curPlayIdx==index && (item.commerceVideo || item.goodsVideo)}}" loop id="video{{index}}" muted="{{false}}" autoplay class="cover" src="{{item.commerceVideo || item.goodsVideo}}"></video> <video show-fullscreen-btn="{{false}}" show-play-btn="{{false}}" wx:if="{{curPlayIdx==index && (item.commerceVideo || item.goodsVideo)}}" loop id="video{{index}}" muted="{{false}}" autoplay class="cover" src="{{item.commerceVideo || item.goodsVideo}}"></video>
<image wx:else mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}"/> <image wx:else mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<view class="info {{categoryStyle?'flex_cccb':''}}"> <view class="info {{categoryStyle?'flex_cccb':''}}">
<text class="name">{{item.goodsName}}</text> <text class="name">{{item.goodsName}}</text>
<text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> <!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> -->
<view class="price_wrap"> <view class="price_wrap">
<text> <text>
<text class="price_tip">到手价</text>
<text class="unit">¥</text> <text class="unit">¥</text>
<text class="new_price">{{item.activityPrice}}</text> <text class="new_price">{{item.activityPrice}}</text>
<text class="old_price">{{item.originalPrice}}</text> <text class="old_price">{{item.originalPrice}}</text>
</text> </text>
<glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_0_0/add_buyCar_icon.png"></glsx-image> <!-- <glsx-image catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn" webp src="discover/version/1_0_0/add_buyCar_icon.png"></glsx-image> -->
<view catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn flex_cc">
立即抢购
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 横排 -->
<block wx:else> <block wx:else>
<view class="{{parentIndex==0 ? 'left-box' : 'right-box'}}" wx:for-item="parentItem" wx:for-index="parentIndex" wx:for="{{['leftList','rightList']}}" wx:key="index"> <view class="{{parentIndex==0 ? 'left-box' : 'right-box'}}" wx:for-item="parentItem" wx:for-index="parentIndex" wx:for="{{['leftList','rightList']}}" wx:key="index">
<block wx:for="{{goodsList}}" wx:key="index"> <block wx:for="{{goodsList}}" wx:key="index">
<view catch:tap="toGoodsDetail" data-item="{{item}}" wx:if="{{index%2 == parentIndex}}" class="goods_box"> <view catch:tap="toGoodsDetail" data-item="{{item}}" wx:if="{{index%2 == parentIndex}}" class="goods_box">
<image mode="widthFix" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}"/> <image mode="widthFix" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<view class="info"> <view class="info">
<text class="name">{{item.goodsName}}</text> <text class="name">{{item.goodsName}}</text>
<text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> <!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> -->
<view class="price_wrap"> <view class="price_wrap">
<text> <text>
<text class="unit">¥</text> <text class="unit">¥</text>
...@@ -76,7 +85,7 @@ ...@@ -76,7 +85,7 @@
</text> </text>
</view> </view>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
</block> </block>
......
...@@ -23,7 +23,6 @@ Page({ ...@@ -23,7 +23,6 @@ Page({
}, },
getDiscoverInfo(merchantId, channel) { getDiscoverInfo(merchantId, channel) {
console.log(merchantId,'merchantId');
discoveryApi.getDiscoverConfig({ discoveryApi.getDiscoverConfig({
merchantId merchantId
}).then(res => { }).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!