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