Commit 77abbaa2 by 李伟康

提交

1 parent 32bd316e
import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2
let index = 3
/**
*
......
......@@ -15,29 +15,27 @@ Component({
methods: {
toDetail(){
let {chargeInfo} = this.data
let query = {
let param = {
brandName:chargeInfo.brandName,
supplier:chargeInfo.supplier,
icon:chargeInfo.icon
}
const temp = JSON.stringify(query)
wx.navigateTo({
url: '/packageEquity/pages/commodity/chargeDetail/chargeDetail?param='+temp
wx.p.router.go('/packageEquity/pages/commodity/chargeDetail/chargeDetail',{
param
})
},
toDetailPage(e){
let {item} = e.currentTarget.dataset
let {chargeInfo} = this.data
let query = {
let param = {
brandName:chargeInfo.brandName,
supplier:chargeInfo.supplier,
id:item.id,
productName:item.productName,
icon:chargeInfo.icon
}
const temp = JSON.stringify(query)
wx.navigateTo({
url: '/packageEquity/pages/commodity/chargeDetail/chargeDetail?param='+temp
wx.p.router.go('/packageEquity/pages/commodity/chargeDetail/chargeDetail',{
param
})
}
}
......
......@@ -108,16 +108,14 @@ Page({
param
})
} else if (item.appearance == 2) {
let para = {
let param = {
supplier: item.supplier,
brandName: item.brandName,
icon: item.equityIcon
}
const temp = JSON.stringify(para)
url = '/packageEquity/pages/commodity/chargeDetail/chargeDetail?param=' + temp
}
wx.navigateTo({
url
wx.p.router.go('/packageEquity/pages/commodity/chargeDetail/chargeDetail',{
param
})
}
}
})
......@@ -9,16 +9,13 @@ Page({
},
onLoad: function (options) {
console.log(wx.p);
let query = JSON.parse(options.query)
let query = options.query
this.setData({
query
})
},
toOrderList() {
wx.redirectTo({
url: '/packageMine/pages/order/index/index'
})
wx.p.router.redirectTo('/packageMine/pages/order/index/index')
},
toBack() {
wx.p.router.back()
......
import { decimal } from '~/utils/format'
import {
decimal
} from '~/utils/format'
Page({
data: {
curIndex: 0,
......@@ -6,26 +8,28 @@ 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 = decimal(selectedItem.lineationPrice-(Number(couponsItem.denomination)), 2)
let {
selectedItem
} = this.data
selectedItem.payCouponsPrice = 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
})
......@@ -36,22 +40,39 @@ Page({
})
},
changeMumberType(e) {
let { selectedItem, listData,coupons } = this.data
const { index } = e.currentTarget.dataset
let {
selectedItem,
listData,
coupons
} = this.data
const {
index
} = e.currentTarget.dataset
selectedItem = listData[index].denominationList[0]
if(coupons){
selectedItem.payCouponsPrice = decimal(selectedItem.lineationPrice-(Number(coupons.denomination)), 2)
if (coupons) {
selectedItem.payCouponsPrice = decimal(selectedItem.lineationPrice - (Number(coupons.denomination)), 2)
}
this.setData({ curIndex: index, selectedItem, checkedItem: 0 })
this.setData({
curIndex: index,
selectedItem,
checkedItem: 0
})
},
checkedMumberType(e) {
const { item, index } = e.currentTarget.dataset
const {
item,
index
} = e.currentTarget.dataset
let richText = decodeURIComponent(item.buysNotes)
richText = richText.replace(/\<span/g, '<span class="rich_text"')
this.setData({ checkedItem: index, selectedItem: item, richText })
this.setData({
checkedItem: index,
selectedItem: item,
richText
})
},
toCheckMember() {
if(this.data.isGameUse)return
if (this.data.isGameUse) return
const SID = wx.p.storage.get('sessionId')
if (!SID) {
return
......@@ -67,27 +88,32 @@ 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 } = this.data
let {
selectedItem,
curIndex,
checkedItem,
richText,
isGameUse,
coupons
} = this.data
if (!res) {
setTimeout(()=>{
wx.navigateBack({
delta: 1
});
},1500)
setTimeout(() => {
wx.p.router.back()
}, 1500)
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) {
......@@ -116,7 +142,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({
......@@ -128,24 +154,20 @@ Page({
richText,
showLogin: false,
isGameUse,
showComponent:true
},()=>{
if(options.source=='GH'){
showComponent: true
}, () => {
if (options.source == 'GH') {
this.handleEquityOfGH(options.couponsItem)
}
})
})
},
toCoupons() {
wx.navigateTo({
url: '/packageMine/pages/order/index/index'
})
wx.p.router.go('/packageMine/pages/order/index/index')
},
toOpenPage() {
this.modalOnCancel()
wx.navigateTo({
url: '/packageEquity/pages/open/open?page=business'
})
wx.p.router.go('/packageEquity/pages/open/open?page=business')
},
toMemberPage() {
this.toOpenPage()
......@@ -159,8 +181,11 @@ Page({
wx.p.wxApi.showToast('请输入充值账号')
return
}
if(this.data.isGameUse)return this.comfirmBuyItem()
const { noMemberPrice, salesPrice } = this.data.selectedItem
if (this.data.isGameUse) return this.comfirmBuyItem()
const {
noMemberPrice,
salesPrice
} = this.data.selectedItem
let diffPrice = 0
if (noMemberPrice) {
diffPrice = decimal(noMemberPrice - salesPrice, 2)
......@@ -190,7 +215,12 @@ Page({
if (!orderCode) {
return
}
const { selectedItem, rechageNum,isGameUse,coupons } = this.data
const {
selectedItem,
rechageNum,
isGameUse,
coupons
} = this.data
let para = {
orderCode,
goodsId: selectedItem.id,
......@@ -199,7 +229,7 @@ Page({
// payMannerId: 19,
paySource: 3
}
if(isGameUse&&coupons){
if (isGameUse && coupons) {
para.usedCouponIds = [coupons.id]
}
wx.p.api.equityApi.payGoodsOrder(para).then(res => {
......@@ -209,7 +239,13 @@ Page({
},
// 处理支付
handlePay(payData) {
const { timeStamp, nonceStr, packages, signType, paySign } = payData
const {
timeStamp,
nonceStr,
packages,
signType,
paySign
} = payData
let self = this
wx.requestPayment({
timeStamp: timeStamp,
......@@ -219,15 +255,17 @@ Page({
paySign: paySign,
success() {
//跳转商品详情
let { query, selectedItem, rechageNum } = self.data
let obj = {
let {
query,
selectedItem,
rechageNum
} = self.data
wx.p.router.go('/packageEquity/pages/chargeWait/chargeWait', {
query: {
...query,
...selectedItem,
rechageNum,
}
const temp = JSON.stringify(obj)
wx.navigateTo({
url: '/packageEquity/pages/chargeWait/chargeWait?query=' + temp
})
},
fail() {}
......@@ -240,8 +278,9 @@ Page({
})
},
onLoad(options) {
const query = options ? JSON.parse(decodeURIComponent(options.param)) : this.data.query
this.getChargeDetail(query,options)
// const query = options ? JSON.parse(decodeURIComponent(options.param)) : this.data.query
const query = options.param
this.getChargeDetail(query, options)
this.setNaviTitle(query.brandName)
wx.p.eventbus.on('EQUITYGOODS', data => {
this.toCheckMember()
......@@ -251,12 +290,14 @@ Page({
this.toCheckMember()
},
// 处理广汇权益明细进入的卡券
handleEquityOfGH(couponsItem){
let {selectedItem} = this.data
selectedItem.payCouponsPrice = decimal(selectedItem.lineationPrice-(Number(couponsItem.denomination)), 2)
handleEquityOfGH(couponsItem) {
let {
selectedItem
} = this.data
selectedItem.payCouponsPrice = decimal(selectedItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({
selectedItem,
coupons:couponsItem
coupons: couponsItem
})
},
// 检测是否已经登录
......@@ -267,7 +308,7 @@ Page({
flag = false
this.setData({
showLogin: true,
showComponent:false
showComponent: false
})
}
return flag
......
......@@ -185,9 +185,7 @@ Page({
if (!tempList.length) {
wx.p.wxApi.showToast('原商品已下架,已为您推荐其他商品')
setTimeout(() => {
wx.navigateBack({
delta: 1
});
wx.p.router.back()
}, 1500)
return
}
......@@ -217,9 +215,7 @@ Page({
})
},
toMemberPage() {
wx.navigateTo({
url: '/packageEquity/pages/open/open?page=business'
})
wx.p.router.go('/packageEquity/pages/open/open?page=business')
},
// 去购买
toBuyItem() {
......@@ -307,9 +303,7 @@ Page({
paySign: paySign,
success() {
//跳转商品详情
wx.navigateTo({
url: '/packageEquity/pages/kaqDetail/kaqDetail?orderCode=' + orderCode
})
wx.p.router.go(`/packageEquity/pages/kaqDetail/kaqDetail?orderCode=${orderCode}`)
},
fail() {}
})
......@@ -320,9 +314,7 @@ Page({
})
},
toMyCoupons() {
wx.navigateTo({
url: '/packageMine/pages/order/index/index'
})
wx.p.router.go('/packageMine/pages/order/index/index')
},
openBottomModal() {
this.setData({
......@@ -423,10 +415,8 @@ Page({
toClickRich() {
let str = this.getALabel(this.data.richText)
if (!str) return
const url = encodeURIComponent(str)
wx.navigateTo({
url: '/pages/webView/webView?url=' + url
})
wx.p.router.jumpH5(str)
},
loginCallBack(data) {
if (data) {
......
......@@ -490,9 +490,9 @@ page {
}
.bottom_title_wrapper {
position: sticky;
left: 0;
top: 0;
// position: sticky;
// left: 0;
// top: 0;
width: 100%;
height: 88rpx;
display: flex;
......@@ -511,15 +511,17 @@ page {
.bottom_scoll_wrap {
width: 100%;
height: calc(100% - 19rpx);
max-height: calc(100% - 88rpx);
overflow: hidden;
overflow-y: scroll;
box-sizing: border-box;
padding: 20rpx 0 20rpx 10rpx;
padding: 20rpx;
display: flex;
flex-wrap: wrap;
gap: 10rpx;
justify-content: space-between;
gap:20rpx 10rpx;
.scroll_element{
margin: 0;
}
}
.bottem_item_width {
......
......@@ -125,9 +125,7 @@ Page({
})
},
toMineCoupons() {
wx.navigateTo({
url: '/packageMine/pages/coupon/index/index'
})
wx.p.router.go('/packageMine/pages/coupon/index/index')
},
// 去使用
toUseGifts(e) {
......
......@@ -33,9 +33,7 @@ Page({
}
let temp = encodeURIComponent(JSON.stringify(bindInfo))
wx.p.storage.set('bindInfo', temp)
wx.reLaunch({
url: '/pages/tab/equity/index',
});
wx.p.router.reLaunch('/pages/tab/equity/index');
})
},
toGetFreeCardDay(merchantId) {
......
......@@ -44,15 +44,10 @@ Page({
if (this.data.pageForm == 'oil') {
wx.p.storage.set('refresh_oil_oage', true)
}
wx.navigateBack({
delta: 1
})
wx.p.router.back()
return
}
// wx.$router.reLaunch('/pages/tab/shopMall/index?tabIndex=1')
wx.switchTab({
url: '/pages/tab/equity/index',
});
wx.p.router.switchTab('/pages/tab/equity/index')
}
})
},
......@@ -116,8 +111,7 @@ Page({
this.data.pageForm = options.page
},
toLook() {
wx.navigateTo({
url: '/packageEquity/pages/agreement/index'
})
wx.p.router.go('/packageEquity/pages/agreement/index')
},
})
\ No newline at end of file
......@@ -41,9 +41,13 @@ Page({
},
async onShow() {
this.getPackageDetail(this.packageId)
this.setData({ showAuthBtn: false })
this.setData({
showAuthBtn: false
})
const loginStatus = await wx.p.router.intercept(false)
if (loginStatus) return this.setData({ showAuthBtn: true })
if (loginStatus) return this.setData({
showAuthBtn: true
})
},
// 登录
// login() {
......@@ -65,7 +69,9 @@ Page({
// },
// 设置标题名称
setNaviTitle(tile) {
const { merchantName } = wx.p.storage.get('merchant_info')
const {
merchantName
} = wx.p.storage.get('merchant_info')
wx.setNavigationBarTitle({
title: merchantName
})
......@@ -87,7 +93,9 @@ Page({
// },
// 获取套餐详情
getPackageDetail(id) {
const { merchantId } = wx.p.storage.get('merchant_info')
const {
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.couponsApi
.packageInfo({
id,
......@@ -124,7 +132,12 @@ Page({
},
// 创建订单
createStoreOrder(orderCode) {
let { packageId, sessionId, packageInfo, shareStaff } = this.data
let {
packageId,
sessionId,
packageInfo,
shareStaff
} = this.data
let para = {
packageId,
paySource: 3,
......@@ -142,7 +155,13 @@ Page({
wx.p.api.couponsApi.createOrder(para).then(res => {
wx.hideLoading()
if (res) {
const { timeStamp, nonceStr, packages, signType, paySign } = res
const {
timeStamp,
nonceStr,
packages,
signType,
paySign
} = res
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: nonceStr,
......@@ -150,9 +169,8 @@ Page({
signType: signType,
paySign: paySign,
success() {
let temp = JSON.stringify(jumpParam)
wx.navigateTo({
url: '/packageEquity/pages/success/success?order=' + temp
wx.p.router.go('/packageEquity/pages/success/success',{
order: jumpParam
})
// if (_this.data.options) {
// wx.p.cache.storageApi.reportData(_this.data.options, false, true)
......
......@@ -78,7 +78,12 @@ Page({
wx.p.wxApi.showToast('请上传图片')
return
}
const { query, desc, upImageURL, isPackage } = this.data
const {
query,
desc,
upImageURL,
isPackage
} = this.data
wx.p.wxApi.showLoading()
let para = {
orderCode: query.orderCode,
......@@ -92,12 +97,12 @@ Page({
})
setTimeout(() => {
if (isPackage) {
wx.redirectTo({
url: '/packageEquity/pages/packageDetail/packageDetail?orderCode=' + query.orderCode
wx.p.router.redirectTo('/packageEquity/pages/packageDetail/packageDetail', {
orderCode: query.orderCode
})
} else {
wx.redirectTo({
url: '/packageEquity/pages/saleDetail/saleDetail?orderCode=' + query.orderCode
wx.p.router.redirectTo('/packageEquity/pages/saleDetail/saleDetail', {
orderCode: query.orderCode
})
}
}, 3000)
......@@ -105,7 +110,10 @@ Page({
},
// 套餐提交申请售后
packageSumbit() {
const { query, desc } = this.data
const {
query,
desc
} = this.data
let para = {
orderCode: query.orderCode,
reason: desc
......@@ -116,8 +124,8 @@ Page({
showWaiting: true
})
setTimeout(() => {
wx.redirectTo({
url: '/packageEquity/pages/packageDetail/packageDetail?orderCode=' + query.orderCode
wx.p.router.redirectTo('/packageEquity/pages/packageDetail/packageDetail', {
orderCode: query.orderCode
})
}, 3000)
})
......
......@@ -18,35 +18,12 @@ Page({
})
},
toMyCoupons() {
wx.redirectTo({
url: '/packageMine/pages/coupon/index/index'
})
// wx.$router.redirectTo('packageMine.coupon.index', {
// success: true
// })
wx.p.router.redirectTo('/packageMine/pages/coupon/index/index')
},
toHtmlOrder() {
const { orderCode, name } = this.data.order
// const sessionId = wx.$util.getSessionId()
// let merchantId = wx.p.storage.get('srcm_shopmall_merchant_id')
// merchantId = merchantId || defaultMerchantId
// let para = {
// sessionId,
// merchantId,
// appId: equityAppId,
// orderCode,
// name,
// refresh: true
// }
// let urlParam = JSON.stringify(para)
// // 需要的参数,订单号,套餐名字
// let url = `${domain}/scrm-equity-h5/#/commodity/packageDetail?urlParam=${urlParam}`
// wx.$router.jumpH5(url)
// wx.redirectTo({
// url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
// })
wx.redirectTo({
url: '/packageEquity/pages/packageDetail/packageDetail?orderCode=' + orderCode
wx.p.router.redirectTo('/packageEquity/pages/packageDetail/packageDetail',{
orderCode
})
},
......
......@@ -157,8 +157,5 @@ Page({
wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
item
})
wx.navigateTo({
url: '/?item=' + temp
})
}
})
\ No newline at end of file
......@@ -17,8 +17,7 @@ Page({
IMGURKBASE: 'equity/version/1_0_0/',
userInfo: {},
isOpen: true,
menuList: [
{
menuList: [{
title: '惠享生活',
desc: '5折起',
icon: 'share_icon',
......@@ -100,14 +99,18 @@ Page({
onPullDownRefresh() {
this.getShopPackage()
this.toCheckMember()
this.setData(
{
this.setData({
'pageParam.pageSize': 0,
loadingMore: false
},
() => {
let { currentAddress } = this.data
const { lat, lng } = currentAddress.location
let {
currentAddress
} = this.data
const {
lat,
lng
} = currentAddress.location
this.toGetCommodity(lat, lng)
}
)
......@@ -119,44 +122,50 @@ Page({
if (!this.data.commodityList.length) {
return
}
let { pageParam } = this.data
let {
pageParam
} = this.data
pageParam.pageSize++
this.setData(
{
this.setData({
pageParam,
loadingMore: true
},
() => {
let { currentAddress } = this.data
const { lat, lng } = currentAddress.location
let {
currentAddress
} = this.data
const {
lat,
lng
} = currentAddress.location
this.toGetCommodity(lat, lng)
}
)
},
// 新版
openMorePack(e) {
const { show } = e.currentTarget.dataset
const {
show
} = e.currentTarget.dataset
this.setData({
showMorePack: !show
})
},
// 页面跳转
// toAllEquityPage() {
// wx.navigateTo({
// url: '/packageEquity/pages/allEquity/allEquity'
// })
// wx.p.router.go('/packageEquity/pages/allEquity/allEquity')
// },
toBuyMember() {
wx.navigateTo({
url: '/packageEquity/pages/open/open'
})
wx.p.router.go('/packageEquity/pages/open/open')
},
toNewPage(e) {
const { index, item } = e.currentTarget.dataset
wx.navigateTo({
url: item.url
})
const {
index,
item
} = e.currentTarget.dataset
wx.p.router.go(item.url)
},
// 定位
......@@ -176,7 +185,12 @@ Page({
// 获取附近优惠数据
toGetCommodity(lat, lng, page) {
let { pageParam, loadingMore, commodityList, loadOver } = this.data
let {
pageParam,
loadingMore,
commodityList,
loadOver
} = this.data
let para = {
lat,
lng,
......@@ -233,7 +247,9 @@ Page({
},
// 获取门店套餐
getShopPackage() {
const { merchantId } = wx.p.storage.get('merchant_info')
const {
merchantId
} = wx.p.storage.get('merchant_info')
let para = {
merchantId
}
......@@ -246,9 +262,11 @@ Page({
// 去套餐详情页
toPackageDetail(e) {
const { id } = e.currentTarget.dataset
wx.navigateTo({
url: '/packageEquity/pages/package/package?id=' + id
const {
id
} = e.currentTarget.dataset
wx.p.router.go('/packageEquity/pages/package/package',{
id
})
},
......@@ -264,7 +282,8 @@ Page({
return
}
wx.p.api.equityApi.checkOpenMember().then(res => {
let flag = false, identity = 0 // 普通会员3 银卡2 金卡1 非会员 0
let flag = false,
identity = 0 // 普通会员3 银卡2 金卡1 非会员 0
if (res.data && res.data.validitDate) {
res.data.time = new Date(res.data.validitDate).format('yyyy.MM.dd')
}
......@@ -291,7 +310,9 @@ Page({
// 获取门店会员卡信息
getMemberCardData() {
const { merchantId } = wx.p.storage.get('merchant_info')
const {
merchantId
} = wx.p.storage.get('merchant_info')
let para = {
merchantId
}
......@@ -305,7 +326,11 @@ Page({
// 处理免费领取权益页面带来的参数---弹框显示
handleFreeCard(bindInfo) {
wx.p.storage.rm('bindInfo')
const { code, errId, message } = bindInfo
const {
code,
errId,
message
} = bindInfo
if (code == 0) {
wx.showModal({
title: '提示',
......@@ -350,7 +375,10 @@ Page({
else
wx.getLocation({
type: 'gcj02'
}).then(({ latitude, longitude }) => {
}).then(({
latitude,
longitude
}) => {
mapApi.detailedAdrress([latitude, longitude]).then(detail => {
let info = {
...detail,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!