Commit d58f9c17 by wangzhihui

Merge branch 'SAAS+V4.56.0-0908' of http://192.168.3.233:8090/saas/mini-program/…

…points-mall into SAAS+V4.56.0-0908
2 parents c7542061 a44e0d1c
...@@ -80,11 +80,10 @@ Component({ ...@@ -80,11 +80,10 @@ Component({
}) })
}) })
let specificationData = activeList.join('&') let specificationData = activeList.join('&')
let goodsStock, saleAmount let goodsStock
platformGlGoodsSpecifications?.map(val => { platformGlGoodsSpecifications?.map(val => {
if (val.specificationData == specificationData) { if (val.specificationData == specificationData) {
goodsStock = val.stock goodsStock = val.stock
saleAmount = val.saleAmount
} }
}) })
this.setData({ this.setData({
...@@ -95,8 +94,7 @@ Component({ ...@@ -95,8 +94,7 @@ Component({
const thisPage = wx.p.router.getPageInstance() const thisPage = wx.p.router.getPageInstance()
thisPage.setData({ thisPage.setData({
activeSku: specificationData, activeSku: specificationData,
goodsStock, goodsStock
saleAmount
}) })
}, },
changeCount(e) { changeCount(e) {
...@@ -150,6 +148,7 @@ Component({ ...@@ -150,6 +148,7 @@ Component({
if(!defaultAddress.receiveName){ if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址') return wx.p.wxApi.showToast('请选择收货地址')
} }
console.log(detailInfo, '22222222')
// 跳转到确认订单 // 跳转到确认订单
let query = { let query = {
defaultAddress, defaultAddress,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="container"> <view class="container">
<view class="goods-box flex_sc"> <view class="goods-box flex_sc">
<view class="cover"> <view class="cover">
<glsx-image class="cover" src="{{detailInfo.imageResponses[0].imgUrl}}" /> <glsx-image class="cover" src="{{detailInfo.goodsSource == 2 ? detailInfo.goodsImage : detailInfo.imageResponses[0].imgUrl}}" />
</view> </view>
<view class="right-box"> <view class="right-box">
<view class="price-box"> <view class="price-box">
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<view wx:else class="stock">暂无存货</view> <view wx:else class="stock">暂无存货</view>
<block> <block>
<view wx:if="{{detailInfo.goodsSource == 1}}" class="selct-box">已选:{{goodsNumber}}{{detailInfo.goodsUnit}}</view> <view wx:if="{{detailInfo.goodsSource == 1}}" class="selct-box">已选:{{goodsNumber}}{{detailInfo.goodsUnit}}</view>
<view wx:else class="selct-box">已选:{{detailInfo.specificationData}}</view> <view wx:if="{{detailInfo.specificationData}}" class="selct-box">已选:{{detailInfo.specificationData}}</view>
</block> </block>
</view> </view>
</view> </view>
......
...@@ -28,33 +28,31 @@ Page({ ...@@ -28,33 +28,31 @@ Page({
// 加入购物车 // 加入购物车
handleAddToCart(e) { handleAddToCart(e) {
let value = e.detail let value = e.detail
let { userInfo } = this.data // let { userInfo } = this.data
const PARAMS = { // const PARAMS = {
goodsId: value.goodsId, // goodsId: value.goodsId,
sellQty: 1, // sellQty: 1,
goodsSource: value.goodsSource, // goodsSource: value.goodsSource,
scoreSource: userInfo?.channelSource, // scoreSource: userInfo?.channelSource,
merchantId: userInfo?.merchantId // merchantId: userInfo?.merchantId
} // }
if (!value.goodsStock) return wx.p.wxApi.showToast('暂无库存') // if (!value.goodsStock) return wx.p.wxApi.showToast('暂无库存')
if (value.goodsSource == 1) { // if (value.goodsSource == 1) {
cartApi.addToCart(PARAMS).then(res => { // cartApi.addToCart(PARAMS).then(res => {
wx.p.wxApi.showToast('加入购物车成功') // wx.p.wxApi.showToast('加入购物车成功')
}) // })
} else { // } else {
// 获取商品详情 // 获取商品详情
this.getDetail(value) this.getDetail(value)
} // }
}, },
getDetail(options) { getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => { homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => {
res.goodsSource = options.goodsSource // if (res && res.specificationResponses?.length) {
if (res && res.specificationResponses?.length) { // this.toGetSpecString(res, res.startQty)
this.toGetSpecString(res, res.startQty) // }
}
if (res && res.platformGlGoodsSpecifications?.length) { if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {} let item = res.platformGlGoodsSpecifications[0] || {}
res.redeemPoints = item.retailPrice
res.goodsStock = item.stock res.goodsStock = item.stock
res.specificationData = item.specificationData res.specificationData = item.specificationData
this.setData({ this.setData({
......
...@@ -27,6 +27,7 @@ Page({ ...@@ -27,6 +27,7 @@ Page({
onLoad: function (options) { onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then(params => {
let userInfo = wx.p.storage.get('userInfo') let userInfo = wx.p.storage.get('userInfo')
console.log(params, '2222')
this.setData({ this.setData({
goodsInfo: params, goodsInfo: params,
userInfo userInfo
...@@ -49,7 +50,7 @@ Page({ ...@@ -49,7 +50,7 @@ Page({
let orderGoodsList = [] let orderGoodsList = []
goodsInfo?.goodsList?.map(val => { goodsInfo?.goodsList?.map(val => {
orderGoodsList.push({ orderGoodsList.push({
goodsId: val.id, goodsId: val.id || val.goodsId, // 商品详情下单是id ,购物车结算是goodsId
sellQty: val?.sellQty, sellQty: val?.sellQty,
specificationData: val?.specificationData, specificationData: val?.specificationData,
goodsSkuCode: val.goodsSkuCode, goodsSkuCode: val.goodsSkuCode,
...@@ -109,7 +110,7 @@ Page({ ...@@ -109,7 +110,7 @@ Page({
goodsList.forEach(el => { goodsList.forEach(el => {
money = NP.plus(money, NP.times(el.redeemPoints || 0, el.sellQty || 0)) //总价 money = NP.plus(money, NP.times(el.redeemPoints || 0, el.sellQty || 0)) //总价
goodsNum = NP.plus(goodsNum, el.sellQty) goodsNum = NP.plus(goodsNum, el.sellQty)
el.goodsImage = el.goodsImageUrl || el.imageResponses[0]?.imgUrl // 购物车结算和订单详情下单图片数据有区别 el.goodsImage = el.goodsImageUrl || el.goodsImage || el.imageResponses[0]?.imgUrl // 购物车结算和订单详情下单图片数据有区别
expressFeeArray.push(el.expressFee || 0) expressFeeArray.push(el.expressFee || 0)
}) })
//取运费最大值 //取运费最大值
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<view class="content"> <view class="content">
<view class="goods-info"> <view class="goods-info">
<view class="preview"> <view class="preview">
<image webp src="{{item.goodsImageUrl}}"></image> <image webp src="{{item.goodsImage || item.goodsImageUrl}}"></image>
</view> </view>
<view class="text"> <view class="text">
<view class="name"> <view class="name">
......
...@@ -70,26 +70,31 @@ Page({ ...@@ -70,26 +70,31 @@ Page({
let userInfo = wx.p.storage.get('userInfo') let userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo}) this.setData({userInfo})
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then(params => {
this.setData({pageParams: params}) this.setData({pageParams: params}, () => {this.heartbeatFn({type: 'add'})})
this.getDetail(params) this.getDetail(params)
this.heartbeatFn({type: 'add'})
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
}) })
this.getPlatFormAddress() this.getPlatFormAddress()
}, },
onShow() {
this.heartbeatFn({type: 'add'})
},
heartbeatFn(e) { heartbeatFn(e) {
let eventApi = e.type == 'add' ? 'dynamicRecordAdd' : 'dynamicRecordLeave' let eventApi = e.type == 'add' ? 'dynamicRecordAdd' : 'dynamicRecordLeave'
let { pageParams, userInfo } = this.data let { pageParams, userInfo, reviewId } = this.data
let params = { if (!pageParams) return
goodsId: pageParams.id, let params = e.type == 'add' ? {
goodsId: pageParams?.id,
goodsType: 1, goodsType: 1,
customerMobile: userInfo?.phone, customerMobile: userInfo?.phone,
customerName: userInfo?.nickName, customerName: userInfo?.nickName,
merchantId: userInfo?.merchantId, merchantId: userInfo?.merchantId,
merchantName: userInfo?.merchantName, merchantName: userInfo?.merchantName,
} } : {id: reviewId}
commonApi[eventApi](params) commonApi[eventApi](params).then(res => {
this.setData({reviewId: res?.data})
})
}, },
showSkuModal(type) { showSkuModal(type) {
this.setData({ this.setData({
...@@ -161,22 +166,26 @@ Page({ ...@@ -161,22 +166,26 @@ Page({
// 获取详情 // 获取详情
getDetail(options) { getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => { homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => {
res.goodsSource = options.goodsSource
if (res && res.specificationResponses?.length) { if (res && res.specificationResponses?.length) {
this.toGetSpecString(res, res.startQty) this.toGetSpecString(res, res.startQty)
} }
if (res && res.platformGlGoodsSpecifications?.length) { if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {} let item = res.platformGlGoodsSpecifications[0] || {}
res.goodsStock = item.stock res.goodsStock = item.stock
res.saleAmount = item.saleAmount
res.specificationData = item.specificationData res.specificationData = item.specificationData
} }
res?.platformGoodsResources?.forEach(item => {
if (item.resType == 1) item.imgUrl = item.content
})
if (res.goodsSource == 2) {
res.imageResponses = res?.platformGoodsResources?.filter(val => val.bizType == 1)
res.goodsDescList = res?.platformGoodsResources?.filter(val => val.bizType == 2)
}
this.setData({ this.setData({
detailInfo: res || {}, detailInfo: res || {},
eventFlag: true, eventFlag: true,
activeSku: res.specificationData, activeSku: res.specificationData,
goodsStock: res.goodsStock, goodsStock: res.goodsStock
saleAmount: res.saleAmount
}) })
}) })
}, },
...@@ -233,6 +242,9 @@ Page({ ...@@ -233,6 +242,9 @@ Page({
} }
}) })
}, },
onHide() {
this.heartbeatFn({type: 'level'})
},
onUnload: function () { onUnload: function () {
this.heartbeatFn({type: 'level'}) this.heartbeatFn({type: 'level'})
}, },
......
...@@ -127,17 +127,17 @@ page { ...@@ -127,17 +127,17 @@ page {
width: 100%; width: 100%;
} }
.title { .title {
width: 80rpx; width: 110rpx;
font-size: 24rpx; font-size: 24rpx;
color: #707071; color: #707071;
} }
.content { .content {
width: 520rpx; width: 490rpx;
height: 44rpx; height: 44rpx;
font-size: 24rpx; font-size: 24rpx;
color: #2D2D2E; color: #2D2D2E;
.text { .text {
width: 520rpx; width: 490rpx;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -159,6 +159,11 @@ page { ...@@ -159,6 +159,11 @@ page {
color: #282829; color: #282829;
font-weight: 500; font-weight: 500;
} }
.content {
font-size: 24rpx;
background-color: #fff;
padding: 0 40rpx;
}
} }
} }
.inner { .inner {
......
...@@ -45,13 +45,13 @@ ...@@ -45,13 +45,13 @@
<view class="market-price">¥{{detailInfo.marketPrice}}</view> <view class="market-price">¥{{detailInfo.marketPrice}}</view>
</view> </view>
<view class="count"> <view class="count">
<text>剩余 {{goodsStock}}</text> | <text>销售 {{saleAmount}}</text> <text>剩余 {{goodsStock}}</text> | <text>销售 {{detailInfo.saleAmount}}</text>
</view> </view>
</view> </view>
<view class="goods-title"><text wx:if="{{detailInfo.goodsSource == 1}}">{{detailInfo.brandName}}</text>{{detailInfo.goodsSkuName}}</view> <view class="goods-title"><text wx:if="{{detailInfo.goodsSource == 1}}">{{detailInfo.brandName}}</text>{{detailInfo.goodsSkuName}}</view>
</view> </view>
<view class="container-item select-params-box"> <view class="container-item select-params-box">
<view class="cell" bind:tap="showSkuModal" data-type="choose"> <view class="cell" bind:tap="showSkuModal" data-type="choose" wx:if="{{skuInfo || activeSku}}">
<view class="flex"> <view class="flex">
<view class="title">已选</view> <view class="title">已选</view>
<view class="content flex_ccc"> <view class="content flex_ccc">
...@@ -85,23 +85,23 @@ ...@@ -85,23 +85,23 @@
</view> </view>
</view> </view>
</block> </block>
<view wx:if="{{detailInfo.goodsSource == 2 && detailInfo.serviceDesc}}"> <view class="cell" wx:if="{{detailInfo.goodsSource == 2 && detailInfo.serviceDesc}}">
<view class="title">服务说明</view> <view class="title">服务说明</view>
<view class="content flex_ccc"> <view class="content flex_ccc">
<text>{{goodsInfo.serviceDesc}}</text> <view class="text">{{detailInfo.serviceDesc}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="goods-detail-box" wx:if="{{detailInfo.goodsDescribe || goodsInfo.goodsDescList.length}}"> <view class="goods-detail-box" wx:if="{{detailInfo.goodsDescribe || detailInfo.goodsDescList.length}}">
<view class="title">商品详情</view> <view class="title">商品详情</view>
<view class="image-list-wrap" wx:if="{{detailInfo.goodsSource == 1}}"> <view class="image-list-wrap" wx:if="{{detailInfo.goodsSource == 1}}">
<mp-html content="{{detailInfo.goodsDescribe}}"></mp-html> <mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view> </view>
<view wx:else> <view wx:else>
<block wx:for="{{goodsInfo.goodsDescList}}" wx:key="index"> <block wx:for="{{detailInfo.goodsDescList}}" wx:key="index">
<view class="content"> <view class="content">
<block wx:if="{{item.resType == 1}}"> <block wx:if="{{item.resType == 1}}">
<image webp src="{{item.content}}" mode="widthFix" bindtap="previewImage" data-current="{{item.content}}" data-item="{{goodsInfo.goodsDescList}}" lazy-load></image> <image webp src="{{item.content}}" mode="widthFix" lazy-load></image>
</block> </block>
<block wx:elif="{{item.resType == 2}}"> <block wx:elif="{{item.resType == 2}}">
{{item.content}} {{item.content}}
......
...@@ -56,6 +56,46 @@ Page({ ...@@ -56,6 +56,46 @@ Page({
}) })
}) })
}, },
// 加入购物车
handleAddToCart(e) {
let value = e.detail
// let { userInfo } = this.data
// const PARAMS = {
// goodsId: value.id,
// sellQty: 1,
// goodsSource: value.goodsSource,
// scoreSource: userInfo?.channelSource,
// merchantId: userInfo?.merchantId
// }
// if (value.goodsSource == 1) {
// if (!value.goodsStock) return wx.p.wxApi.showToast('暂无库存')
// cartApi.addToCart(PARAMS).then(res => {
// wx.p.wxApi.showToast('加入购物车成功')
// })
// } else {
// 获取商品详情
this.getDetail(value)
// }
},
getDetail(options) {
wx.p.api.homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => {
// if (res && res.specificationResponses?.length) {
// this.toGetSpecString(res, res.startQty)
// }
if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {}
res.goodsStock = item.stock
res.specificationData = item.specificationData
this.setData({
activeSku: item.specificationData
})
}
this.setData({
detailInfo: res || {},
showSku: true
})
})
},
getTaxRate() { getTaxRate() {
const { const {
phone, phone,
......
{ {
"usingComponents": { "usingComponents": {
"goods": "/components/goods/goods" "goods": "/components/goods/goods",
"sku": "/components/Sku/index"
}, },
"navigationBarTitleText": "积分提现" "navigationBarTitleText": "积分提现"
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
</view> </view>
</view> </view>
</view> </view>
<sku bind:cancelSku="closeSku" wx:if="{{showSku}}" bind:getCount="getCount" show="{{showSku}}" goods="{{detailInfo}}" clickType="join"></sku>
<Dialog show="{{ showConfirmDialog }}" mask="true" bindbuttontap="bindButton" buttons="{{confirmButtons}}" title="提示"> <Dialog show="{{ showConfirmDialog }}" mask="true" bindbuttontap="bindButton" buttons="{{confirmButtons}}" title="提示">
<view class="suggest-box"> <view class="suggest-box">
请确认是否将{{sumbitScore}}积分进行兑换 请确认是否将{{sumbitScore}}积分进行兑换
......
...@@ -107,7 +107,7 @@ Page({ ...@@ -107,7 +107,7 @@ Page({
wx.p.wxApi.showToast("删除成功"); wx.p.wxApi.showToast("删除成功");
setTimeout(() => { setTimeout(() => {
this.getUserAddressList(); this.getUserAddressList();
}, 1.5e3); }, 500);
}); });
} }
}); });
......
...@@ -201,7 +201,9 @@ Page({ ...@@ -201,7 +201,9 @@ Page({
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () {}, onPullDownRefresh: function () {
this.getShoppingcartList()
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
......
...@@ -2,5 +2,8 @@ ...@@ -2,5 +2,8 @@
"navigationBarTitleText": "购物车", "navigationBarTitleText": "购物车",
"usingComponents": { "usingComponents": {
"stepper": "/components/Stepper/Stepper" "stepper": "/components/Stepper/Stepper"
} },
"onReachBottomDistance": 10,
"backgroundTextStyle": "dark",
"enablePullDownRefresh": true
} }
\ No newline at end of file \ No newline at end of file
...@@ -263,13 +263,11 @@ Page({ ...@@ -263,13 +263,11 @@ Page({
}, },
getDetail(options) { getDetail(options) {
homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => { homeApi.getGoodsDetailInfo({id: options.id, businessType: 1}).then(res => {
res.goodsSource = options.goodsSource
// if (res && res.specificationResponses?.length) { // if (res && res.specificationResponses?.length) {
// this.toGetSpecString(res, res.startQty) // this.toGetSpecString(res, res.startQty)
// } // }
if (res && res.platformGlGoodsSpecifications?.length) { if (res && res.platformGlGoodsSpecifications?.length) {
let item = res.platformGlGoodsSpecifications[0] || {} let item = res.platformGlGoodsSpecifications[0] || {}
res.redeemPoints = item.retailPrice
res.goodsStock = item.stock res.goodsStock = item.stock
res.specificationData = item.specificationData res.specificationData = item.specificationData
this.setData({ this.setData({
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<view class="page-title">积分商城</view> <view class="page-title">积分商城</view>
</navigation-bar> </navigation-bar>
<view class="bg"> <view class="bg">
<glsx-image src="{{bannerUrl || 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png'}}"></glsx-image> <glsx-image wx:if="{{!bannerUrl}}" src="/index/index-bg.png"></glsx-image>
<image wx:else src="{{bannerUrl}}" mode=""/>
</view> </view>
<block wx:if="{{navHeight}}"> <block wx:if="{{navHeight}}">
<view class="container-box"> <view class="container-box">
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
<!-- 专场 --> <!-- 专场 -->
<view class="special-sale-box"> <view class="special-sale-box">
<view class="item" wx:for="{{specialSaleArr}}" wx:key="index" bindtap="handleSpecialSale" data-target="{{item}}"> <view class="item" wx:for="{{specialSaleArr}}" wx:key="index" bindtap="handleSpecialSale" data-target="{{item}}">
<glsx-image src="{{item.entryImage}}"></glsx-image> <image src="{{item.entryImage}}"></image>
<view class="item-name">{{item.eventName}}</view> <view class="item-name">{{item.eventName}}</view>
</view> </view>
</view> </view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!