Commit 7e8c3879 by 杨北旺

12月底需求

1 parent c7556e20
...@@ -15,4 +15,13 @@ module.exports = { ...@@ -15,4 +15,13 @@ module.exports = {
...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,7 +76,7 @@ Page({ ...@@ -75,7 +76,7 @@ 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,7 +176,7 @@ Page({ ...@@ -175,7 +176,7 @@ 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
...@@ -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,70 @@ Page({ ...@@ -587,5 +589,70 @@ 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,
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 || ''
}
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
...@@ -280,7 +280,8 @@ Page({ ...@@ -280,7 +280,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 +354,8 @@ Page({ ...@@ -353,11 +354,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 +647,7 @@ Page({ ...@@ -649,7 +647,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,7 +223,7 @@ Page({ ...@@ -222,7 +223,7 @@ 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 => {
...@@ -459,42 +461,42 @@ Page({ ...@@ -459,42 +461,42 @@ Page({
// 平台商城--获取默认的地址 // 平台商城--获取默认的地址
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) _ids.push(el.id)
_orderGoodsList.push(temp) _orderGoodsList.push(temp)
}) })
if(!defaultAddress.receiveName){ if (!defaultAddress.receiveName) {
return wx.p.wxApi.showToast('请选择收货地址') return wx.p.wxApi.showToast('请选择收货地址')
} }
const params = { const params = {
...@@ -516,7 +518,7 @@ Page({ ...@@ -516,7 +518,7 @@ Page({
clearTimeout(timer) clearTimeout(timer)
timer = setTimeout(() => { timer = setTimeout(() => {
wx.p.api.shopmallApi wx.p.api.shopmallApi
.platformRemoveShopCarGoods({ids:_ids}) .platformRemoveShopCarGoods({ ids: _ids })
.then(data => { .then(data => {
if (res) this.toPayOrder(res.orderCode) if (res) this.toPayOrder(res.orderCode)
}) })
...@@ -527,7 +529,7 @@ Page({ ...@@ -527,7 +529,7 @@ Page({
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,
...@@ -552,7 +554,7 @@ Page({ ...@@ -552,7 +554,7 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {}, onReady: function () { },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -564,20 +566,80 @@ Page({ ...@@ -564,20 +566,80 @@ 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,
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 || ''
}
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,64 @@ Page({ ...@@ -446,5 +447,64 @@ 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,
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 || ''
} }
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: 1,
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,68 @@ Page({ ...@@ -293,22 +307,68 @@ 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,
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 || ''
} }
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)
...@@ -225,12 +225,12 @@ Page({ ...@@ -225,12 +225,12 @@ Page({
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: 1,
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() {
...@@ -403,5 +417,51 @@ Page({ ...@@ -403,5 +417,51 @@ 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,
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 || ''
} }
this.firstEnter = false
const jsonList = [JSON.stringify(data)]
const res = await wx.p.api.shopmallApi.trackHttp({
jsonList
})
},
}) })
...@@ -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
...@@ -6,16 +6,16 @@ Page({ ...@@ -6,16 +6,16 @@ Page({
*/ */
data: { data: {
strategyList: [], strategyList: [],
categoryList:[1,2,3,4,5,6,7,8,9,10], categoryList: [],
currentCateIndex:0, currentCateIndex: 0,
toCate:'to-0' toCate: 'to-0'
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getStrategyList(); this.getCategoryList()
this.shareTitle = "攻略专区" this.shareTitle = "攻略专区"
}, },
...@@ -27,36 +27,65 @@ Page({ ...@@ -27,36 +27,65 @@ Page({
// user_box_style: `padding-top:${height + 15}px` // user_box_style: `padding-top:${height + 15}px`
// }) // })
// }, // },
selectCate(e){ // 获取分类列表
const {index} = e.currentTarget.dataset 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({
currentCateIndex:index, currentCateIndex: index,
toCate:`to-${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()
},
}); });
{ {
"usingComponents": {}, "usingComponents": {},
"navigationBarTitleText": "攻略专区" "navigationBarTitleText": "攻略专区",
"onReachBottomDistance": 10,
"backgroundColor": "#FFFFFF",
"enablePullDownRefresh": true
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<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">
<view class="category_wrap"> <view wx:if="{{categoryList.length}}" class="category_wrap">
<scroll-view scroll-into-view="{{toCate}}" enhanced scroll-with-animation scroll-x show-scrollbar="{{false}}"> <scroll-view scroll-into-view="{{toCate}}" enhanced scroll-with-animation scroll-x show-scrollbar="{{false}}">
<block wx:for="{{categoryList}}" wx:key="index"> <block wx:for="{{categoryList}}" wx:key="index">
<view id="to-{{index}}" class="cate_itm" bind:tap="selectCate" data-index="{{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':''}}">攻略分类</view> <view class="cate_text {{currentCateIndex==index?'cate_text_active':''}}">{{item.categoryName}}</view>
<view wx:if="{{currentCateIndex==index}}" class="cate_active_line"></view> <view wx:if="{{currentCateIndex==index}}" class="cate_active_line"></view>
</view> </view>
</block> </block>
......
...@@ -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!