Commit f3b1a0ab by 李伟康

修复

1 parent 6a6b3892
...@@ -15,30 +15,28 @@ Component({ ...@@ -15,30 +15,28 @@ Component({
methods: { methods: {
toDetail() { toDetail() {
const { businessInfo, address } = this.data const { businessInfo, address } = this.data
let query = { let param = {
supplier: businessInfo.supplier, supplier: businessInfo.supplier,
brandName: businessInfo.brandName, brandName: businessInfo.brandName,
lat: address.location.lat, lat: address.location.lat,
lng: address.location.lng, lng: address.location.lng,
} }
const temp = JSON.stringify(query) wx.p.router.go('/packageEquity/pages/commodity/detail/detail',{
wx.navigateTo({ param
url: '/packageEquity/pages/commodity/detail/detail?param=' + temp
}) })
}, },
toDetailPage(e) { toDetailPage(e) {
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
const { businessInfo, address } = this.data const { businessInfo, address } = this.data
let query = { let param = {
supplier: businessInfo.supplier, supplier: businessInfo.supplier,
brandName: businessInfo.brandName, brandName: businessInfo.brandName,
lat: address.location.lat, lat: address.location.lat,
lng: address.location.lng, lng: address.location.lng,
id: item.id id: item.id
} }
const temp = JSON.stringify(query) wx.p.router.go('/packageEquity/pages/commodity/detail/detail',{
wx.navigateTo({ param
url: '/packageEquity/pages/commodity/detail/detail?param=' + temp
}) })
}, },
......
...@@ -99,13 +99,14 @@ Page({ ...@@ -99,13 +99,14 @@ Page({
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
let url = '' let url = ''
if (item.appearance == 1) { if (item.appearance == 1) {
let para = { let param = {
supplier: item.supplier, supplier: item.supplier,
brandName: item.brandName, brandName: item.brandName,
location: true location: true
} }
const temp = JSON.stringify(para) wx.p.router.go('/packageEquity/pages/commodity/detail/detail',{
url = '/packageEquity/pages/commodity/detail/detail?param=' + temp param
})
} else if (item.appearance == 2) { } else if (item.appearance == 2) {
let para = { let para = {
supplier: item.supplier, supplier: item.supplier,
......
...@@ -8,7 +8,7 @@ Page({ ...@@ -8,7 +8,7 @@ Page({
}, },
onLoad: function(options) { onLoad: function (options) {
console.log(wx.p); console.log(wx.p);
let query = JSON.parse(options.query) let query = JSON.parse(options.query)
this.setData({ this.setData({
...@@ -17,12 +17,10 @@ Page({ ...@@ -17,12 +17,10 @@ Page({
}, },
toOrderList() { toOrderList() {
wx.redirectTo({ wx.redirectTo({
url:'/packageMine/pages/order/index/index' url: '/packageMine/pages/order/index/index'
}) })
}, },
toBack() { toBack() {
wx.navigateBack({ wx.p.router.back()
delta: 1
})
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -34,7 +34,7 @@ Page({ ...@@ -34,7 +34,7 @@ Page({
let tempArr = [] let tempArr = []
res.map(item => { res.map(item => {
let newArr = [] let newArr = []
if (item.chargeGoddsList) { if (item && item.chargeGoddsList) {
item.chargeGoddsList.forEach(ele => { item.chargeGoddsList.forEach(ele => {
ele.denominationList.forEach(info => { ele.denominationList.forEach(info => {
let tempObj = { let tempObj = {
......
import { decimal } from '~/utils/format' import {
decimal
} from '~/utils/format'
import mapApi from '../../../../utils/mapapi/mapapi' import mapApi from '../../../../utils/mapapi/mapapi'
Page({ Page({
data: { data: {
...@@ -10,18 +12,19 @@ Page({ ...@@ -10,18 +12,19 @@ Page({
currentIndex: 0, currentIndex: 0,
richText: '', richText: '',
showModal: false, showModal: false,
isGameUse:false, isGameUse: false,
coupons:null, coupons: null,
showCoupons:false, showCoupons: false,
showComponent:false showComponent: false
}, },
noScroll(){}, noScroll() {},
onShow: function () { onShow: function () {
this.toCheckMember() this.toCheckMember()
}, },
onLoad: function (options) { onLoad: function (options) {
options = JSON.stringify(options)==='{}'?this.options:options // options = JSON.stringify(options) === '{}' ? this.options : options
const query = options ? JSON.parse(decodeURIComponent(options.param)) : this.data.query // const query = options ? JSON.parse(decodeURIComponent(options.param)) : this.data.query
const query = options.param
this.setNaviTitle(query.brandName) this.setNaviTitle(query.brandName)
if (!query.lat) { if (!query.lat) {
const tem = wx.p.storage.get('address_info') const tem = wx.p.storage.get('address_info')
...@@ -38,7 +41,7 @@ Page({ ...@@ -38,7 +41,7 @@ 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,
...@@ -49,22 +52,26 @@ Page({ ...@@ -49,22 +52,26 @@ Page({
}) })
}, },
// 处理广汇权益明细进入的卡券 // 处理广汇权益明细进入的卡券
handleEquityOfGH(couponsItem){ handleEquityOfGH(couponsItem) {
let {curentGoodsItem} = this.data let {
curentGoodsItem.payCouponsPrice = decimal(curentGoodsItem.lineationPrice-(Number(couponsItem.denomination)), 2) curentGoodsItem
} = this.data
curentGoodsItem.payCouponsPrice = 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.payCouponsPrice = decimal(curentGoodsItem.lineationPrice-(Number(couponsItem.denomination)), 2) curentGoodsItem
} = this.data
curentGoodsItem.payCouponsPrice = decimal(curentGoodsItem.lineationPrice - (Number(couponsItem.denomination)), 2)
this.setData({ this.setData({
curentGoodsItem, curentGoodsItem,
coupons:couponsItem coupons: couponsItem
}) })
}, },
// 选择优惠券 // 选择优惠券
...@@ -80,7 +87,10 @@ Page({ ...@@ -80,7 +87,10 @@ Page({
// }, // },
// 选择商品 // 选择商品
selectGoodsItem(e) { selectGoodsItem(e) {
const { index, item } = e.currentTarget.dataset const {
index,
item
} = e.currentTarget.dataset
let richText = '' let richText = ''
if (item.buysNotes) { if (item.buysNotes) {
richText = decodeURIComponent(item.buysNotes) richText = decodeURIComponent(item.buysNotes)
...@@ -97,7 +107,7 @@ Page({ ...@@ -97,7 +107,7 @@ Page({
}, },
// 查询会员开通情况 // 查询会员开通情况
toCheckMember() { toCheckMember() {
if(this.data.isGameUse)return if (this.data.isGameUse) return
const SID = wx.p.storage.get('sessionId') const SID = wx.p.storage.get('sessionId')
if (!SID) { if (!SID) {
return return
...@@ -114,10 +124,17 @@ Page({ ...@@ -114,10 +124,17 @@ Page({
}) })
}, },
// 获取商品信息 // 获取商品信息
toGetCommodity(query,options) { toGetCommodity(query, options) {
let { curentGoodsItem, currentIndex,isGameUse,coupons } = this.data let {
let tem = {...query} curentGoodsItem,
if(tem.id&&!isGameUse){ currentIndex,
isGameUse,
coupons
} = this.data
let tem = {
...query
}
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 => {
...@@ -147,11 +164,11 @@ Page({ ...@@ -147,11 +164,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({
...@@ -162,16 +179,16 @@ Page({ ...@@ -162,16 +179,16 @@ Page({
query, query,
currentIndex, currentIndex,
to: `to-${currentIndex}`, to: `to-${currentIndex}`,
showComponent:true, showComponent: true,
showLogin: false showLogin: false
}) })
if (!tempList.length) { if (!tempList.length) {
wx.p.wxApi.showToast('原商品已下架,已为您推荐其他商品') wx.p.wxApi.showToast('原商品已下架,已为您推荐其他商品')
setTimeout(()=>{ setTimeout(() => {
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}); });
},1500) }, 1500)
return return
} }
this.toGetCommodityStock(query.id || tempList[0].id) this.toGetCommodityStock(query.id || tempList[0].id)
...@@ -184,7 +201,10 @@ Page({ ...@@ -184,7 +201,10 @@ Page({
} }
wx.hideLoading() wx.hideLoading()
wx.p.api.equityApi.checkStock(para).then(res => { wx.p.api.equityApi.checkStock(para).then(res => {
const { code, data } = res const {
code,
data
} = res
let flag = false let flag = false
if (code == 0 && data != 0) { if (code == 0 && data != 0) {
flag = true flag = true
...@@ -207,12 +227,19 @@ Page({ ...@@ -207,12 +227,19 @@ Page({
if (!isLogin) { if (!isLogin) {
return return
} }
const { curentGoodsItem, isHaveInventory,isGameUse } = this.data const {
curentGoodsItem,
isHaveInventory,
isGameUse
} = this.data
if (!isHaveInventory) { if (!isHaveInventory) {
return return
} }
if(isGameUse)return this.comfirmBuyItem() if (isGameUse) return this.comfirmBuyItem()
const { noMemberPrice, salesPrice } = curentGoodsItem const {
noMemberPrice,
salesPrice
} = curentGoodsItem
let diffPrice = 0 let diffPrice = 0
if (noMemberPrice) { if (noMemberPrice) {
diffPrice = decimal(noMemberPrice - salesPrice, 2) diffPrice = decimal(noMemberPrice - salesPrice, 2)
...@@ -242,7 +269,11 @@ Page({ ...@@ -242,7 +269,11 @@ Page({
if (!orderCode) { if (!orderCode) {
return return
} }
const { curentGoodsItem,coupons,isGameUse } = this.data const {
curentGoodsItem,
coupons,
isGameUse
} = this.data
let para = { let para = {
orderCode, orderCode,
goodsId: curentGoodsItem.id, goodsId: curentGoodsItem.id,
...@@ -250,7 +281,7 @@ Page({ ...@@ -250,7 +281,7 @@ Page({
// payMannerId: 19, // payMannerId: 19,
paySource: 3, paySource: 3,
} }
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 => {
...@@ -260,7 +291,13 @@ Page({ ...@@ -260,7 +291,13 @@ Page({
}, },
// 处理支付 // 处理支付
handlePay(payData, orderCode) { handlePay(payData, orderCode) {
const { timeStamp, nonceStr, packages, signType, paySign } = payData const {
timeStamp,
nonceStr,
packages,
signType,
paySign
} = payData
let self = this let self = this
wx.requestPayment({ wx.requestPayment({
timeStamp: timeStamp, timeStamp: timeStamp,
...@@ -299,7 +336,9 @@ Page({ ...@@ -299,7 +336,9 @@ Page({
}, },
// /**获取当前位置 */ // /**获取当前位置 */
getLocation(query) { getLocation(query) {
this.getAddressInfo().then(({ location }) => { this.getAddressInfo().then(({
location
}) => {
query.lat = location.lat query.lat = location.lat
query.lng = location.lng query.lng = location.lng
this.toGetCommodity(query) this.toGetCommodity(query)
...@@ -310,7 +349,9 @@ Page({ ...@@ -310,7 +349,9 @@ Page({
}, },
// 重新收起获取定位 // 重新收起获取定位
relocation() { relocation() {
const { query } = this.data const {
query
} = this.data
const tem = wx.p.storage.get('address_info') const tem = wx.p.storage.get('address_info')
query.lat = tem ? tem.location.lat : '' query.lat = tem ? tem.location.lat : ''
query.lng = tem ? tem.location.lng : '' query.lng = tem ? tem.location.lng : ''
...@@ -321,7 +362,9 @@ Page({ ...@@ -321,7 +362,9 @@ Page({
return return
} }
this.toGetCommodity(query) this.toGetCommodity(query)
this.setData({ query }) this.setData({
query
})
}, },
/**授权失败 */ /**授权失败 */
authFail() { authFail() {
...@@ -335,7 +378,9 @@ Page({ ...@@ -335,7 +378,9 @@ Page({
}, },
// 打开地图 // 打开地图
openMap() { openMap() {
const { addressInfo } = this.data const {
addressInfo
} = this.data
if (!addressInfo || !addressInfo.latitude) { if (!addressInfo || !addressInfo.latitude) {
this.relocation() this.relocation()
return return
...@@ -360,7 +405,7 @@ Page({ ...@@ -360,7 +405,7 @@ Page({
flag = false flag = false
this.setData({ this.setData({
showLogin: true, showLogin: true,
showComponent:false showComponent: false
}) })
} }
return flag return flag
...@@ -395,7 +440,10 @@ Page({ ...@@ -395,7 +440,10 @@ Page({
else else
wx.getLocation({ wx.getLocation({
type: 'gcj02' type: 'gcj02'
}).then(({ latitude, longitude }) => { }).then(({
latitude,
longitude
}) => {
mapApi.detailedAdrress([latitude, longitude]).then(detail => { mapApi.detailedAdrress([latitude, longitude]).then(detail => {
let info = { let info = {
...detail, ...detail,
......
...@@ -120,9 +120,4 @@ Page({ ...@@ -120,9 +120,4 @@ Page({
url: '/packageEquity/pages/agreement/index' url: '/packageEquity/pages/agreement/index'
}) })
}, },
// toActive() {
// wx.navigateTo({
// url: '/packageShopmall/packageEquity/pages/active/active'
// })
// }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -119,9 +119,6 @@ Page({ ...@@ -119,9 +119,6 @@ Page({
wx.redirectTo({ wx.redirectTo({
url: '/packageEquity/pages/packageDetail/packageDetail?orderCode=' + query.orderCode url: '/packageEquity/pages/packageDetail/packageDetail?orderCode=' + query.orderCode
}) })
// wx.navigateBack({
// delta: 1
// })
}, 3000) }, 3000)
}) })
} }
......
// packageMall/pages/detail/detail.js // packageMall/pages/detail/detail.js
import { import {
centsToyuan, centsToyuan
iosTimeFormat
} from '~/utils/format' } from '~/utils/format'
const navStyle = 'background-color: transparent;' const navStyle = 'background-color: transparent;'
let navBarHeight = 38 let navBarHeight = 38
...@@ -127,8 +126,8 @@ Page({ ...@@ -127,8 +126,8 @@ Page({
}) })
}, },
goodsActionClick(e) { goodsActionClick(e) {
let type = e.detail let type = e.detail,
let { {
activeSku, activeSku,
isActivity, isActivity,
goodsInfo: { goodsInfo: {
...@@ -137,18 +136,12 @@ Page({ ...@@ -137,18 +136,12 @@ Page({
buyFlag buyFlag
} }
} = this.data } = this.data
if (activeSku) { if (activeSku) return this.showSkuFun()
this.showSkuFun()
return
}
if (isActivity && activityStatus != 2) return if (isActivity && activityStatus != 2) return
if (goodsStock == 0) return if (goodsStock == 0) return
if (buyFlag == 2) return if (buyFlag == 2) return
if (type == 'pay') { if (type == 'pay') this.pay()
this.pay() else this.join()
} else {
this.join()
}
}, },
async pay(e) { async pay(e) {
const loginStatus = await wx.p.router.intercept() const loginStatus = await wx.p.router.intercept()
......
...@@ -21,9 +21,6 @@ Page({ ...@@ -21,9 +21,6 @@ Page({
wx.p.router.go(url, { wx.p.router.go(url, {
orderCode: item orderCode: item
}) })
// wx.navigateTo({
// url: '/packageMine/pages/order/detail/detail?orderCode=S2112081509592138'
// })
}, },
state(e) { state(e) {
let { let {
......
...@@ -15,8 +15,9 @@ Page({ ...@@ -15,8 +15,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
async onLoad(options) { async onLoad(options) {
console.log('---------------- 页面初始化 ----------------')
console.log('初始化数据:', options)
systemApi.getImageVersion() //获取图片版本号 systemApi.getImageVersion() //获取图片版本号
console.log(options, '===')
this.tabList = __wxConfig.tabBar.list this.tabList = __wxConfig.tabBar.list
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
//scenc获取页面参数并跳转 //scenc获取页面参数并跳转
...@@ -49,7 +50,7 @@ Page({ ...@@ -49,7 +50,7 @@ Page({
wx.p.storage.rm('userInfo') wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId') wx.p.storage.rm('sessionId')
} }
console.log(data, '=============') console.log('登陆信息:', data)
if (options.url) { if (options.url) {
return this.jumpPage(options.url) return this.jumpPage(options.url)
} }
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
import { import {
systemApi systemApi
} from '~/api/index' } from '~/api/index'
import {
IMG_URL
} from '~/config'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -40,7 +43,7 @@ Component({ ...@@ -40,7 +43,7 @@ Component({
wx.getChannelsLiveInfo({ wx.getChannelsLiveInfo({
finderUserName, finderUserName,
success(liveInfo) { success(liveInfo) {
console.log(liveInfo, '视频号直播') console.log('视频号直播信息:', liveInfo)
if (liveInfo.status == 3) { if (liveInfo.status == 3) {
_this.getChannelsLiveNoticeInfo(finderUserName, auto) _this.getChannelsLiveNoticeInfo(finderUserName, auto)
liveInfo = null liveInfo = null
...@@ -60,7 +63,7 @@ Component({ ...@@ -60,7 +63,7 @@ Component({
wx.getChannelsLiveNoticeInfo({ wx.getChannelsLiveNoticeInfo({
finderUserName, finderUserName,
success(liveNoticeInfo) { success(liveNoticeInfo) {
console.log(liveNoticeInfo, '视频号预告') console.log('视频号预告信息:', liveNoticeInfo)
let startTime = liveNoticeInfo.startTime * 1e3, let startTime = liveNoticeInfo.startTime * 1e3,
month = new Date(startTime).format('M'), month = new Date(startTime).format('M'),
day = new Date(startTime).format('d'), day = new Date(startTime).format('d'),
...@@ -77,7 +80,7 @@ Component({ ...@@ -77,7 +80,7 @@ Component({
if (!auto) _this.close() if (!auto) _this.close()
}, },
fail(err) { fail(err) {
console.log(err) console.log('视频号预告信息:', err)
_this.setData({ _this.setData({
liveNoticeInfo: null liveNoticeInfo: null
}) })
...@@ -119,7 +122,7 @@ Component({ ...@@ -119,7 +122,7 @@ Component({
animation: true animation: true
}, setTimeout(() => { }, setTimeout(() => {
this.setBanner() this.setBanner()
}, .5e3)) }, .8e3))
else this.setBanner() else this.setBanner()
}, },
async setBanner() { async setBanner() {
...@@ -129,7 +132,7 @@ Component({ ...@@ -129,7 +132,7 @@ Component({
liveNoticeInfo, liveNoticeInfo,
finderUserName finderUserName
} = this.data, } = this.data,
bannerImg = `https://img02.glsx.com.cn/weapp/resource/miniprogram/hmd/home/live/${liveInfo ? 'live' :'notice'}.png?v=${v}`, bannerImg = `${IMG_URL}home/live/${liveInfo ? 'live' :'notice'}.png?v=${v}`,
thisPage = wx.p.router.getPageInstance() thisPage = wx.p.router.getPageInstance()
let { let {
bannerList bannerList
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!