Commit f5975d6f by liimin

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 ef1c62c9 6cbc98aa
......@@ -27,7 +27,6 @@ Component({
currentIndex: 0,
goodsNumber: 1,
showJfModal: false,
jfCount: 0,
detailInfo: {}
},
......@@ -35,13 +34,6 @@ Component({
* 组件的方法列表
*/
methods: {
computeJf(num) {
let {detailInfo, jfCount} = this.data
jfCount = NP.times(detailInfo.redeemPoints || 0, num)
this.setData({
jfCount
})
},
cancel() {
this.setData({
show: false
......@@ -50,6 +42,9 @@ Component({
},
setDefaultSku(detailInfo) {
let specificationDetailList = detailInfo.platformGlGoodsSpecifications && detailInfo.platformGlGoodsSpecifications[0]
if (detailInfo?.specificationData) {
specificationDetailList = detailInfo?.platformGlGoodsSpecifications?.find(val => val.specificationData == detailInfo.specificationData)
}
let defaultGoods = specificationDetailList?.specificationData.split('&')
detailInfo.platformGlGoodsSpecificationList?.map(e => {
defaultGoods.map(i => {
......@@ -62,7 +57,9 @@ Component({
})
})
this.setData({
detailInfo
detailInfo,
['detailInfo.goodsStock']: specificationDetailList?.stock || detailInfo.goodsStock, // 多规格商品库存在每个规格组中
goodsNumber: detailInfo?.sellQty || 1
})
},
// 选择规格
......@@ -99,7 +96,6 @@ Component({
},
changeCount(e) {
this.triggerEvent('getCount', e.detail)
this.computeJf(e.detail)
this.setData({
goodsNumber: e.detail
})
......@@ -118,9 +114,14 @@ Component({
toCreatedOrder() {
let { clickType, remain, detailInfo, defaultAddress, goodsNumber } = this.data
const userInfo = wx.p.storage.get('userInfo')
if (!['pay', 'join'].includes(clickType)) {
if (!['pay', 'join', 'change'].includes(clickType)) {
return this.cancel()
}
if (clickType == 'change') {
this.cancel()
return this.triggerEvent('changeSku', {specificationData: detailInfo.specificationData, sellQty: goodsNumber || detailInfo.startQty})
}
console.log(detailInfo)
if (!detailInfo.goodsStock) return
detailInfo.sellQty = goodsNumber || detailInfo.sellQty
detailInfo?.platformGlGoodsSpecifications?.forEach(val => {
......@@ -148,7 +149,6 @@ Component({
if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址')
}
console.log(detailInfo, '22222222')
// 跳转到确认订单
let query = {
defaultAddress,
......
......@@ -45,17 +45,17 @@
<view class="right flex_sc">
<!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> -->
<view class="stepper">
<stepper count="{{goodsNumber}}" max="{{detailInfo.goodsStock || 1}}" catchchange="changeCount"></stepper>
<stepper count="{{goodsNumber}}" max="{{detailInfo.goodsStock}}" catchchange="changeCount"></stepper>
</view>
</view>
</view>
<view class="textarea-box" wx:if="{{clickType != 'join'}}">
<view class="textarea-box" wx:if="{{clickType != 'join' && clickType != 'change'}}">
<view class="title">订单备注</view>
<view class="pannel">
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view>
</view>
<view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{clickType != 'join'}}">
<view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{clickType != 'join' && clickType != 'change'}}">
<view class="title">收货地址</view>
<view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
......
......@@ -27,7 +27,6 @@ Page({
onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => {
let userInfo = wx.p.storage.get('userInfo')
console.log(params, '2222')
this.setData({
goodsInfo: params,
userInfo
......@@ -69,7 +68,7 @@ Page({
wx.p.wxApi.showLoading()
homeApi.createOrder(params).then(res => {
wx.hideLoading()
wx.p.router.redirectTo('/packageIndex/pages/exchangeSuccess/index')
wx.p.router.reLaunch('/packageIndex/pages/exchangeSuccess/index')
})
}
},
......@@ -127,12 +126,46 @@ Page({
})
},
checkOut() {
let { money, walletObj } = this.data
let { money, walletObj, contactInfo } = this.data
if (money > walletObj?.currentScore) return // 积分不足
if (!Object.keys(contactInfo)?.length) return wx.p.wxApi.showToast('请选择收货地址')
this.setData({
showModal: true
})
},
// 多规格商品更换规格
handleChangeSku(e) {
let { target, index } = e.currentTarget.dataset
// 获取商品详情
this.getGoodsDetail(target, index)
},
getGoodsDetail(target, index) {
homeApi.getGoodsDetailInfo({id: target.id || target.goodsId, businessType: 1}).then(res => {
res.specificationData = target.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)
}
res.sellQty = target.sellQty
this.setData({
selectInfo: res || {},
showSku: true,
selectSkuIndex: index
})
})
},
changeSku(e) {
let {selectSkuIndex} = this.data
this.setData({
[`goodsInfo.goodsList[${selectSkuIndex}].specificationData`]: e.detail.specificationData,
[`goodsInfo.goodsList[${selectSkuIndex}].sellQty`]: e.detail.sellQty
}, () => {
this.getMoney(this.data.goodsInfo)
})
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
......@@ -148,7 +181,7 @@ Page({
let { goodsInfo } = this.data
mineApi.getCustomerAddressList().then(res => {
let obj = {}
res?.forEach(val => {
res?.forEach((val, index) => {
if ((!goodsInfo?.defaultAddress && val.isDefault == 1) ||
(goodsInfo?.defaultAddress?.id == val.id)) {
obj = {
......@@ -157,6 +190,14 @@ Page({
contactPhone: val.receiveMobile,
contactAddress: `${val.provinceName}${val.cityName}${val.countyName}${val.address}`
}
} else {
let data = res[0]
obj = {
...data,
contactName: data.receiveName,
contactPhone: data.receiveMobile,
contactAddress: `${data.provinceName}${data.cityName}${data.countyName}${data.address}`
}
}
})
this.setData({
......
......@@ -2,6 +2,7 @@
"navigationBarTitleText": "确认订单",
"usingComponents": {
"stepper": "/components/Stepper/Stepper",
"address":"/components/Adress/index"
"address":"/components/Adress/index",
"sku": "/components/Sku/index"
}
}
\ No newline at end of file
......@@ -40,8 +40,9 @@
<view class="text-hide">
{{item.goodsSkuName}}
</view>
<view class="specificationData-text">
<view class="text-hide description">{{item.specificationData || ''}}</view>
<view wx:if="{{item.specificationData}}" class="specificationData-text" bindtap="handleChangeSku" data-target="{{item}}" data-index="{{index}}">
<view class="text-hide description">{{item.specificationData}}</view>
<mp-icon icon="back" class="change-icon" color="#6E6E7A" size="{{8}}"></mp-icon>
</view>
</view>
<view class="price-box">
......@@ -96,6 +97,7 @@
</goods-action>
</block>
<address address="{{addressList}}" defaultAddress="{{contactInfo}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
<sku bind:cancelSku="closeSku" wx:if="{{showSku}}" show="{{showSku}}" goods="{{selectInfo}}" bindchangeSku="changeSku" clickType="change"></sku>
<Dialog show="{{ showModal }}" mask="true" bindbuttontap="dialogConfirm" buttons="{{buttons}}" title="积分兑换">
<view class="suggest-box">
<view>您当前总积分为<text>{{walletObj.currentScore}}</text>积分</view>
......
......@@ -93,6 +93,9 @@
.box .item .content .goods-info .text {
flex-shrink: 0;
width: calc(100% - 180rpx);
display: flex;
flex-direction: column;
justify-content: space-between;
}
.box .item .content .goods-info .text .price-box {
......@@ -165,7 +168,7 @@
color: #6E6E7A;
}
.text .specificationData-text .select {
.text .specificationData-text .change-icon {
margin-left: 8rpx;
transform: rotate(-90deg);
}
......
......@@ -20,6 +20,11 @@ Page({
})
},
back() {
clearInterval(this.timer)
wx.p.router.switchTab("/pages/tab/index/index")
},
countdown() {
this.timer = setInterval(() => {
let { count } = this.data
......@@ -64,7 +69,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload() {
clearInterval(this.timer)
},
/**
......
{
"usingComponents": {}
"usingComponents": {},
"navigationStyle": "custom"
}
\ No newline at end of file
/* packageIndex/pages/exchangeSuccess/index.wxss */
.back {
margin-left: 40rpx;
}
.container {
width: 100%;
height: 100vh;
......
<!--packageIndex/pages/exchangeSuccess/index.wxml-->
<view class="container">
<navigation-bar custom bindnavbarReady="navbarReady">
<view class="navigation">
<view class="back" bindtap="back">
<mp-icon icon="back" color="#2C2C2C" size="{{12}}"></mp-icon>
</view>
</view>
</navigation-bar>
<view class="icon">
<glsx-image src="/status/success.png"></glsx-image>
</view>
......
......@@ -185,7 +185,7 @@ Page({
detailInfo: res || {},
eventFlag: true,
activeSku: res.specificationData,
goodsStock: res.goodsStock
goodsStock: res.goodsStock || 0
})
})
},
......
......@@ -29,7 +29,7 @@
</view>
<view class="text">
<view class="text-hide">{{item.goodsSkuName}}</view>
<view class="specification" wx:if="{{item.specificationData}}">{{item.specificationData}}</view>
<view class="specification text-hide" wx:if="{{item.specificationData}}">{{item.specificationData}}</view>
<view class="price-box" wx:if="{{!item.flag}}">
<view class="price">
{{item.redeemPoints || 0}}
......
......@@ -101,6 +101,11 @@ Page({
// 获取积分商城配置
getHomeData() {
homeApi.getHomeConfigData({miniType: 1}).then(res => {
res?.specialEvents?.forEach(item => {
item?.specialEventGoodsList?.forEach(val => {
val.id = val.goodsId
})
})
this.setData({
bannerUrl: res?.mallBannerList[0]?.bannerUrl,
specialSaleArr: res.specialEvents
......@@ -180,7 +185,7 @@ Page({
params.merchantNo = userInfo?.merchantId
} else if (activeTab) { // 积分区间
params.storeStart = activeTab == 2 ? 0 : activeTab == 3 ? 100 : activeTab == 4 ? 200 : ''
params.storeEnd = activeTab == 2 ? 100 : activeTab == 3 ? 200 : activeTab == 4 ? 300 : ''
params.storeEnd = activeTab == 2 ? 99 : activeTab == 3 ? 200 : activeTab == 4 ? 300 : ''
}
homeApi.getGoodsStockroomList(params).then(res => {
this.setData({
......@@ -221,6 +226,7 @@ Page({
handleSearch(e) {
this.setData({
goodsSkuName: e.detail,
goodsList: [],
pageNum: 1
}, () => {
this.getGoodsList()
......@@ -232,6 +238,7 @@ Page({
this.setData({
activeTab: e.detail.activeTab,
frontendCategoryId: e.detail?.activeSubTab,
goodsList: [],
pageNum: 1
}, () => {
this.getGoodsList()
......
......@@ -51,6 +51,9 @@
font-weight: 700;
}
}
.arrow-icon {
margin-left: 10rpx;
}
}
.layout {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!