Commit 3860d1f0 by 前端

Merge branch 'SAAS+v4.33.0' into 'master'

Saas+v4.33.0

See merge request !11
2 parents 9507f9c8 d7df5ff5
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2 let index = 3
/** /**
* *
......
import api from '../request/http' import api from '../request/http'
module.exports = { module.exports = {
// 查询攻略列表 // 查询攻略列表
getStrategyList(data) { getStrategyList(data) {
return api.post({ return api.post({
method: 'scrm.api.shopmall.strategy.list', method: 'scrm.api.shopmall.strategy.list',
...data ...data
}) })
}, },
// 查询攻略详情 // 查询攻略详情
getStrategyDetail(data) { getStrategyDetail(data) {
return api.post({ return api.post({
method: 'scrm.api.shopmall.strategy.detail', method: 'scrm.api.shopmall.strategy.detail',
...data ...data
}) })
}, },
// 查询攻略分类列表
getStrategyCategory(data) {
return api.post({
method: 'scrm.api.shopmall.strategy.category.page',
pageNum:1,
pageSize:99999,
...data
})
},
} }
\ No newline at end of file \ No newline at end of file
import NP from 'number-precision' import NP from 'number-precision'
import USERAPI from "~/api/usersApi/index";
let timer; let timer;
Page({ Page({
...@@ -48,7 +49,7 @@ Page({ ...@@ -48,7 +49,7 @@ Page({
expressFee, expressFee,
goodsNumber, goodsNumber,
discoverGoodsSource discoverGoodsSource
},async () => { }, async () => {
await this.getMoney(obj.goodsList) await this.getMoney(obj.goodsList)
this.getCouponList(this.ids) this.getCouponList(this.ids)
}) })
...@@ -57,9 +58,9 @@ Page({ ...@@ -57,9 +58,9 @@ Page({
el.isPay = false el.isPay = false
ids.push(el.goodsId) ids.push(el.goodsId)
if (el.expressFee && el.expressFee > expressFee) { if (el.expressFee && el.expressFee > expressFee) {
if(obj.pageForm!='goodsDetail'){ if (obj.pageForm != 'goodsDetail') {
expressFee = NP.divide(el.expressFee,100) expressFee = NP.divide(el.expressFee, 100)
}else{ } else {
expressFee = el.expressFee expressFee = el.expressFee
} }
} }
...@@ -75,8 +76,8 @@ Page({ ...@@ -75,8 +76,8 @@ Page({
goodsNumber, goodsNumber,
buyType, buyType,
discoverGoodsSource discoverGoodsSource
},async () => { }, async () => {
await this.getCarOwnerMoney(goodsList) await this.getCarOwnerMoney(goodsList)
this.getCouponList(ids) this.getCouponList(ids)
}) })
} }
...@@ -108,7 +109,7 @@ Page({ ...@@ -108,7 +109,7 @@ Page({
}, },
confirmCoupon(e) { confirmCoupon(e) {
let couponInfo, orderCouponDTO,isHaveCoupons = false; let couponInfo, orderCouponDTO, isHaveCoupons = false;
let { let {
goodsList, goodsList,
deliveryType deliveryType
...@@ -166,7 +167,7 @@ Page({ ...@@ -166,7 +167,7 @@ Page({
data, data,
message message
}) => { }) => {
let {sum} = this.data let { sum } = this.data
let list = let list =
data && data &&
data.map(item => { data.map(item => {
...@@ -175,12 +176,12 @@ Page({ ...@@ -175,12 +176,12 @@ Page({
item.effectiveStartTime = new Date(item.effectiveStartTime).format('yyyy.MM.dd') item.effectiveStartTime = new Date(item.effectiveStartTime).format('yyyy.MM.dd')
} }
item.userDisable = false item.userDisable = false
if(sum&&(item.denomination>NP.times(sum,100))){ if (sum && (item.denomination > NP.times(sum, 100))) {
item.userDisable = true item.userDisable = true
} }
return item return item
}) })
list = list || [] list = list || []
this.setData({ this.setData({
couponData: list, couponData: list,
isCoupon: list.length > 0 ? true : false isCoupon: list.length > 0 ? true : false
...@@ -192,11 +193,11 @@ Page({ ...@@ -192,11 +193,11 @@ Page({
let { let {
couponInfo, couponInfo,
isHaveCoupons isHaveCoupons
} = this.data,couponCost = 0 } = this.data, couponCost = 0
// paymentType=1 -全款,价格就取活动价字段:activityPrice // paymentType=1 -全款,价格就取活动价字段:activityPrice
// paymentType=2 -定金+尾款,定金字段:depositPrice,尾款 :retainagePrice // paymentType=2 -定金+尾款,定金字段:depositPrice,尾款 :retainagePrice
let sum = NP.times(goodsList.activityPrice, goodsList.goodsNumber) //总价 let sum = NP.times(goodsList.activityPrice, goodsList.goodsNumber) //总价
if(isHaveCoupons){ if (isHaveCoupons) {
couponCost = couponInfo && couponInfo.denomination ? Number(couponInfo.denomination / 100) : 0 couponCost = couponInfo && couponInfo.denomination ? Number(couponInfo.denomination / 100) : 0
} }
let money = NP.minus(sum, couponCost) //合计 let money = NP.minus(sum, couponCost) //合计
...@@ -213,13 +214,13 @@ Page({ ...@@ -213,13 +214,13 @@ Page({
}, },
getCarOwnerMoney(goodsList) { getCarOwnerMoney(goodsList) {
if (!goodsList || !goodsList.length) return if (!goodsList || !goodsList.length) return
let sum = 0, couponCost = 0, { couponInfo, expressFee,isHaveCoupons } = this.data let sum = 0, couponCost = 0, { couponInfo, expressFee, isHaveCoupons } = this.data
goodsList.forEach(el => { goodsList.forEach(el => {
sum = NP.plus(sum, NP.times(el.activityPrice, el.goodsNumber)) //总价 sum = NP.plus(sum, NP.times(el.activityPrice, el.goodsNumber)) //总价
}) })
if(isHaveCoupons){ if (isHaveCoupons) {
couponCost = couponInfo && couponInfo.denomination ? Number(couponInfo.denomination / 100) : 0 couponCost = couponInfo && couponInfo.denomination ? Number(couponInfo.denomination / 100) : 0
if(couponCost>sum){ if (couponCost > sum) {
couponCost = 0 couponCost = 0
} }
} }
...@@ -316,7 +317,7 @@ Page({ ...@@ -316,7 +317,7 @@ Page({
if (deliveryType == 1) { if (deliveryType == 1) {
this.setData({ this.setData({
'goodsList.goodsNumber': count 'goodsList.goodsNumber': count
},async ()=>{ }, async () => {
if (this.data.goodsList.paymentType == 2) this.filterCoupon(this.data.goodsList) if (this.data.goodsList.paymentType == 2) this.filterCoupon(this.data.goodsList)
await this.getMoney(goodsList) await this.getMoney(goodsList)
}) })
...@@ -325,7 +326,7 @@ Page({ ...@@ -325,7 +326,7 @@ Page({
this.setData({ this.setData({
[name]: count, [name]: count,
goodsNumber: count goodsNumber: count
},async () => { }, async () => {
await this.getCarOwnerMoney(this.data.goodsList) await this.getCarOwnerMoney(this.data.goodsList)
this.judgeCoupons() this.judgeCoupons()
}) })
...@@ -395,13 +396,13 @@ Page({ ...@@ -395,13 +396,13 @@ Page({
orderGoodsList, orderGoodsList,
orderSource, orderSource,
orderCouponDTO, orderCouponDTO,
contactAddress:contactInfo.contactAddress || ' ', contactAddress: contactInfo.contactAddress || ' ',
contactName: contactInfo.contactName || ' ', contactName: contactInfo.contactName || ' ',
contactPhone: contactInfo.contactPhone, contactPhone: contactInfo.contactPhone,
userName: contactInfo.contactName || ' ', userName: contactInfo.contactName || ' ',
userPhone: contactInfo.contactPhone userPhone: contactInfo.contactPhone
} }
if(deliveryType==0){ if (deliveryType == 0) {
query.userName = this.data.userInfo.nickName || this.data.userInfo.phone query.userName = this.data.userInfo.nickName || this.data.userInfo.phone
query.userPhone = this.data.userInfo.phone query.userPhone = this.data.userInfo.phone
} }
...@@ -417,20 +418,20 @@ Page({ ...@@ -417,20 +418,20 @@ Page({
return return
} }
// paymentType:(1全款;2定金+尾款) // paymentType:(1全款;2定金+尾款)
if (goodsList.paymentType == 2 || discoverGoodsSource==2) { if (goodsList.paymentType == 2 || discoverGoodsSource == 2) {
this.pay(data.orderCode) this.pay(data.orderCode)
} else { } else {
let subOrderCode = data.subOrderDTOS[0].subOrderCode let subOrderCode = data.subOrderDTOS[0].subOrderCode
this.jumpMiniToPay(deliveryType == 1 ? subOrderCode : data.orderCode, deliveryType, query, ids) this.jumpMiniToPay(deliveryType == 1 ? subOrderCode : data.orderCode, deliveryType, query, ids)
if (deliveryType == 0&&buyType!='pay') this.removeCar(ids) if (deliveryType == 0 && buyType != 'pay') this.removeCar(ids)
} }
}) })
}, },
// 跳转小程序支付 //银盛支付下单 // 跳转小程序支付 //银盛支付下单
jumpMiniToPay(orderCode,deliveryType, query, ids) { jumpMiniToPay(orderCode, deliveryType, query, ids) {
// 支付成功后需求跳转的路径 // 支付成功后需求跳转的路径
const PATH = deliveryType==0?'packageDiscovery/pages/PayResult/payResult':'packageMine/pages/order/index/index' const PATH = deliveryType == 0 ? 'packageDiscovery/pages/PayResult/payResult' : 'packageMine/pages/order/index/index'
console.log(PATH); console.log(PATH);
const PATHQUERY = `&query=${JSON.stringify(query)}&ids=${JSON.stringify(ids)}&buyType=${this.data.buyType}` const PATHQUERY = `&query=${JSON.stringify(query)}&ids=${JSON.stringify(ids)}&buyType=${this.data.buyType}`
wx.hideLoading() wx.hideLoading()
...@@ -466,6 +467,7 @@ Page({ ...@@ -466,6 +467,7 @@ Page({
...params, ...params,
success(res) { success(res) {
_this.requestSubscribeMessage() _this.requestSubscribeMessage()
_this.handleTrackQuery(orderCode,payParams.timeStamp)
}, },
fail(res) { fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') { if (res.errMsg == 'requestPayment:fail cancel') {
...@@ -530,11 +532,11 @@ Page({ ...@@ -530,11 +532,11 @@ Page({
return item return item
} }
}) })
if(data.length == 0){ if (data.length == 0) {
couponData.forEach(item=>item.isChecked = false) couponData.forEach(item => item.isChecked = false)
} }
this.setData({ this.setData({
couponData:couponData, couponData: couponData,
isCoupon: data.length == 0 ? false : true, isCoupon: data.length == 0 ? false : true,
couponInfo: data.length == 0 ? '' : couponInfo, couponInfo: data.length == 0 ? '' : couponInfo,
}) })
...@@ -566,11 +568,11 @@ Page({ ...@@ -566,11 +568,11 @@ Page({
.then(data => { }) .then(data => { })
}, },
// 切换数量时再次判断优惠券是否能用 // 切换数量时再次判断优惠券是否能用
judgeCoupons(){ judgeCoupons() {
let {couponData,sum,couponInfo,orderCouponDTO} = this.data let { couponData, sum, couponInfo, orderCouponDTO } = this.data
couponData.forEach(item => { couponData.forEach(item => {
item.userDisable = false item.userDisable = false
if(couponInfo&&couponInfo.id===item.id){ if (couponInfo && couponInfo.id === item.id) {
item.isChecked = true item.isChecked = true
orderCouponDTO = { orderCouponDTO = {
goodIds: this.ids, goodIds: this.ids,
...@@ -578,7 +580,7 @@ Page({ ...@@ -578,7 +580,7 @@ Page({
denomination: item.denomination denomination: item.denomination
} }
} }
if(sum&&(item.denomination>NP.times(sum,100))){ if (sum && (item.denomination > NP.times(sum, 100))) {
item.userDisable = true item.userDisable = true
orderCouponDTO = {} orderCouponDTO = {}
} }
...@@ -587,5 +589,72 @@ Page({ ...@@ -587,5 +589,72 @@ Page({
couponData, couponData,
orderCouponDTO orderCouponDTO
}) })
} },
// 处理埋点的参数
handleTrackQuery(orderCode,timeStamp){
const { goodsList, couponCost } = this.data
const query = {
item_type: 1,
view: 3,
}
this.orderCode = orderCode
this.orderTime = Number(timeStamp)
this.pay_time = new Date().getTime()
goodsList.forEach(el => {
query.id = el.id
query.trade_name = el.goodsName
query.trade_classification = el.associationClassifyFirstName || ''
if (el.paymentType == 1) {
query.order_total_price = NP.times(el.activityPrice, el.goodsNumber)
if (el.expressFee) {
query.order_total_price = NP.plus(query.order_total_price,el.expressFee)
}
}
query.trade_pay_price = query.order_total_price
if (couponCost) {
query.trade_pay_price = NP.minus(query.order_total_price, couponCost)
}
this.addTrack(query)
})
},
async addTrack(query) {
const {
id,
item_type,
view
} = query
const userInfo = wx.p.cache.userInfo.getUserInfo() || {},
{
openId
} = await USERAPI.getWXUserInfo()
const {
merchantId
} = wx.p.storage.get('merchant_info')
let data = {
open_id: openId || null,
item_type,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 104,
merchant_id: merchantId,
customer_name: userInfo.nickName || null,
master_order_no: this.orderCode,
sub_order_no: this.orderCode,
order_time: new Date(this.orderTime).format('yyyy-MM-dd hh:mm:ss'),
order_total_price: query.order_total_price || 0,
pay_method: "微信支付",
pay_time: new Date(this.pay_time).format('yyyy-MM-dd hh:mm:ss') || '',
status: '已支付',
trade_pay_price: query.trade_pay_price || 0,
trade_name: query.trade_name || '',
trade_classification: query.trade_classification || '',
association_classify_first_name:query.trade_classification || ''
}
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
})
},
}) })
\ No newline at end of file \ No newline at end of file
...@@ -61,7 +61,9 @@ Page({ ...@@ -61,7 +61,9 @@ Page({
add_way: 104, add_way: 104,
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 || '',
association_classify_first_name:this.data?.goodsInfo?.associationClassifyFirstName || '',
trade_classification:this.data?.goodsInfo?.associationClassifyFirstName || ''
} }
this.firstEnter = false this.firstEnter = false
const jsonList = [JSON.stringify(data)] const jsonList = [JSON.stringify(data)]
...@@ -280,7 +282,8 @@ Page({ ...@@ -280,7 +282,8 @@ Page({
id: goodsInfo.id, id: goodsInfo.id,
activityPrice: goodsInfo.activityPrice, activityPrice: goodsInfo.activityPrice,
paymentType: goodsInfo.paymentType, paymentType: goodsInfo.paymentType,
merchantId: goodsInfo.merchantId merchantId: goodsInfo.merchantId,
associationClassifyFirstName:goodsInfo.associationClassifyFirstName
} }
if (activeSku) { if (activeSku) {
let list = isActivity ? goodsInfo.specificationExtraList : goodsInfo.specificationDetailList let list = isActivity ? goodsInfo.specificationExtraList : goodsInfo.specificationDetailList
...@@ -353,11 +356,8 @@ Page({ ...@@ -353,11 +356,8 @@ Page({
} }
wx.p.api.shopmallApi.addShoppingcart(params).then(data => { wx.p.api.shopmallApi.addShoppingcart(params).then(data => {
wx.p.wxApi.showToast('添加成功!在购物车等亲~') wx.p.wxApi.showToast('添加成功!在购物车等亲~')
wx.p.$Track.setTrack({ this.trackQuery.view = 7
...data this.addTrack(this.trackQuery)
},
7
)
}) })
}, },
back() { back() {
...@@ -649,7 +649,7 @@ Page({ ...@@ -649,7 +649,7 @@ Page({
data.activityPrice = this.formatMyPrice(data.activityPrice) data.activityPrice = this.formatMyPrice(data.activityPrice)
if ((this.isUpgrade || this.isCarOwner) && !data.goodsDetailImageList.length) { if ((this.isUpgrade || this.isCarOwner) && !data.goodsDetailImageList.length) {
data.goodsDetailImageList.push({content:data.goodsImage,resType:1}) data.goodsDetailImageList.push({ content: data.goodsImage, resType: 1 })
} }
this.setData({ this.setData({
goodsInfo: data, goodsInfo: data,
......
// packageMall/pages/pay/pay.js import NP from 'number-precision'
import USERAPI from "~/api/usersApi/index";
let timer let timer
Page({ Page({
/** /**
...@@ -20,8 +21,8 @@ Page({ ...@@ -20,8 +21,8 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.p.router.getData(obj => { wx.p.router.getData(obj => {
if(obj.platformShop){ if (obj.platformShop) {
this.platformShop= Boolean(obj.platformShop) this.platformShop = Boolean(obj.platformShop)
} }
if (obj.isPay) { if (obj.isPay) {
//单个商品进来 //单个商品进来
...@@ -53,9 +54,9 @@ Page({ ...@@ -53,9 +54,9 @@ Page({
} else { } else {
//购物车过来 //购物车过来
let orderGoods = [] let orderGoods = []
if(obj.platformShop){ if (obj.platformShop) {
this.getPlatFormAddress() this.getPlatFormAddress()
}else{ } else {
this.getUserAddressDefault() this.getUserAddressDefault()
} }
obj.goodsList.map(e => { obj.goodsList.map(e => {
...@@ -222,8 +223,8 @@ Page({ ...@@ -222,8 +223,8 @@ Page({
}, },
checkOut() { checkOut() {
/**平台商城支付 */ /**平台商城支付 */
if(this.platformShop){ if (this.platformShop) {
this.toPayPlatformGoods() this.toPayPlatformGoods()
return return
} }
/**购物车 */ /**购物车 */
...@@ -330,7 +331,7 @@ Page({ ...@@ -330,7 +331,7 @@ Page({
jump() { jump() {
wx.p.router.go('/packageMine/pages/address/index/index', { wx.p.router.go('/packageMine/pages/address/index/index', {
isChooseAddress: true, isChooseAddress: true,
platform:this.data.platformShop platform: this.data.platformShop
}) })
}, },
pay(orderCode) { pay(orderCode) {
...@@ -378,10 +379,11 @@ Page({ ...@@ -378,10 +379,11 @@ Page({
wx.p.storage.rm('shareStaffTracker') wx.p.storage.rm('shareStaffTracker')
} }
wx.p.storage.rm('shareStaff') wx.p.storage.rm('shareStaff')
_this.handleTrackQuery(orderCode, payParams.timeStamp)
}, },
fail(res) { fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') { if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.router.back(() => {}, isPay ? 1 : 2) wx.p.router.back(() => { }, isPay ? 1 : 2)
} else { } else {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', { wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
params params
...@@ -420,7 +422,7 @@ Page({ ...@@ -420,7 +422,7 @@ Page({
}) })
}, },
getUserAddressList() { getUserAddressList() {
if(this.platformShop){ if (this.platformShop) {
return return
} }
wx.p.api.mineApi.getUserAddressList().then(data => { wx.p.api.mineApi.getUserAddressList().then(data => {
...@@ -456,103 +458,103 @@ Page({ ...@@ -456,103 +458,103 @@ Page({
showSuccessModal: false showSuccessModal: false
}) })
}, },
// 平台商城--获取默认的地址 // 平台商城--获取默认的地址
getPlatFormAddress() { getPlatFormAddress() {
wx.p.api.shopmallApi.platformAddressList().then(data => { wx.p.api.shopmallApi.platformAddressList().then(data => {
let contactAddress = '',defaultAddress = {} let contactAddress = '', defaultAddress = {}
if(data){ if (data) {
data.forEach(el=>{ data.forEach(el => {
if(el.isDefault==1){ if (el.isDefault == 1) {
contactAddress = el.provinceName+el.cityName+el.countyName+el.address, contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
defaultAddress = el defaultAddress = el
} }
}) })
} }
this.setData({ this.setData({
contactInfo:{ contactInfo: {
contactAddress, contactAddress,
contactName:defaultAddress.receiveName, contactName: defaultAddress.receiveName,
contactPhone:defaultAddress.receiveMobile contactPhone: defaultAddress.receiveMobile
}, },
isDefault:defaultAddress.isDefault, isDefault: defaultAddress.isDefault,
addressFlag:true, addressFlag: true,
defaultAddress defaultAddress
}) })
}) })
}, },
// 平台商城--支付 // 平台商城--支付
toPayPlatformGoods(){ toPayPlatformGoods() {
const userInfo = wx.p.cache.userInfo.getUserInfo() const userInfo = wx.p.cache.userInfo.getUserInfo()
const {defaultAddress,goodsList} = this.data const { defaultAddress, goodsList } = this.data
let _orderGoodsList = [],_ids = [] let _orderGoodsList = [], _ids = []
goodsList.forEach(el=>{ goodsList.forEach(el => {
let temp = { let temp = {
goodsSkuCode:el.goodsSkuCode, goodsSkuCode: el.goodsSkuCode,
goodsSkuName:el.goodsName, goodsSkuName: el.goodsName,
sellQty:el.goodsNumber, sellQty: el.goodsNumber,
}
_ids.push(el.id)
_orderGoodsList.push(temp)
})
if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址')
}
const params = {
receiveName: defaultAddress.receiveName,
receiveMobile: defaultAddress.receiveMobile,
provinceId: defaultAddress.provinceId,
provinceName: defaultAddress.provinceName,
cityId: defaultAddress.cityId,
cityName: defaultAddress.cityName,
countyId: defaultAddress.countyId,
countyName: defaultAddress.countyName,
address: defaultAddress.address,
customerOpenId: userInfo.openId,
buyerMsg: '',
orderGoodsList: _orderGoodsList,
} }
wx.p.wxApi.showLoading('结算中...') _ids.push(el.id)
wx.p.api.shopmallApi.platformGoodsCreateOrder(params).then(res => { _orderGoodsList.push(temp)
clearTimeout(timer) })
timer = setTimeout(() => { if (!defaultAddress.receiveName) {
wx.p.api.shopmallApi return wx.p.wxApi.showToast('请选择收货地址')
.platformRemoveShopCarGoods({ids:_ids}) }
.then(data => { const params = {
if (res) this.toPayOrder(res.orderCode) receiveName: defaultAddress.receiveName,
}) receiveMobile: defaultAddress.receiveMobile,
}, 500) provinceId: defaultAddress.provinceId,
}) provinceName: defaultAddress.provinceName,
cityId: defaultAddress.cityId,
cityName: defaultAddress.cityName,
countyId: defaultAddress.countyId,
countyName: defaultAddress.countyName,
address: defaultAddress.address,
customerOpenId: userInfo.openId,
buyerMsg: '',
orderGoodsList: _orderGoodsList,
}
wx.p.wxApi.showLoading('结算中...')
wx.p.api.shopmallApi.platformGoodsCreateOrder(params).then(res => {
clearTimeout(timer)
timer = setTimeout(() => {
wx.p.api.shopmallApi
.platformRemoveShopCarGoods({ ids: _ids })
.then(data => {
if (res) this.toPayOrder(res.orderCode)
})
}, 500)
})
}, },
toPayOrder(orderCode) { toPayOrder(orderCode) {
wx.p.api.shopmallApi.platformGoodsPayOrder({ orderCode, paymentSource: 1 }).then(res => { wx.p.api.shopmallApi.platformGoodsPayOrder({ orderCode, paymentSource: 1 }).then(res => {
wx.hideLoading(); wx.hideLoading();
if (res) { if (res) {
const {timeStamp,nonceStr,packages,signType,paySign} = res.payParams const { timeStamp, nonceStr, packages, signType, paySign } = res.payParams
wx.requestPayment({ wx.requestPayment({
timeStamp: timeStamp, timeStamp: timeStamp,
nonceStr: nonceStr, nonceStr: nonceStr,
package: packages, package: packages,
signType: signType, signType: signType,
paySign: paySign, paySign: paySign,
success() { success() {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', { wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
success: true success: true
}) })
}, },
fail(res) { fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') { if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.wxApi.showToast('取消支付') wx.p.wxApi.showToast('取消支付')
}
} }
}) }
} })
}
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {}, onReady: function () { },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -564,20 +566,82 @@ Page({ ...@@ -564,20 +566,82 @@ Page({
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () {}, onHide: function () { },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () {}, onUnload: function () { },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () {}, onPullDownRefresh: function () { },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () {} onReachBottom: function () { },
// 处理埋点的参数
handleTrackQuery(orderCode, timeStamp) {
const { goodsList } = this.data
const query = {
item_type: 1,
view: 3,
}
this.orderCode = orderCode
this.orderTime = Number(timeStamp)
this.pay_time = new Date().getTime()
goodsList.forEach(el => {
query.id = el.id
query.trade_name = el.goodsName
query.trade_classification = el.associationClassifyFirstName || ''
query.order_total_price = NP.times(el.activityPrice, el.goodsNumber)
if (el.expressFee) {
query.order_total_price = NP.plus(query.order_total_price, el.expressFee)
}
query.trade_pay_price = query.order_total_price
this.addTrack(query)
})
},
async addTrack(query) {
const {
id,
item_type,
view
} = query
const userInfo = wx.p.cache.userInfo.getUserInfo() || {},
{
openId
} = await USERAPI.getWXUserInfo()
const {
merchantId
} = wx.p.storage.get('merchant_info')
let data = {
open_id: openId || null,
item_type,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 104,
merchant_id: merchantId,
customer_name: userInfo.nickName || null,
master_order_no: this.orderCode,
sub_order_no: this.orderCode,
order_time: new Date(this.orderTime).format('yyyy-MM-dd hh:mm:ss'),
order_total_price: query.order_total_price || 0,
pay_method: "微信支付",
pay_time: new Date(this.pay_time).format('yyyy-MM-dd hh:mm:ss') || '',
status: '已支付',
trade_pay_price: query.trade_pay_price || 0,
trade_name: query.trade_name || '',
trade_classification: query.trade_classification || '',
association_classify_first_name:query.trade_classification || ''
}
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
})
},
}) })
// packageMine/pages/order/index/index.js import USERAPI from "~/api/usersApi/index";
import { import {
orderMixin orderMixin
} from '~/mixins/index' } from '~/mixins/index'
...@@ -276,6 +276,7 @@ Page({ ...@@ -276,6 +276,7 @@ Page({
_this.clearData() _this.clearData()
}, 1.5e3) }, 1.5e3)
_this.requestSubscribeMessage() _this.requestSubscribeMessage()
_this.handleTrackQuery(e.currentTarget.dataset, payParams.timeStamp)
}, },
fail(res) { fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') { if (res.errMsg == 'requestPayment:fail cancel') {
...@@ -446,5 +447,66 @@ Page({ ...@@ -446,5 +447,66 @@ Page({
orderCode, orderCode,
type: 2, type: 2,
}) })
} },
// 处理埋点的参数
handleTrackQuery(orderCode, timeStamp) {
const { list } = this.data
const _temp = list.filter(item => item.orderCode == orderCode)
const orderItem = _temp[0]
const query = {
item_type: 1,
view: 3,
}
this.orderCode = orderCode
this.orderTime = Number(timeStamp)
this.pay_time = new Date().getTime()
orderItem.orderGoods.forEach(el => {
query.id = el.id
query.trade_name = el.goodsName
query.trade_classification = el.associationClassifyFirstName || ''
query.order_total_price = NP.times(el.retailPrice, el.goodsNumber)
query.trade_pay_price = query.order_total_price
this.addTrack(query)
})
},
async addTrack(query) {
const {
id,
item_type,
view
} = query
const userInfo = wx.p.cache.userInfo.getUserInfo() || {},
{
openId
} = await USERAPI.getWXUserInfo()
const {
merchantId
} = wx.p.storage.get('merchant_info')
let data = {
open_id: openId || null,
item_type,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 104,
merchant_id: merchantId,
customer_name: userInfo.nickName || null,
master_order_no: this.orderCode,
sub_order_no: this.orderCode,
order_time: new Date(this.orderTime).format('yyyy-MM-dd hh:mm:ss'),
order_total_price: query.order_total_price || 0,
pay_method: "微信支付",
pay_time: new Date(this.pay_time).format('yyyy-MM-dd hh:mm:ss') || '',
status: '已支付',
trade_pay_price: query.trade_pay_price || 0,
trade_name: query.trade_name || '',
trade_classification: query.trade_classification || '',
association_classify_first_name:query.trade_classification || ''
}
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
})
},
}) })
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '~/config'; import { IMG_URL } from '~/config';
import USERAPI from "~/api/usersApi/index";
Page({ Page({
data: { data: {
IMGURL: IMG_URL, IMGURL: IMG_URL,
...@@ -7,26 +8,26 @@ Page({ ...@@ -7,26 +8,26 @@ Page({
isOpen: false, isOpen: false,
selectedItem: null, selectedItem: null,
listData: [], listData: [],
isGameUse:false, isGameUse: false,
coupons:null, coupons: null,
showCoupons:false, showCoupons: false,
}, },
// 获取当前商品绑定的优惠券并且处理价格 // 获取当前商品绑定的优惠券并且处理价格
getCouponsItem(e){ getCouponsItem(e) {
const couponsItem = e.detail const couponsItem = e.detail
let {selectedItem} = this.data let { selectedItem } = this.data
selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice-(Number(couponsItem.denomination)), 2) selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({ this.setData({
selectedItem, selectedItem,
coupons:couponsItem coupons: couponsItem
}) })
}, },
toSelectCoupons(){ toSelectCoupons() {
const isLogin = this.checkLogin() const isLogin = this.checkLogin()
if (!isLogin) { if (!isLogin) {
return return
} }
if(this.data.isGH)return if (this.data.isGH) return
this.setData({ this.setData({
showCoupons: true showCoupons: true
}) })
...@@ -37,11 +38,11 @@ Page({ ...@@ -37,11 +38,11 @@ Page({
}) })
}, },
changeMumberType(e) { changeMumberType(e) {
let { selectedItem, listData,coupons } = this.data let { selectedItem, listData, coupons } = this.data
const { index } = e.currentTarget.dataset const { index } = e.currentTarget.dataset
selectedItem = listData[index].denominationList[0] selectedItem = listData[index].denominationList[0]
if(coupons){ if (coupons) {
selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice-(Number(coupons.denomination)), 2) selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice - (Number(coupons.denomination)), 2)
} }
this.setData({ curIndex: index, selectedItem, checkedItem: 0 }) this.setData({ curIndex: index, selectedItem, checkedItem: 0 })
}, },
...@@ -52,7 +53,7 @@ Page({ ...@@ -52,7 +53,7 @@ Page({
this.setData({ checkedItem: index, selectedItem: item, richText }) this.setData({ checkedItem: index, selectedItem: item, richText })
}, },
toCheckMember() { toCheckMember() {
if(this.data.isGameUse)return if (this.data.isGameUse) return
const SID = wx.p.cache.storageApi.getSessionId() const SID = wx.p.cache.storageApi.getSessionId()
if (!SID) { if (!SID) {
return return
...@@ -68,30 +69,30 @@ Page({ ...@@ -68,30 +69,30 @@ Page({
wx.p.eventbus.off('EQUITYGOODS') wx.p.eventbus.off('EQUITYGOODS')
}) })
}, },
getChargeDetail(query,options) { getChargeDetail(query, options) {
let para = { let para = {
brandName: query.brandName, brandName: query.brandName,
supplier: query.supplier supplier: query.supplier
} }
if(this.data.isGameUse){ if (this.data.isGameUse) {
para.id = query.id para.id = query.id
} }
wx.p.api.equityApi.chargeData(para).then(res => { wx.p.api.equityApi.chargeData(para).then(res => {
let { selectedItem, curIndex, checkedItem, richText,isGameUse,coupons,isGH } = this.data let { selectedItem, curIndex, checkedItem, richText, isGameUse, coupons, isGH } = this.data
if (!res) { if (!res) {
// wx.redirectTo({ // wx.redirectTo({
// url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1' // url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1'
// }) // })
setTimeout(()=>{ setTimeout(() => {
wx.p.router.back(e =>{ wx.p.router.back(e => {
e.onLoad({showToast:1}) e.onLoad({ showToast: 1 })
}) })
},500) }, 500)
return return
} }
if (res.length) { if (res.length) {
let brandLogo = res[0].brandLogo let brandLogo = res[0].brandLogo
query.icon = query.icon?query.icon:brandLogo query.icon = query.icon ? query.icon : brandLogo
res.forEach(item => { res.forEach(item => {
item.denominationList.map(el => { item.denominationList.map(el => {
if (el.noMemberPrice) { if (el.noMemberPrice) {
...@@ -120,7 +121,7 @@ Page({ ...@@ -120,7 +121,7 @@ Page({
} }
richText = decodeURIComponent(selectedItem.buysNotes) richText = decodeURIComponent(selectedItem.buysNotes)
richText = richText.replace(/\<span/g, '<span class="rich_text"') richText = richText.replace(/\<span/g, '<span class="rich_text"')
if(isGameUse){ if (isGameUse) {
selectedItem.payCouponsPrice = selectedItem.lineationPrice selectedItem.payCouponsPrice = selectedItem.lineationPrice
} }
this.setData({ this.setData({
...@@ -133,9 +134,9 @@ Page({ ...@@ -133,9 +134,9 @@ Page({
showLogin: false, showLogin: false,
isGameUse, isGameUse,
isGH, isGH,
showComponent:true showComponent: true
},()=>{ }, () => {
if(options.source=='GH'){ if (options.source == 'GH') {
this.handleEquityOfGH(options.couponsItem) this.handleEquityOfGH(options.couponsItem)
} }
}) })
...@@ -164,7 +165,7 @@ Page({ ...@@ -164,7 +165,7 @@ Page({
wx.p.wxApi.showToast('请输入充值账号') wx.p.wxApi.showToast('请输入充值账号')
return return
} }
if(this.data.isGameUse)return this.comfirmBuyItem() if (this.data.isGameUse) return this.comfirmBuyItem()
// if(this.data.isGH)return this.toRechargeFill(this.data.rechageNum) // if(this.data.isGH)return this.toRechargeFill(this.data.rechageNum)
const { noMemberPrice, salesPrice } = this.data.selectedItem const { noMemberPrice, salesPrice } = this.data.selectedItem
let diffPrice = 0 let diffPrice = 0
...@@ -196,10 +197,11 @@ Page({ ...@@ -196,10 +197,11 @@ Page({
if (!orderCode) { if (!orderCode) {
return return
} }
this.orderCode = orderCode
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
const { selectedItem, rechageNum,isGameUse,coupons } = this.data const { selectedItem, rechageNum, isGameUse, coupons } = this.data
let para = { let para = {
orderCode, orderCode,
goodsId: selectedItem.id, goodsId: selectedItem.id,
...@@ -209,7 +211,7 @@ Page({ ...@@ -209,7 +211,7 @@ Page({
paySource: 3, paySource: 3,
merchantId merchantId
} }
if(isGameUse&&coupons){ if (isGameUse && coupons) {
para.usedCouponIds = [coupons.id] para.usedCouponIds = [coupons.id]
} }
wx.p.api.equityApi.payGoodsOrder(para).then(res => { wx.p.api.equityApi.payGoodsOrder(para).then(res => {
...@@ -228,21 +230,33 @@ Page({ ...@@ -228,21 +230,33 @@ Page({
signType: signType, signType: signType,
paySign: paySign, paySign: paySign,
success() { success() {
let { query, selectedItem, rechageNum,curIndex,listData } = self.data
// 设置埋点参数
const tracker = {
item_type: 7,
view: 3,
id: selectedItem.id
}
const firstLevel = listData[curIndex]
self.orderTime = Number(timeStamp)
self.order_total_price = selectedItem.salesPrice
self.pay_time = new Date().getTime()
self.trade_name = `${firstLevel.productName}${selectedItem.denomination}`
self.trade_classification = firstLevel.goodsCategory
self.addTrack(tracker)
//跳转商品详情 //跳转商品详情
// wx.p.wxApi.showToast('支付成功')
let { query, selectedItem, rechageNum } = self.data
let obj = { let obj = {
...query, ...query,
...selectedItem, ...selectedItem,
rechageNum, rechageNum,
isGH:self.data.isGH isGH: self.data.isGH
} }
const temp = JSON.stringify(obj) const temp = JSON.stringify(obj)
wx.navigateTo({ wx.navigateTo({
url: '/packageSaveMoney/pages/chargeWait/chargeWait?query=' + temp url: '/packageSaveMoney/pages/chargeWait/chargeWait?query=' + temp
}) })
}, },
fail() {} fail() { }
}) })
}, },
// 设置标题名称 // 设置标题名称
...@@ -252,12 +266,12 @@ Page({ ...@@ -252,12 +266,12 @@ Page({
}) })
}, },
onLoad(options) { onLoad(options) {
this.data.isGameUse = options.inType=='game' this.data.isGameUse = options.inType == 'game'
this.data.isGH = options.source=='GH' this.data.isGH = options.source == 'GH'
const query = options ? options.param : this.data.query const query = options ? options.param : this.data.query
this.getChargeDetail(query,options) this.getChargeDetail(query, options)
this.setNaviTitle(query.brandName) this.setNaviTitle(query.brandName)
if(options.inType=='game')return if (options.inType == 'game') return
wx.p.eventbus.on('EQUITYGOODS', data => { wx.p.eventbus.on('EQUITYGOODS', data => {
this.toCheckMember() this.toCheckMember()
}) })
...@@ -266,12 +280,12 @@ Page({ ...@@ -266,12 +280,12 @@ Page({
this.toCheckMember() this.toCheckMember()
}, },
// 处理广汇权益明细进入的卡券 // 处理广汇权益明细进入的卡券
handleEquityOfGH(couponsItem){ handleEquityOfGH(couponsItem) {
let {selectedItem} = this.data let { selectedItem } = this.data
selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice-(Number(couponsItem.denomination)), 2) selectedItem.payCouponsPrice = wx.p.format.decimal(selectedItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({ this.setData({
selectedItem, selectedItem,
coupons:couponsItem coupons: couponsItem
}) })
}, },
// 检测是否已经登录 // 检测是否已经登录
...@@ -282,7 +296,7 @@ Page({ ...@@ -282,7 +296,7 @@ Page({
flag = false flag = false
this.setData({ this.setData({
showLogin: true, showLogin: true,
showComponent:false showComponent: false
}) })
} }
return flag return flag
...@@ -293,22 +307,70 @@ Page({ ...@@ -293,22 +307,70 @@ Page({
} }
}, },
// 广汇赠送权益直充 // 广汇赠送权益直充
toRechargeFill(phone){ // toRechargeFill(phone) {
wx.p.wxApi.showLoading() // wx.p.wxApi.showLoading()
const {productId,orderCode,productName,discount} = this.data.ghOption // const { productId, orderCode, productName, discount } = this.data.ghOption
wx.p.api.equityApi.toRechargeByPhone({orderCode,phone,productId}).then(res=>{ // wx.p.api.equityApi.toRechargeByPhone({ orderCode, phone, productId }).then(res => {
if(res){ // if (res) {
const obj = { // const obj = {
brandName:productName, // brandName: productName,
rechageNum:phone, // rechageNum: phone,
denomination:discount, // denomination: discount,
isGH:true // isGH: true
} // }
const temp = JSON.stringify(obj) // const temp = JSON.stringify(obj)
wx.navigateTo({ // wx.navigateTo({
url: '/packageSaveMoney/pages/chargeWait/chargeWait?query=' + temp // url: '/packageSaveMoney/pages/chargeWait/chargeWait?query=' + temp
}) // })
} // }
// })
// },
// 2023-12版本 添加权益下单支付成功埋点
/**添加埋点开始 */
/**
* 商品-活动id,
* 物品类型item_type 1 商品 3活动,
* view 动作类型 3下单
* */
async addTrack(query) {
const {
id,
item_type,
view
} = query
const userInfo = wx.p.cache.userInfo.getUserInfo() || {},
{
openId
} = await USERAPI.getWXUserInfo()
const {
merchantId
} = wx.p.storage.get('merchant_info')
let data = {
open_id: openId || null,
item_type,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 103,
merchant_id: merchantId,
customer_name: userInfo.nickName || null,
master_order_no: this.orderCode,
sub_order_no: this.orderCode,
order_time: new Date(this.orderTime).format('yyyy-MM-dd hh:mm:ss'),
order_total_price: this.order_total_price || 0,
pay_method: "微信支付",
pay_time: new Date(this.pay_time).format('yyyy-MM-dd hh:mm:ss') || '',
status: '已支付',
trade_pay_price: this.order_total_price || 0,
trade_name: this.trade_name || '',
trade_classification: this.trade_classification || '',
association_classify_first_name:this.trade_classification || ''
}
this.firstEnter = false
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
}) })
} },
}) })
import { IMG_URL } from '~/config'; import { IMG_URL } from '~/config';
import USERAPI from "~/api/usersApi/index";
Page({ Page({
data: { data: {
IMGURL: IMG_URL, IMGURL: IMG_URL,
...@@ -13,18 +14,17 @@ Page({ ...@@ -13,18 +14,17 @@ Page({
richText: '', richText: '',
showModal: false, showModal: false,
noScroll: wx.p.wxApi.noScroll(), noScroll: wx.p.wxApi.noScroll(),
isGameUse:false, isGameUse: false,
coupons:null, coupons: null,
showCoupons:false, showCoupons: false,
showComponent:false showComponent: false
}, },
onShow: function () { onShow: function () {
this.toCheckMember() this.toCheckMember()
}, },
onLoad: function (options) { onLoad: function (options) {
// console.log(options);
// options = JSON.stringify(options)==='{}'?this.options:options // options = JSON.stringify(options)==='{}'?this.options:options
this.data.isGameUse = options.inType=='game' this.data.isGameUse = options.inType == 'game'
const query = options ? options.param : this.data.query const query = options ? options.param : this.data.query
this.setNaviTitle(query.brandName) this.setNaviTitle(query.brandName)
if (!query.lat) { if (!query.lat) {
...@@ -42,47 +42,47 @@ Page({ ...@@ -42,47 +42,47 @@ Page({
// return // return
// } // }
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
this.toGetCommodity(query,options) this.toGetCommodity(query, options)
this.setData({ this.setData({
// unauthorized, // unauthorized,
showLogin: false, showLogin: false,
query, query,
isGameUse:options.inType=='game', isGameUse: options.inType == 'game',
isGH:options.source=='GH' isGH: options.source == 'GH'
}) })
if(options.inType=='game')return if (options.inType == 'game') return
wx.p.eventbus.on('EQUITYGOODS', data => { wx.p.eventbus.on('EQUITYGOODS', data => {
this.toCheckMember() this.toCheckMember()
}) })
}, },
// 处理广汇权益明细进入的卡券 // 处理广汇权益明细进入的卡券
handleEquityOfGH(couponsItem){ handleEquityOfGH(couponsItem) {
let {curentGoodsItem} = this.data let { curentGoodsItem } = this.data
curentGoodsItem.payCouponsPrice = wx.p.format.decimal(curentGoodsItem.lineationPrice-(Number(couponsItem.denomination)), 2) curentGoodsItem.payCouponsPrice = wx.p.format.decimal(curentGoodsItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({ this.setData({
curentGoodsItem, curentGoodsItem,
coupons:couponsItem coupons: couponsItem
}) })
}, },
// 获取当前商品绑定的优惠券并且处理价格 // 获取当前商品绑定的优惠券并且处理价格
getCouponsItem(e){ getCouponsItem(e) {
const couponsItem = e.detail const couponsItem = e.detail
let {curentGoodsItem} = this.data let { curentGoodsItem } = this.data
curentGoodsItem.payCouponsPrice = wx.p.format.decimal(curentGoodsItem.lineationPrice-(Number(couponsItem.denomination)), 2) curentGoodsItem.payCouponsPrice = wx.p.format.decimal(curentGoodsItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({ this.setData({
curentGoodsItem, curentGoodsItem,
coupons:couponsItem coupons: couponsItem
}) })
}, },
// 选择优惠券 // 选择优惠券
async toSelectCoupons(){ async toSelectCoupons() {
const isLogin = await this.checkLogin() const isLogin = await this.checkLogin()
if (isLogin) { if (isLogin) {
return return
} }
if(this.data.isGH)return if (this.data.isGH) return
this.setData({ this.setData({
showCoupons:true showCoupons: true
}) })
}, },
// 选择商品 // 选择商品
...@@ -108,7 +108,7 @@ Page({ ...@@ -108,7 +108,7 @@ Page({
}, },
// 查询会员开通情况 // 查询会员开通情况
toCheckMember() { toCheckMember() {
if(this.data.isGameUse)return if (this.data.isGameUse) return
const SID = wx.p.cache.storageApi.getSessionId() const SID = wx.p.cache.storageApi.getSessionId()
if (!SID) { if (!SID) {
return return
...@@ -125,10 +125,10 @@ Page({ ...@@ -125,10 +125,10 @@ Page({
}) })
}, },
// 获取商品信息 // 获取商品信息
toGetCommodity(query,options) { toGetCommodity(query, options) {
let { curentGoodsItem, currentIndex,isGameUse,coupons } = this.data let { curentGoodsItem, currentIndex, isGameUse, coupons } = this.data
let tem = {...query} let tem = { ...query }
if(tem.id&&!isGameUse){ if (tem.id && !isGameUse) {
delete tem.id delete tem.id
} }
wx.p.api.equityApi.commodityMsg(tem).then(res => { wx.p.api.equityApi.commodityMsg(tem).then(res => {
...@@ -158,11 +158,11 @@ Page({ ...@@ -158,11 +158,11 @@ Page({
richText = richText.replace(/\<span/g, '<span class="rich_text"') richText = richText.replace(/\<span/g, '<span class="rich_text"')
richText = richText.replace(/\<a/g, '<a class="rich_text_a"') richText = richText.replace(/\<a/g, '<a class="rich_text_a"')
} }
if(isGameUse){ if (isGameUse) {
curentGoodsItem.payCouponsPrice = curentGoodsItem.lineationPrice curentGoodsItem.payCouponsPrice = curentGoodsItem.lineationPrice
} }
if(this.data.isGameUse){ if (this.data.isGameUse) {
tempList = tempList.filter(item=>item.id===query.id) tempList = tempList.filter(item => item.id === query.id)
currentIndex = 0 currentIndex = 0
} }
this.setData({ this.setData({
...@@ -173,10 +173,10 @@ Page({ ...@@ -173,10 +173,10 @@ Page({
query, query,
currentIndex, currentIndex,
to: `to-${currentIndex}`, to: `to-${currentIndex}`,
showComponent:true, showComponent: true,
showLogin: false showLogin: false
},()=>{ }, () => {
if(options.source=="GH"){ if (options.source == "GH") {
this.handleEquityOfGH(options.couponsItem) this.handleEquityOfGH(options.couponsItem)
} }
}) })
...@@ -184,11 +184,11 @@ Page({ ...@@ -184,11 +184,11 @@ Page({
// wx.redirectTo({ // wx.redirectTo({
// url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1' // url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1'
// }) // })
setTimeout(()=>{ setTimeout(() => {
wx.p.router.back(e =>{ wx.p.router.back(e => {
e.onLoad({showToast:1}) e.onLoad({ showToast: 1 })
}) })
},500) }, 500)
return return
} }
this.toGetCommodityStock(query.id || tempList[0].id) this.toGetCommodityStock(query.id || tempList[0].id)
...@@ -219,18 +219,18 @@ Page({ ...@@ -219,18 +219,18 @@ Page({
}) })
}, },
// 去购买 // 去购买
async toBuyItem() { async toBuyItem() {
const isLogin = await this.checkLogin() const isLogin = await this.checkLogin()
if (isLogin) { if (isLogin) {
return return
} }
const { curentGoodsItem, isHaveInventory,isGameUse } = this.data const { curentGoodsItem, isHaveInventory, isGameUse } = this.data
if (!isHaveInventory) { if (!isHaveInventory) {
return return
} }
if(isGameUse)return this.comfirmBuyItem() if (isGameUse) return this.comfirmBuyItem()
const { noMemberPrice, salesPrice } = curentGoodsItem const { noMemberPrice, salesPrice } = curentGoodsItem
let diffPrice = 0 let diffPrice = 0
if (noMemberPrice) { if (noMemberPrice) {
...@@ -261,7 +261,7 @@ Page({ ...@@ -261,7 +261,7 @@ Page({
if (!orderCode) { if (!orderCode) {
return return
} }
const { curentGoodsItem,coupons,isGameUse } = this.data const { curentGoodsItem, coupons, isGameUse } = this.data
const { const {
merchantId merchantId
} = wx.p.storage.get('merchant_info') } = wx.p.storage.get('merchant_info')
...@@ -274,7 +274,7 @@ Page({ ...@@ -274,7 +274,7 @@ Page({
merchantId merchantId
} }
if(isGameUse&&coupons){ if (isGameUse && coupons) {
para.usedCouponIds = [coupons.id] para.usedCouponIds = [coupons.id]
} }
wx.p.api.equityApi.payGoodsOrder(para).then(res => { wx.p.api.equityApi.payGoodsOrder(para).then(res => {
...@@ -293,12 +293,26 @@ Page({ ...@@ -293,12 +293,26 @@ Page({
signType: signType, signType: signType,
paySign: paySign, paySign: paySign,
success() { success() {
// 设置埋点参数
const { curentGoodsItem } = self.data
const query = {
item_type: 7,
view: 3,
id: curentGoodsItem.id
}
self.orderCode = orderCode
self.orderTime = Number(timeStamp)
self.order_total_price = curentGoodsItem.salesPrice
self.pay_time = new Date().getTime()
self.trade_name = curentGoodsItem.productName
self.trade_classification = curentGoodsItem.goodsCategory
self.addTrack(query)
//跳转商品详情 //跳转商品详情
wx.navigateTo({ wx.navigateTo({
url: '/packageSaveMoney/pages/kaqDetail/kaqDetail?orderCode=' + orderCode url: '/packageSaveMoney/pages/kaqDetail/kaqDetail?orderCode=' + orderCode
}) })
}, },
fail() {} fail() { }
}) })
}, },
modalOnCancel() { modalOnCancel() {
...@@ -377,7 +391,7 @@ Page({ ...@@ -377,7 +391,7 @@ Page({
}) })
}, },
// 检测是否已经登录 // 检测是否已经登录
async checkLogin() { async checkLogin() {
const authStatus = await wx.p.router.intercept() const authStatus = await wx.p.router.intercept()
return authStatus return authStatus
}, },
...@@ -403,5 +417,53 @@ Page({ ...@@ -403,5 +417,53 @@ Page({
if (data) { if (data) {
this.toCheckMember() this.toCheckMember()
} }
} },
// 2023-12版本 添加权益下单支付成功埋点
/**添加埋点开始 */
/**
* 商品-活动id,
* 物品类型item_type 1 商品 3活动,
* view 动作类型 3下单
* */
async addTrack(query) {
const {
id,
item_type,
view
} = query
const userInfo = wx.p.cache.userInfo.getUserInfo() || {},
{
openId
} = await USERAPI.getWXUserInfo()
const {
merchantId
} = wx.p.storage.get('merchant_info')
let data = {
open_id: openId || null,
item_type,
customer_phone: userInfo.phone || null,
action_type: view,
item_id: id,
business_type: 1,
add_way: 103,
merchant_id: merchantId,
customer_name: userInfo.nickName || null,
master_order_no: this.orderCode,
sub_order_no: this.orderCode,
order_time: new Date(this.orderTime).format('yyyy-MM-dd hh:mm:ss'),
order_total_price: this.order_total_price || 0,
pay_method: "微信支付",
pay_time: new Date(this.pay_time).format('yyyy-MM-dd hh:mm:ss') || '',
status: '已支付',
trade_pay_price: this.order_total_price || 0,
trade_name: this.trade_name || '',
trade_classification: this.trade_classification || '',
association_classify_first_name:this.trade_classification || ''
}
this.firstEnter = false
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
})
},
}) })
...@@ -5,7 +5,7 @@ Page({ ...@@ -5,7 +5,7 @@ Page({
strategyDetailObj: {}, strategyDetailObj: {},
}, },
onLoad(options) { async onLoad(options) {
console.log(options); console.log(options);
if (options && options.openId) { if (options && options.openId) {
this.shareOpenId = options.openId this.shareOpenId = options.openId
...@@ -15,26 +15,27 @@ Page({ ...@@ -15,26 +15,27 @@ Page({
} }
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); await this.getStrategyDetail(options.id);
// 触发埋点
this.heartbeatFn({
id: options.id,
item_type: 6,
view: 1
})
}, },
getStrategyDetail(id) { async getStrategyDetail(id) {
wx.p.api.strategyApi wx.p.api.strategyApi
.getStrategyDetail({ .getStrategyDetail({
id, id,
}) })
.then((res) => { .then((res) => {
Util.setNavigationBarTitle(res.strategyName); Util.setNavigationBarTitle(res.strategyName);
this.categoryName = res.categoryName
this.setData({ this.setData({
strategyDetailObj: res, strategyDetailObj: res,
}, () => { }, () => {
// 触发埋点
this.heartbeatFn({
id,
item_type: 6,
view: 1
})
this.handlerShareQuery() this.handlerShareQuery()
}); });
}); });
...@@ -69,7 +70,9 @@ Page({ ...@@ -69,7 +70,9 @@ 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 || '' share_guest_no: this.share_guest_no || '',
trade_classification: this.categoryName || '',
association_classify_first_name:this.categoryName || '',
}; };
this.firstEnter = false; this.firstEnter = false;
const jsonList = [JSON.stringify(data)]; const jsonList = [JSON.stringify(data)];
......
...@@ -13,12 +13,14 @@ Page({ ...@@ -13,12 +13,14 @@ Page({
title: '官方', title: '官方',
desc: '福利群', desc: '福利群',
tip: '优惠资讯,先人一步', tip: '优惠资讯,先人一步',
url: 'fuliqun' url: 'welfareGroupQRCode',
banner:'fuliqun_banner'
}, { }, {
title: '专属', title: '专属',
desc: '福利官', desc: '福利官',
tip: '超多福利,不容错过', tip: '超多福利,不容错过',
url: 'fuliguan' url: 'welfareOfficerQRCode',
banner:'fuliguan_banner'
}], }],
showModal: false, showModal: false,
urlName: '', urlName: '',
...@@ -89,12 +91,12 @@ Page({ ...@@ -89,12 +91,12 @@ Page({
}, },
toShowQrCode(e) { toShowQrCode(e) {
const { url } = e.currentTarget.dataset; const { item } = e.currentTarget.dataset;
const { currentStore } = this.data const { currentStore } = this.data
const Name = `${currentStore.merchantId}_${url}`
this.setData({ this.setData({
urlName: Name, urlName: currentStore[item.url] || '',
showModal: true, showModal: true,
bannerName:item.banner
}); });
}, },
closeModal() { closeModal() {
...@@ -200,12 +202,14 @@ Page({ ...@@ -200,12 +202,14 @@ Page({
wx.$merchant_id = merchantId wx.$merchant_id = merchantId
wx.p.api.homeApi.getHomeConfig({ merchantId }).then(data => { wx.p.api.homeApi.getHomeConfig({ merchantId }).then(data => {
let { let {
noticeContent noticeContent,welfareGroupQRCode,welfareOfficerQRCode
} = data } = data
let bannerList = [], { currentStore } = this.data let bannerList = [], { currentStore } = this.data
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
currentStore.noticeContent = noticeContent currentStore.noticeContent = noticeContent
currentStore.bannerList = bannerList currentStore.bannerList = bannerList
currentStore.welfareGroupQRCode = welfareGroupQRCode
currentStore.welfareOfficerQRCode = welfareOfficerQRCode
this.setData({ this.setData({
currentStore currentStore
}) })
......
...@@ -129,8 +129,22 @@ page { ...@@ -129,8 +129,22 @@ page {
position: absolute; position: absolute;
right: 32rpx; right: 32rpx;
top: 32rpx; top: 32rpx;
width:32rpx; width: 32rpx;
height:32rpx; height: 32rpx;
}
.code_banner {
width: 294rpx;
height: 288rpx;
position: absolute;
left: 50%;
top: 204rpx;
transform: translateX(-50%);
.codeimg {
width: 294rpx;
height: 288rpx;
}
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<!-- 福利二维码 --> <!-- 福利二维码 -->
<view class="code_wrap flex_scb"> <view class="code_wrap flex_scb">
<block wx:for="{{codeList}}" wx:key="index"> <block wx:for="{{codeList}}" wx:key="index">
<view data-url="{{item.url}}" bind:tap="toShowQrCode" class="code_item flex_scb"> <view data-item="{{item}}" bind:tap="toShowQrCode" class="code_item flex_scb">
<view class="left"> <view class="left">
<view class="title"> <view class="title">
<text>{{item.title}}</text> <text>{{item.title}}</text>
...@@ -57,8 +57,12 @@ ...@@ -57,8 +57,12 @@
<view wx:if="{{showModal}}" class="modal_widget"> <view wx:if="{{showModal}}" class="modal_widget">
<view bind:tap="closeModal" class="popup-bg"></view> <view bind:tap="closeModal" class="popup-bg"></view>
<view class="box_cover"> <view class="box_cover">
<image class="max_cover" src="{{IMG_URL}}home/fuliguan/{{urlName}}.png" show-menu-by-longpress="{{true}}" /> <!-- <image class="max_cover" src="{{IMG_URL}}home/fuliguan/{{urlName}}.png" show-menu-by-longpress="{{true}}" /> -->
<image class="max_cover" src="{{IMG_URL}}home/fuliguan/{{bannerName}}.png" show-menu-by-longpress="{{true}}" />
<image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}home/close_modal.png" /> <image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}home/close_modal.png" />
<view class="code_banner">
<image class="codeimg" src="{{urlName}}" show-menu-by-longpress="{{true}}" />
</view>
</view> </view>
</view> </view>
<store-select show="{{showStore}}" bind:freshMerchant="freshMerchant"></store-select> <store-select show="{{showStore}}" bind:freshMerchant="freshMerchant"></store-select>
\ No newline at end of file \ No newline at end of file
...@@ -547,4 +547,17 @@ page { ...@@ -547,4 +547,17 @@ page {
left: 20rpx; left: 20rpx;
bottom: 56rpx; bottom: 56rpx;
} }
}
.nothing{
flex-direction: column;
width: 100%;
padding: 30rpx 0;
text-align: center;
font-size: 24rpx;
color: #858A94;
.icon{
width: 320rpx;
height: 320rpx;
}
} }
\ No newline at end of file \ No newline at end of file
<view> <view wx:if="{{categoryList.length}}">
<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">
<view id="toCategory-{{index}}" data-item="{{item}}" bind:tap="toSelectCategory" data-index="{{index}}" class="image_text"> <view id="toCategory-{{index}}" data-item="{{item}}" bind:tap="toSelectCategory" data-index="{{index}}" class="image_text">
<view class="box {{curCategoryIdx==index?'box_active':''}}"> <view class="box {{curCategoryIdx==index?'box_active':''}}">
<image mode="aspectFill" class="icon" webp src="{{item.categoryImage}}"></image> <image mode="aspectFill" class="icon" webp src="{{item.categoryImage}}"></image>
<glsx-image wx:if="{{curCategoryIdx==index}}" class="icon_active" webp src="discover/version/1_0_0/select_seri.png"></glsx-image> <glsx-image wx:if="{{curCategoryIdx==index}}" class="icon_active" webp src="discover/version/1_0_0/select_seri.png"></glsx-image>
</view> </view>
<view class="text hide {{curCategoryIdx==index?'text_active':''}}"> <view class="text hide {{curCategoryIdx==index?'text_active':''}}">
{{item.categoryName}} {{item.categoryName}}
</view> </view>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
</view>
</view> </view>
<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>
<view wx:if="{{categoryStyle==0 || categoryStyle==1}}" class="goods_wrap"> <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 class="titleBg" wx:if="{{categoryStyle==1}}">热销爆款</view> <view wx:if="{{categoryStyle==0 || categoryStyle==1}}" class="goods_wrap">
<view catch:tap="toGoodsDetail" data-item="{{item}}" class="goods_box {{categoryStyle==1&&index==0? 'mtStyle' : ''}}" wx:for="{{goodsList}}" wx:key="index"> <view class="titleBg" wx:if="{{categoryStyle==1}}">热销爆款</view>
<image mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" /> <view catch:tap="toGoodsDetail" data-item="{{item}}" class="goods_box {{categoryStyle==1&&index==0? 'mtStyle' : ''}}" wx:for="{{goodsList}}" wx:key="index">
<view class="info {{categoryStyle?'flex_cccb':''}}"> <image mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<text class="name">{{item.goodsName}}</text> <view class="info {{categoryStyle?'flex_cccb':''}}">
<!-- <block wx:if="{{categoryStyle}}"> <text class="name">{{item.goodsName}}</text>
<!-- <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="price_tip">到手价</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_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 wx:if="{{categoryStyle==1}}" catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn flex_cc">
立即抢购 立即抢购
</view> </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 wx:elif="{{categoryStyle==3}}" class="goods_wrap"> </view>
<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}}" /> <view wx:elif="{{categoryStyle==3}}" class="goods_wrap">
<view class="goods_box"> <view catch:tap="toGoodsDetail" data-item="{{item}}" wx:for="{{goodsList}}" wx:key="index">
<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:if="{{item.styleBImg}}" mode="aspectFill" class="publicity-img" src="{{item.styleBImg}}" />
<image wx:else mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" /> <view class="goods_box">
<view class="info {{categoryStyle?'flex_cccb':''}}"> <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>
<text class="name">{{item.goodsName}}</text> <image wx:else mode="aspectFill" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> --> <view class="info {{categoryStyle?'flex_cccb':''}}">
<view class="price_wrap"> <text class="name">{{item.goodsName}}</text>
<text> <!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> -->
<text class="price_tip">到手价</text> <view class="price_wrap">
<text class="unit">¥</text> <text>
<text class="new_price">{{item.activityPrice}}</text> <text class="price_tip">到手价</text>
<text class="old_price">{{item.originalPrice}}</text> <text class="unit">¥</text>
</text> <text class="new_price">{{item.activityPrice}}</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> --> <text class="old_price">{{item.originalPrice}}</text>
<view catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn flex_cc"> </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> -->
</view> <view catch:tap="toAddBuuCar" data-item="{{item}}" class="add_btn flex_cc">
</view> 立即抢购
</view> </view>
</view>
</view> </view>
</view>
</view> </view>
<!-- 横排 --> </view>
<block wx:else> </view>
<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:else>
<view catch:tap="toGoodsDetail" data-item="{{item}}" wx:if="{{index%2 == parentIndex}}" class="goods_box"> <view class="{{parentIndex==0 ? 'left-box' : 'right-box'}}" wx:for-item="parentItem" wx:for-index="parentIndex" wx:for="{{['leftList','rightList']}}" wx:key="index">
<image mode="widthFix" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" /> <block wx:for="{{goodsList}}" wx:key="index">
<view class="info"> <view catch:tap="toGoodsDetail" data-item="{{item}}" wx:if="{{index%2 == parentIndex}}" class="goods_box">
<text class="name">{{item.goodsName}}</text> <image mode="widthFix" class="cover" src="{{item.commerceVideo ? item.coverUrl : item.goodsImage}}" />
<!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> --> <view class="info">
<view class="price_wrap"> <text class="name">{{item.goodsName}}</text>
<text> <!-- <text wx:if="{{item.giveIntegral}}" class="tip">获{{item.giveIntegral}}养车积分</text> -->
<text class="unit">¥</text> <view class="price_wrap">
<text class="new_price">{{item.activityPrice}}</text> <text>
<text class="old_price">{{item.originalPrice}}</text> <text class="unit">¥</text>
</text> <text class="new_price">{{item.activityPrice}}</text>
</view> <text class="old_price">{{item.originalPrice}}</text>
</view> </text>
</view> </view>
</block>
</view> </view>
</view>
</block> </block>
<!-- <view style="height: 116rpx;"> </view>
</block>
<!-- <view style="height: 116rpx;">
</view> --> </view> -->
</view> </view>
</view>
<view class="nothing flex" wx:else>
<glsx-image src="mall/goods-nothing.png" class="icon"></glsx-image>
当前暂无上架商品
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -6,47 +6,86 @@ Page({ ...@@ -6,47 +6,86 @@ Page({
*/ */
data: { data: {
strategyList: [], strategyList: [],
categoryList: [],
currentCateIndex: 0,
toCate: 'to-0'
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getStrategyList(); this.getCategoryList()
this.shareTitle = "攻略专区" this.shareTitle = "攻略专区"
}, },
navbarReady(e) { // navbarReady(e) {
let { // let {
height // height
} = e.detail // } = e.detail
// this.setData({
// user_box_style: `padding-top:${height + 15}px`
// })
// },
// 获取分类列表
getCategoryList() {
wx.p.api.strategyApi.getStrategyCategory({}).then(res => {
if (res && res.list && res.list.length) {
let setdataobj = { categoryList: res.list }
if (this.fresh) {
// 防止下拉刷新时,分类已被置顶乱序
const currentIndx = res.list.findIndex(item => item.id == this.currentCategoryId)
setdataobj.currentCateIndex = currentIndx
setdataobj.toCate = `to-${currentIndx}`
} else {
this.currentCategoryId = res.list[0].id
}
this.setData(setdataobj, () => {
this.getStrategyList();
})
}
})
},
selectCate(e) {
const { index, item } = e.currentTarget.dataset
this.currentCategoryId = item.id
this.getStrategyList();
this.setData({ this.setData({
user_box_style: `padding-top:${height + 15}px` currentCateIndex: index,
toCate: `to-${index}`
}) })
}, },
getStrategyList() { getStrategyList() {
wx.p.api.strategyApi.getStrategyList({ wx.p.api.strategyApi.getStrategyList({
pageNum: 1, pageNum: 1,
pageSize: 100 pageSize: 99999,
categoryId: this.currentCategoryId
}).then(res => { }).then(res => {
this.setData({ this.setData({
strategyList: res.list strategyList: res.list,
}) })
if (this.fresh) {
wx.stopPullDownRefresh()
}
}); });
}, },
selectStrategy(e) { selectStrategy(e) {
const {id} = e.currentTarget.dataset.item const { id } = e.currentTarget.dataset.item
wx.p.router.go('/packageStrategy/pages/strategyDetail/index', { wx.p.router.go('/packageStrategy/pages/strategyDetail/index', {
id, id,
notIntercept: true notIntercept: true
}) })
}, },
onShareAppMessage(){}, onShareAppMessage() { },
onShow(){ onShow() {
const FIRST = wx.p.storage.get('first_enter_miniprograme') const FIRST = wx.p.storage.get('first_enter_miniprograme')
this.setData({ this.setData({
showStore:!FIRST showStore: !FIRST
}) })
} },
onPullDownRefresh() {
this.fresh = true
this.getCategoryList()
},
}); });
{ {
"navigationStyle": "custom", "usingComponents": {},
"usingComponents": {} "navigationBarTitleText": "攻略专区",
"onReachBottomDistance": 10,
"backgroundColor": "#FFFFFF",
"enablePullDownRefresh": true
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,46 @@ ...@@ -11,6 +11,46 @@
padding: 30rpx; padding: 30rpx;
background: #F8F8F8; background: #F8F8F8;
.category_wrap {
width: 100%;
margin-bottom: 30rpx;
overflow: hidden;
white-space: nowrap;
.cate_itm {
display: inline-block;
margin-right: 60rpx;
position: relative;
.cate_text {
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
.cate_text_active {
font-weight: 600;
font-size: 36rpx;
color: #333333;
}
.cate_active_line {
width: 144rpx;
height: 12rpx;
background-image: linear-gradient(90deg, #61a5ff00 0%, #2699FD 100%);
border-radius: 6rpx;
position: absolute;
right: 0rpx;
bottom: 0rpx;
}
}
.cate_itm:last-child {
margin-right: 0;
}
}
.strategy-item { .strategy-item {
width: 690rpx; width: 690rpx;
background: #ffffff; background: #ffffff;
......
<view class="navigation-bar"> <!-- <view class="navigation-bar">
<navigation-bar bindnavbarReady="navbarReady" page-title="攻略专区">攻略专区</navigation-bar> <navigation-bar bindnavbarReady="navbarReady" page-title="攻略专区">攻略专区</navigation-bar>
</view> </view> -->
<view class="strategy-box">
<view class="strategy-box" style="{{user_box_style}}"> <view wx:if="{{categoryList.length}}" class="category_wrap">
<scroll-view scroll-into-view="{{toCate}}" enhanced scroll-with-animation scroll-x show-scrollbar="{{false}}">
<block wx:for="{{categoryList}}" wx:key="index">
<view id="to-{{index}}" class="cate_itm" bind:tap="selectCate" data-item="{{item}}" data-index="{{index}}">
<view class="cate_text {{currentCateIndex==index?'cate_text_active':''}}">{{item.categoryName}}</view>
<view wx:if="{{currentCateIndex==index}}" class="cate_active_line"></view>
</view>
</block>
</scroll-view>
</view>
<view class="strategy-item" wx:for="{{strategyList}}" wx:key="index" data-item="{{item}}" bind:tap="selectStrategy"> <view class="strategy-item" wx:for="{{strategyList}}" wx:key="index" data-item="{{item}}" bind:tap="selectStrategy">
<image mode="aspectFill" webp src="{{item.strategyImg}}" class="strategy-img"></image> <image mode="aspectFill" webp src="{{item.strategyImg}}" class="strategy-img"></image>
<view class="strategy-detail"> <view class="strategy-detail">
......
...@@ -44,7 +44,7 @@ class TRACK { ...@@ -44,7 +44,7 @@ class TRACK {
// , (_this.getPageInstance().page_show_time = Date.now()) // , (_this.getPageInstance().page_show_time = Date.now())
} }
thisPage.onHide = function () { thisPage.onHide = function () {
let { page_show_time } = _this.getPageInstance() // let { page_show_time } = _this.getPageInstance()
onHide && onHide.apply(this, arguments) onHide && onHide.apply(this, arguments)
// ,_this.setTrack( // ,_this.setTrack(
// { // {
...@@ -54,7 +54,7 @@ class TRACK { ...@@ -54,7 +54,7 @@ class TRACK {
// ) // )
} }
thisPage.onUnload = function () { thisPage.onUnload = function () {
let { page_show_time } = _this.getPageInstance() // let { page_show_time } = _this.getPageInstance()
onUnload && onUnload.apply(this, arguments) onUnload && onUnload.apply(this, arguments)
// ,_this.setTrack( // ,_this.setTrack(
// { // {
...@@ -63,7 +63,7 @@ class TRACK { ...@@ -63,7 +63,7 @@ class TRACK {
// 2 // 2
// ) // )
} }
const getDuration = page_show_time => (Date.now() - page_show_time) / 1e3 // const getDuration = page_show_time => (Date.now() - page_show_time) / 1e3
} }
/**全局注册事件 */ /**全局注册事件 */
initPageProxy() { initPageProxy() {
...@@ -135,7 +135,7 @@ class TRACK { ...@@ -135,7 +135,7 @@ class TRACK {
let { window } = __wxConfig.page[`${route}.html`] let { window } = __wxConfig.page[`${route}.html`]
title = window.navigationStyle == 'custom' ? navigationBarTitleText : window.navigationBarTitleText title = window.navigationStyle == 'custom' ? navigationBarTitleText : window.navigationBarTitleText
} }
if (!title) title = '生意助手' if (!title) title = '中海物业'
return title return title
} }
/**获取设备信息 */ /**获取设备信息 */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!