Commit 95344d0c 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 7e08a5b5 86b06ea6
Showing 49 changed files with 1430 additions and 446 deletions
...@@ -76,5 +76,9 @@ module.exports = { ...@@ -76,5 +76,9 @@ module.exports = {
/**获取用户信息 */ /**获取用户信息 */
getLoginInfo(data) { getLoginInfo(data) {
return http.fetch('scrm.api.sso.weapp.loginfo.get', {...data}) return http.fetch('scrm.api.sso.weapp.loginfo.get', {...data})
},
/**获取门店数据 */
getMerchantData(data) {
return http.fetch('scrm.api.shopmall.score.list.merchant', {...data})
} }
}; };
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"pages/tab/cart/index", "pages/tab/cart/index",
"pages/tab/mine/index", "pages/tab/mine/index",
"pages/webView/webView", "pages/webView/webView",
"pages/Login/Login" "pages/Login/Login",
"pages/chooseMerchant/index"
], ],
"requiredPrivateInfos": [ "requiredPrivateInfos": [
"getLocation" "getLocation"
...@@ -60,7 +61,8 @@ ...@@ -60,7 +61,8 @@
"pages/integral/withdrawalRules/withdrawalRules", "pages/integral/withdrawalRules/withdrawalRules",
"pages/confirmOrder/index", "pages/confirmOrder/index",
"pages/exchangeSuccess/index", "pages/exchangeSuccess/index",
"pages/integral/withdrawalDetail/withdrawalDetail" "pages/integral/withdrawalDetail/withdrawalDetail",
"pages/selfGoodsDetail/index"
] ]
}, },
{ {
......
...@@ -4,19 +4,21 @@ Component({ ...@@ -4,19 +4,21 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
idIndex: Number, defaultAddress: Object,
address:Array, address:Array,
show: { show: {
type: Boolean, type: Boolean,
observer: function (val, o) { observer: function (val, o) {
if (val && this.properties.address.length) { if (val && this.properties.address.length) {
console.log(this.properties.defaultAddress?.id)
this.properties.address.forEach((item, index) => { this.properties.address.forEach((item, index) => {
if (item.id == this.properties.idIndex) { if (item.id == this.properties.defaultAddress?.id) {
this.setData({ item.active = true
currentIndex: index,
})
} }
}) })
this.setData({
address: this.properties.address
})
} }
} }
}, },
...@@ -27,7 +29,6 @@ Component({ ...@@ -27,7 +29,6 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
currentIndex: 0,
addressList: [] addressList: []
}, },
...@@ -36,10 +37,9 @@ Component({ ...@@ -36,10 +37,9 @@ Component({
*/ */
methods: { methods: {
back() { back() {
// this.triggerEvent('getAddress', { addressInfo: this.data.addressInfo })
this.cancel() this.cancel()
}, },
addNew () { addNew (e) {
let { url } = e.currentTarget.dataset let { url } = e.currentTarget.dataset
wx.p.router.go(url,{ wx.p.router.go(url,{
platform:true, platform:true,
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
} }
.container {
height: 100%;
}
.address-container { .address-container {
position: fixed; position: fixed;
left: 0; left: 0;
...@@ -22,7 +18,7 @@ ...@@ -22,7 +18,7 @@
.container { .container {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 80%; height: 65%;
box-sizing: border-box; box-sizing: border-box;
background: #FFFFFF; background: #FFFFFF;
border-radius: 32rpx 32rpx 0 0; border-radius: 32rpx 32rpx 0 0;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="footer flex_cc"> <view class="footer flex_cc">
<view bind:tap="addNew" data-url="/packageShopmall/packageMine/pages/address/detail/detail" class="btn flex_cc">新增地址</view> <view bind:tap="addNew" data-url="/packageMine/pages/address/detail/detail" class="btn flex_cc">新增地址</view>
<view bind:tap="confirm" class="btn confirm_btn flex_cc">确认</view> <view bind:tap="confirm" class="btn confirm_btn flex_cc">确认</view>
</view> </view>
</view> </view>
......
...@@ -22,7 +22,7 @@ Component({ ...@@ -22,7 +22,7 @@ Component({
*/ */
methods: { methods: {
confirm() { confirm() {
this.triggerEvent('confirm') this.setData({show: false})
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
// pages/Login/components/EnableWallet/EnableWallet.js // pages/Login/components/EnableWallet/EnableWallet.js
import commonApi from '~/api/module/common.js'
Component({ Component({
/** /**
...@@ -10,7 +11,12 @@ Component({ ...@@ -10,7 +11,12 @@ Component({
}, },
walletObj: { walletObj: {
type: Object, type: Object,
value: {} value: {},
observer: function(n) {
this.setData({
copyWalletObj: JSON.parse(JSON.stringify(n))
})
}
} }
}, },
...@@ -40,7 +46,26 @@ Component({ ...@@ -40,7 +46,26 @@ Component({
methods: { methods: {
// 关闭弹窗 // 关闭弹窗
closeWallet() { closeWallet() {
this.triggerEvent('close') let { copyWalletObj } = this.data
this.setData({show: false})
// 仅替换积分数据返回的内容,使用copyWalletObj 防止修改弹窗内容也做了替换
this.replaceNickName(copyWalletObj)
},
// 替换积分钱包名称
replaceNickName(data) {
let userInfo = wx.p.cache.userInfo.getUserInfo()
commonApi.replaceWalletName({
nickName: data?.name,
phone: data?.phone,
scoreSource: data?.scoreSource
}).then(res => {
let { code, message } = res
if (code == 0) {
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
} else {
wx.p.wxApi.showToast(message)
}
})
}, },
input(e) { input(e) {
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
...@@ -50,12 +75,28 @@ Component({ ...@@ -50,12 +75,28 @@ Component({
[`walletObj.${target}`]: value [`walletObj.${target}`]: value
}) })
}, },
// 一键开通积分钱包
enableWalletConfirm() {
let { walletObj } = this.data
commonApi.openPointsWallet(walletObj).then(res => {
let { code, message } = res
if (code == 0) {
this.setData({
showEnableSuccess: true,
show: false
})
this.replaceNickName(walletObj)
} else {
wx.p.wxApi.showToast(message)
}
})
},
// 开通 // 开通
confirm() { confirm() {
let { walletObj } = this.data let { walletObj } = this.data
if (!walletObj?.name) return wx.p.wxApi.showToast('姓名不能为空') if (!walletObj?.name) return wx.p.wxApi.showToast('姓名不能为空')
if (!walletObj?.phone || !/^[1]([3-9])[0-9]{9}$/.test(walletObj?.phone)) return wx.p.wxApi.showToast('请输入正确手机号') if (!walletObj?.phone || !/^[1]([3-9])[0-9]{9}$/.test(walletObj?.phone)) return wx.p.wxApi.showToast('请输入正确手机号')
this.triggerEvent('confirm', {walletObj}) this.enableWalletConfirm()
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"enable-success": "/components/EnableSuccess/EnableSuccess"
}
}
\ No newline at end of file \ No newline at end of file
...@@ -33,4 +33,6 @@ ...@@ -33,4 +33,6 @@
<view class="wallet-btn" bindtap="confirm">一键开通</view> <view class="wallet-btn" bindtap="confirm">一键开通</view>
</view> </view>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</view>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
\ No newline at end of file \ No newline at end of file
// components/Goods/Goods.js // components/Goods/Goods.js
import { import homeApi from '~/api/module/home.js'
centsToyuan
} from '~/utils/format'
import cartApi from '~/api/module/cart.js' import cartApi from '~/api/module/cart.js'
Component({ Component({
/** /**
...@@ -39,12 +37,12 @@ Component({ ...@@ -39,12 +37,12 @@ Component({
// 进入商品详情 // 进入商品详情
handleSale(e) { handleSale(e) {
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
wx.p.router.go('/packageIndex/pages/goodsDetail/index', target) // 自营商品与云中鹤商品数据不同
let url = target?.goodsSource == 1 ? '/packageIndex/pages/goodsDetail/index' : '/packageIndex/pages/selfGoodsDetail/index'
wx.p.router.go(url, target)
}, },
// 加入购物车
joinCart(e) { joinCart(e) {
let { target } = e.currentTarget.dataset this.handleSale(e)
this.triggerEvent('join', target)
} }
}, },
lifetimes: { lifetimes: {
......
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {}
"sku": "../Sku/index"
}
} }
\ No newline at end of file \ No newline at end of file
// components/selfSku/index.js
import { centsToyuan } from '~/utils/format'
import cartApi from '~/api/module/cart.js'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer(n) {
if (n)
this.setData({
close: false
})
}
},
showName: String,
skuData: {
type: Object,
observer(n) {
this.setDefaultSku(n)
}
},
clickType: String,
defaultAds: String,
defaultAddress: Object
},
/**
* 组件的初始数据
*/
data: {
goodsNumber: 1
},
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setDefaultSku(skuData) {
let { specificationList } = skuData
let [specificationDetailList] = skuData.specificationDetailList
let defaultGoods = specificationDetailList.specificationData.split('&')
specificationList.map(e => {
defaultGoods.map(i => {
let [key, value] = i.split('-')
if (key == e.specificationName) {
e.specificationValueList.map(c => {
if (c.specificationValue == value) c.active = true
})
}
})
})
specificationDetailList.retailPrice = centsToyuan(specificationDetailList.retailPrice)
this.setData({
skuObj: skuData,
goodsInfo: specificationDetailList
})
},
choose(e) {
let { ind, index } = e.currentTarget.dataset
let {
skuObj: { specificationList, id, specificationExtraList }
} = this.data
let activeList = []
if (specificationList[index].specificationValueList[ind].active) return
specificationList[index].specificationValueList.map(i => (i.active = false))
specificationList[index].specificationValueList[ind].active = true
specificationList.map(i => {
i.specificationValueList.map(c => {
if (c.active) activeList.push(`${i.specificationName}-${c.specificationValue}`)
})
})
let specificationData = activeList.join('&')
this.setData({
[`skuObj.specificationList[${index}]`]: specificationList[index]
})
shopmallApi
.getGoodsSpecificationExtra({
goodsId: id,
specificationData
})
.then(data => {
data.retailPrice = centsToyuan(data.retailPrice)
this.setData({
goodsInfo: data
})
console.log(this.data.goodsInfo)
})
this.setData({
goodsNumber: 1
})
const thisPage = wx.p.router.getPageInstance()
thisPage.setData({
activeSku: specificationData
})
},
changeCount(e) {
let goodsNumber = e.detail
this.setData({
goodsNumber
})
},
closeSku() {
let thisPage = wx.p.router.getPageInstance()
let { showName } = this.data
this.setData({
close: true
}, () => {
thisPage.setData({
[showName]: false
})
})
},
intRemain(e) {
this.setData({
remain: e.detail.value
})
},
toShowAddressModal() {
let thisPage = wx.p.router.getPageInstance()
thisPage.setData({
showAddress: true
})
},
toCreatedOrder() {
let { clickType, goodsInfo, goodsNumber } = this.data
let userInfo = wx.p.storage.get('userInfo')
if (!clickType) {
return this.cancel()
}
if (clickType == 'join') {
console.log('加入购物车成功')
const PARAMS = {
goodsId: goodsInfo.id,
sellQty: goodsNumber,
goodsSkuCode: goodsInfo.goodsSkuCode,
goodsSource: goodsInfo.goodsSource,
scoreSource: userInfo?.channelSource
}
cartApi.addToCart(PARAMS).then(res => {
this.cancel()
wx.$api.showToast('加入购物车成功')
})
return
}
const { remain, goods, defaultAddress,staffShop } = this.data
console.log(defaultAddress)
if(!defaultAddress.receiveName){
return wx.p.wxApi.showToast('请选择收货地址')
}
// 跳转到确认订单
let query = {
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:staffShop?userStorage.weChatOpenId:userInfo.openId,
buyerMsg: remain,
orderGoodsList: [{
goodsSkuCode: goods.goodsSkuCode,
goodsSkuName: goods.goodsSkuName,
sellQty: goodsNumber,
}],
}
wx.p.router.go('/packageIndex/pages/confirmOrder/index', query)
},
cancel() {
this.setData({
show: false
})
this.triggerEvent('cancelSku')
},
},
lifetimes: {
attached() {
}
}
})
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"address":"../Adress/index",
"stepper": "/components/Stepper/Stepper" "stepper": "/components/Stepper/Stepper"
} }
} }
\ No newline at end of file \ No newline at end of file
/* components/selfSku/index.wxss */
.sku {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
}
.sku-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
}
.sku-box {
position: absolute;
bottom: 0;
width: 100%;
height: 76%;
background: #FFFFFF;
border-radius: 16rpx 16rpx 0 0;
left: 0;
z-index: 2;
}
.sku-box.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.sku-content {
box-sizing: border-box;
height: calc(100% - 100rpx);
}
.sku-content .view {
padding: 0 40rpx;
}
.sku-content .goods-box {
display: flex;
align-items: center;
position: sticky;
background-color: #fff;
z-index: 2;
top: 0;
padding-bottom: 18rpx;
}
.sku-content .goods-box .preview {
width: 180rpx;
height: 180rpx;
border-radius: 4rpx;
margin-right: 40rpx;
overflow: hidden;
margin-top: 40rpx;
}
.sku-content .goods-box .goods-info {
width: calc(100% - 220rpx);
}
.sku-content .goods-box .price {
color: #FC5B32;
font-size: 64rpx;
margin-bottom: 10rpx;
font-weight: 600;
}
.sku-content .goods-box .price text {
font-size: 40rpx;
margin-left: 4rpx;
}
.sku-content .goods-box .count {
color: #858A94;
font-size: 20rpx;
margin-bottom: var(--borderRadius);
}
.sku-content .goods-box .active {
font-size: 20rpx;
color: #3F444D;
}
.sku-box .sku-list {
padding-bottom: 40rpx;
}
.sku-box .sku-title {
color: #0A0D14;
font-weight: 500;
padding-top: 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.sku-title .value {
color: #0A0D14;
font-weight: normal;
}
.sku-box .sku-item {
display: flex;
flex-wrap: wrap;
}
.sku-box .sku-item .item {
height: 52rpx;
background: #F7F8FA;
padding: 0 20rpx;
margin: 20rpx 20rpx 0 0;
font-size: 24rpx;
color: #3F444D;
box-sizing: border-box;
border-radius: 12rpx;
display: flex;
align-items: center;
}
.sku-box .sku-item .item.active {
border: 2rpx solid #FC5B32;
color: #FC5B32;
background-color: #fc5b320f;;
}
.sku-btn-box {
height: 100rpx;
padding: 10rpx var(--margin);
}
.sku-btn {
border-radius: var(--borderRadius);
display: flex;
overflow: hidden;
}
.sku-btn .join,
.sku-btn .pay {
flex: 1;
height: 80rpx;
color: #fff;
}
.sku-btn .join {
background-color: #FDC23E;
}
.sku-btn .pay {
background-color: var(--btnColor);
}
.disabled{
background-color: #B1B1B3 !important;
/* border-color: #B1B1B3 !important; */
color: #000000!important;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
.textarea-box {
margin-top: 48rpx;
.title {
font-weight: 400;
font-size: 28rpx;
color: #4C4D4F;
margin-bottom: 20rpx;
}
.pannel {
width: 100%;
box-sizing: border-box;
padding: 16rpx 20rpx;
height: 128rpx;
background: #F5F6FA;
border-radius: 16rpx;
.textarea-placeholder {
font-weight: 400;
font-size: 24rpx;
color: #9E9EA8;
}
.textArea {
height: 100%;
}
}
}
.adress-box {
margin-top: 52rpx;
.title {
font-weight: 400;
font-size: 28rpx;
color: #1B233D;
}
.content {
font-weight: 400;
font-size: 24rpx;
color: #333435;
width: 490rpx;
text-align: right;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 8rpx;
}
.emptyText {
color: #858A94;
}
.pos {
width: 36rpx;
height: 36rpx;
}
}
.btn-wrap {
position: fixed;
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
padding: 8rpx 40rpx 68rpx;
background: white;
.btn {
width: 100%;
height: 80rpx;
background: #FB8A32;
border-radius: 20rpx;
font-weight: 500;
font-size: 30rpx;
color: #FFFFFF;
}
.diable_btn{
background: #999999;
color: #FFFFFF;
border: none;
box-shadow: none;
}
}
\ No newline at end of file \ No newline at end of file
<!--components/selfSku/index.wxml-->
<view class="sku" catchtouchmove="noScroll" hidden="{{!show}}">
<view class="sku-bg" bindtap="closeSku"></view>
<view class="sku-box isFullSucreen">
<scroll-view class="sku-content" scroll-y>
<view class="view">
<view class="goods-box">
<view class="preview">
<image webp src="{{skuObj.goodsImage || skuObj.activityImg}}"></image>
</view>
<view class="goods-info">
<view class="price">
{{goodsInfo.retailPrice}}<text>积分</text>
</view>
<view class="count">
<block wx:if="{{goodsInfo.stock}}">
有货(库存{{goodsInfo.stock}})
</block>
<block wx:else>无货</block>
</view>
<view class="active text-hide">已选:{{goodsInfo.specificationData}}</view>
</view>
</view>
<view class="sku-list">
<block wx:for="{{skuObj.specificationList}}" wx:key="index">
<view class="sku-title">{{item.specificationName}}</view>
<view class="sku-item">
<block wx:for="{{item.specificationValueList}}" wx:key="ind" wx:for-index="ind" wx:for-item="i">
<view class="item text-center {{i.active?'active':''}} {{i.stock ===0?'disabled':''}}" bindtap="choose" data-index="{{index}}"
data-ind="{{ind}}">{{i.specificationValue}}</view>
</block>
</view>
</block>
<view class="sku-title">
数量
<stepper count="{{goodsNumber}}" max="{{goodsInfo.stock}}" bindchange="changeCount"></stepper>
</view>
<view class="sku-title">
发货
<view class="value">快递:{{skuObj.expressFee||'免运费(请以提交订单时为准)'}}</view>
</view>
</view>
<view class="textarea-box" wx:if="{{clickType != 'join'}}">
<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 class="title">收货地址</view>
<view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
<mp-icon icon="arrow" bind:tap="showSkuModal" color="#B1B1B3" size="{{10}}"></mp-icon>
</view>
</view>
</view>
</scroll-view>
<view class="btn-wrap flex_cc">
<view bind:tap="toCreatedOrder" class="btn flex_cc">确认</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageMall/pages/pay/pay.js // packageMall/pages/pay/pay.js
// import { shopmallApi, mineApi } from '~/api/api' // import { shopmallApi, mineApi } from '~/api/api'
import NP from 'number-precision'
let timer let timer
Page({ Page({
/** /**
...@@ -7,12 +8,8 @@ Page({ ...@@ -7,12 +8,8 @@ Page({
*/ */
data: { data: {
contactInfo: {}, contactInfo: {},
orderCouponDTO: '', //最大优惠券 goodsInfo: {},
userCouponDTOS: [], //优惠券列表, goodsNum: 0,
couponCost: 0,
goodsNumber: 1,
isPay: false,
isCoupon: true,
shopFlag: true, shopFlag: true,
shopCartFlag: true, shopCartFlag: true,
addressFlag: true, addressFlag: true,
...@@ -30,22 +27,20 @@ Page({ ...@@ -30,22 +27,20 @@ Page({
onLoad: function (options) { onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then(params => {
console.log(params) console.log(params)
params = { // params = {
contactInfo: { // contactInfo: {
contactAddress: '广东省智园崇文园区1号楼14楼崇文园区1号楼2222', // contactAddress: '广东省智园崇文园区1号楼14楼崇文园区1号楼2222',
contactName: '文晶晶', // contactName: '文晶晶',
contactPhone: '15707380000' // contactPhone: '15707380000'
}, // },
isDefault: 1, // isDefault: 1,
goodsList: params.goodsList // goodsList: params.goodsList
} // }
this.setData({ this.setData({
contactInfo: params.contactInfo, goodsInfo: params
isDefault: params.isDefault,
goodsList: params.goodsList
}) })
// this.getDetail(options) // this.getDetail(options)
this.getMoney() this.getMoney(params)
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
}) })
...@@ -54,33 +49,6 @@ Page({ ...@@ -54,33 +49,6 @@ Page({
if(obj.platformShop){ if(obj.platformShop){
this.platformShop= Boolean(obj.platformShop) this.platformShop= Boolean(obj.platformShop)
} }
if (obj.isPay) {
//单个商品进来
let { isActivity, params, contactInfo, goodsList, goodsInfo } = obj
if (goodsList.unit && goodsList.unit == '万') goodsList.retailPrice = goodsList.retailPrice * 10000
this.setData({
merchantName: goodsList.merchantName,
goodsInfo: goodsInfo,
goodsList: [goodsList],
orderParams: params,
addressFlag: true,
isPay: true,
contactInfo,
isDefault: obj.isDefault,
isActivity
})
let orderGoods = this.data.orderParams.orderGoodsList
if (goodsInfo.deliveryType == 1) {
this.setData({
shopFlag: false
})
}
if (goodsInfo.deliveryType == 2) {
this.setData({
shopCartFlag: true
})
}
} else {
//购物车过来 //购物车过来
let orderGoods = [] let orderGoods = []
if(obj.platformShop){ if(obj.platformShop){
...@@ -102,7 +70,6 @@ Page({ ...@@ -102,7 +70,6 @@ Page({
this.setData({ this.setData({
...obj ...obj
}) })
}
}) })
}, },
dialogConfirm(e) { dialogConfirm(e) {
...@@ -115,61 +82,31 @@ Page({ ...@@ -115,61 +82,31 @@ Page({
} }
}, },
changeCount(e) { changeCount(e) {
console.log(e) let count = e.detail,
let { index, id } = e.currentTarget.dataset {
let goodsNumber = e.detail index
let { orderParams, goodsList } = this.data } = e.currentTarget.dataset
goodsList[index].goodsNumber = goodsNumber const name = `goodsInfo.goodsList[${index}].goodsNumber`
for (let i = 0; i < orderParams.orderGoodsList.length; i++) {
console.log(orderParams.orderGoodsList[i].goodsId == id)
if (orderParams.orderGoodsList && orderParams.orderGoodsList[i].goodsId == id) {
orderParams.orderGoodsList[i].goodsNumber = goodsNumber
this.setData({
orderParams
})
}
}
let orderGoods = this.data.orderParams.orderGoodsList
this.setData({ this.setData({
orderParams, [name]: count
goodsList }, async () => {
this.getMoney(this.data.goodsInfo)
}) })
}, },
getMoney() { // 计算商品总价或者积分
let { isActivity, goodsList, couponCost, isPay } = this.data getMoney(goodsInfo) {
let expressFeeArray = [] const goodsList = goodsInfo.goodsList
if (isActivity) { if (!goodsList || !goodsList.length) return
couponCost = 0 let money = 0,
} goodsNum = 0
let retailPrice = 0 goodsList.forEach(el => {
let expressFee = 0 money = NP.plus(money, NP.times(el.retailPrice, el.goodsNumber)) //总价
let goodsNumber = 0 goodsNum = NP.plus(goodsNum, el.goodsNumber)
let sum = 0 })
if (isPay) {
retailPrice = Number(goodsList[0].retailPrice)
expressFee = Number(goodsList[0].expressFee)
goodsNumber = Number(goodsList[0].goodsNumber)
sum = Number(retailPrice * goodsNumber + expressFee).toFixed(2)
} else {
goodsList.map(e => {
expressFeeArray.push(e.expressFee)
// expressFee += e.expressFee
goodsNumber += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
})
//取运费最大值
expressFeeArray.sort((a, b) => {
return b - a
})
expressFee = expressFeeArray[0]
sum = sum + expressFee
}
let money = (parseFloat(sum) - parseFloat(couponCost)).toFixed(2)
this.setData({ this.setData({
sum: sum, money,
expressFee, goodsNum,
goodsNumber, goodsInfo
money
}) })
}, },
checkOut() { checkOut() {
...@@ -184,7 +121,7 @@ Page({ ...@@ -184,7 +121,7 @@ Page({
} }
/**购物车 */ /**购物车 */
let ids = [] let ids = []
let { contactInfo, orderParams, orderCouponDTO, goodsList, isPay, goodsInfo, shopCartFlag } = this.data let { contactInfo, orderParams, goodsList, isPay, goodsInfo, shopCartFlag } = this.data
goodsList.map(e => ids.push(e.id)) goodsList.map(e => ids.push(e.id))
if (!isPay) { if (!isPay) {
//购物车结算 //购物车结算
......
{ {
"navigationBarTitleText": "确认订单" "navigationBarTitleText": "确认订单",
"usingComponents": {
"stepper": "/components/Stepper/Stepper"
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</block> </block>
</block> </block>
<view class="content-box"> <view class="content-box">
<block wx:for="{{goodsList}}" wx:key="index"> <block wx:for="{{goodsInfo.goodsList}}" wx:key="index">
<view class="item"> <view class="item">
<view class="content"> <view class="content">
<view class="goods-info"> <view class="goods-info">
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
{{item.retailPrice}} {{item.retailPrice}}
<text>积分</text> <text>积分</text>
</view> </view>
<view class="goods-num"> <stepper data-item="{{item}}" count="{{item.goodsNumber}}" max="{{item.goodsStock}}" data-id="{{item.goodsId}}" bindchange="changeCount" data-index="{{index}}"></stepper>
x{{item.goodsNumber}}
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -82,7 +80,7 @@ ...@@ -82,7 +80,7 @@
<view class="goods-action"> <view class="goods-action">
<view class="left"> <view class="left">
<view class="radio"> <view class="radio">
共{{goodsNumber}}件,合计: 共{{goodsNum}}件,合计:
</view> </view>
<view class="total"> <view class="total">
<view class="price"> <view class="price">
......
...@@ -105,14 +105,6 @@ ...@@ -105,14 +105,6 @@
font-weight: 500; font-weight: 500;
} }
.box .item .content .goods-info .text .price-box .goods-num {
height: 36rpx;
padding: 0 16rpx;
background: #FFFFFF;
border: 1rpx solid #DCDFE6;
border-radius: 20rpx;
}
.all-box { .all-box {
margin-top: 24rpx; margin-top: 24rpx;
padding: 0 24rpx; padding: 0 24rpx;
......
import NP from 'number-precision'
import cartApi from '~/api/module/cart.js'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -8,16 +6,12 @@ Component({ ...@@ -8,16 +6,12 @@ Component({
show: Boolean, show: Boolean,
address: Array, address: Array,
type: String, type: String,
goods: { goods: Object,
type: Object,
observer: function(n) {
this.setDefaultSku(n)
}
},
defaultAddress: Object, defaultAddress: Object,
defaultAds: String, defaultAds: String,
staffShop:Boolean, staffShop:Boolean,
canPay:Boolean canPay:Boolean,
clickType: String
}, },
data: { data: {
currentIndex: 0, currentIndex: 0,
...@@ -30,26 +24,6 @@ Component({ ...@@ -30,26 +24,6 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
setDefaultSku(skuData) {
let { specificationList } = skuData
let [specificationDetailList] = skuData.specificationDetailList
console.log(specificationDetailList, specificationList)
let defaultGoods = specificationDetailList.specificationData.split('&')
specificationList.map(e => {
defaultGoods.map(i => {
let [key, value] = i.split('-')
if (key == e.specificationName) {
e.specificationValueList.map(c => {
if (c.specificationValue == value) c.active = true
})
}
})
})
specificationDetailList.retailPrice = specificationDetailList.retailPrice
this.setData({
goods: skuData
})
},
computeJf(num) { computeJf(num) {
let {goods,jfCount,staffShop} = this.data let {goods,jfCount,staffShop} = this.data
if(!staffShop)return if(!staffShop)return
...@@ -72,7 +46,8 @@ Component({ ...@@ -72,7 +46,8 @@ Component({
}) })
}, },
toShowAddressModal() { toShowAddressModal() {
this.setData({ let thisPage = wx.p.router.getPageInstance()
thisPage.setData({
showAddress: true showAddress: true
}) })
}, },
...@@ -88,39 +63,17 @@ Component({ ...@@ -88,39 +63,17 @@ Component({
remain: e.detail.value remain: e.detail.value
}) })
}, },
choose(e) {
let { ind, index } = e.currentTarget.dataset
let {
goods: { specificationList, specificationDetailList }
} = this.data
let activeList = []
if (specificationList[index].specificationValueList[ind].active) return
specificationList[index].specificationValueList.map(i => (i.active = false))
specificationList[index].specificationValueList[ind].active = true
specificationList.map(i => {
i.specificationValueList.map(c => {
if (c.active) activeList.push(`${i.specificationName}-${c.specificationValue}`)
})
})
let specificationData = activeList.join('&')
this.setData({
[`goods.specificationList[${index}]`]: specificationList[index]
})
this.setData({
goodsNumber: 1
})
const thisPage = wx.p.router.getPageInstance()
thisPage.setData({
activeSku: specificationData
})
},
toCreatedOrder() { toCreatedOrder() {
const userInfo = wx.p.storage.get('userInfo') let { clickType } = this.data
const { remain, goods, goodsNumber, defaultAddress,staffShop, clickType } = this.data if (clickType != 'pay') {
return this.cancel()
}
const { remain, goods, goodsNumber, defaultAddress,staffShop } = this.data
if(!defaultAddress.receiveName){ if(!defaultAddress.receiveName){
return wx.$api.showToast('请选择收货地址') return wx.p.wxApi.showToast('请选择收货地址')
} }
const params = { // 跳转到确认订单
let query = {
receiveName: defaultAddress.receiveName, receiveName: defaultAddress.receiveName,
receiveMobile: defaultAddress.receiveMobile, receiveMobile: defaultAddress.receiveMobile,
provinceId: defaultAddress.provinceId, provinceId: defaultAddress.provinceId,
...@@ -138,20 +91,7 @@ Component({ ...@@ -138,20 +91,7 @@ Component({
sellQty: goodsNumber, sellQty: goodsNumber,
}], }],
} }
if (clickType == 'join') { wx.p.router.go('/packageIndex/pages/confirmOrder/index', query)
// 添加购物车
cartApi.addToCart().then(res => {
let { code, message } = res
if (code == 0) {
this.closeSku()
wx.p.wxApi.showToast('加入购物车成功')
} else {
wx.p.wxApi.showToast(message)
}
})
} else {
wx.p.router.go('/pageIndex/pages/confirmOrder/index')
}
} }
} }
}) })
{
"component": true,
"usingComponents": {
"stepper": "/components/Stepper/Stepper"
}
}
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
right: 0; right: 0;
top: 0; top: 0;
z-index: 9; z-index: 9;
height: 100vh;
.sku-bg { .sku-bg {
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -79,34 +80,25 @@ ...@@ -79,34 +80,25 @@
} }
.sku-list { .sku-list {
.sku-title { display: flex;
color: #2D2D2E; flex-wrap: wrap;
font-weight: 500;
padding-top: var(--margin); .sku {
display: flex; padding: 6rpx 20rpx;
align-items: center; background: #F7F8FA;
justify-content: space-between; border-radius: 4rpx;
} margin-right: 16rpx;
.sku-item { margin-bottom: 20rpx;
display: flex; }
flex-wrap: wrap;
.item { .sku_active {
height: 52rpx; background: #fc5b320f;
background: #F7F8FA; border: 2rpx solid #FC5B32;
padding: 0 20rpx; border-radius: 4rpx;
margin: 20rpx 20rpx 0 0; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #656566; color: #FC5B32;
border: 2rpx solid #F7F8FA; }
box-sizing: border-box;
border-radius: 4rpx;
&.active {
border-color: rgb(252, 91, 50);
color: rgb(252, 91, 50);
background-color: rgba(252, 91, 50, .06);
}
}
}
} }
} }
......
...@@ -8,28 +8,22 @@ ...@@ -8,28 +8,22 @@
</view> </view>
<view class="right-box"> <view class="right-box">
<view class="price-box"> <view class="price-box">
<text class="price">{{goods.salePrice || 35}}</text><text>积分</text> <text class="price">{{goods.sellPrice}}</text><text>积分</text>
</view> </view>
<view wx:if="{{goods.goodsStock}}" class="stock">有货(库存{{goods.goodsStock}})</view> <view wx:if="{{goods.stock}}" class="stock">有货(库存{{goods.stock}})</view>
<view wx:else class="stock">暂无存货</view> <view wx:else class="stock">暂无存货</view>
<view class="selct-box">已选:{{goodsNumber}}{{goods.goodsUnit}}</view> <block>
<view wx:if="{{goods.goodsSource == '2'}}" class="selct-box">已选:{{goods.specificationData}}</view>
<view wx:else class="selct-box">已选:{{goodsNumber}}{{goods.goodsUnit}}</view>
</block>
</view> </view>
</view> </view>
<view class="sku-box"> <view class="sku-box">
<view class="title">规格</view> <view class="title">规格</view>
<view class="sku-list"> <view class="sku-list">
<block wx:for="{{goods.specificationList}}" wx:key="index"> <block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku-title">{{item.specificationName}}</view>
<view class="sku-item">
<block wx:for="{{item.specificationValueList}}" wx:key="ind" wx:for-index="ind" wx:for-item="i">
<view class="item text-center {{i.active?'active':''}} {{i.stock ===0?'disabled':''}}" bindtap="choose" data-index="{{index}}"
data-ind="{{ind}}">{{i.specificationValue}}</view>
</block>
</view>
</block>
<!-- <block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view> <view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block> --> </block>
</view> </view>
</view> </view>
<view class="count-box flex_scb"> <view class="count-box flex_scb">
...@@ -41,13 +35,13 @@ ...@@ -41,13 +35,13 @@
</view> </view>
</view> </view>
</view> </view>
<view class="textarea-box"> <view class="textarea-box" wx:if="{{clickType != 'join'}}">
<view class="title">订单备注</view> <view class="title">订单备注</view>
<view class="pannel"> <view class="pannel">
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea> <textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view> </view>
</view> </view>
<view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{true}}"> <view bind:tap="toShowAddressModal" class="adress-box flex_scb" wx:if="{{clickType != 'join'}}">
<view class="title">收货地址</view> <view class="title">收货地址</view>
<view class="right flex_scb"> <view class="right flex_scb">
<view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view> <view class="content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
...@@ -55,10 +49,8 @@ ...@@ -55,10 +49,8 @@
</view> </view>
</view> </view>
<view class="btn-wrap flex_cc"> <view class="btn-wrap flex_cc">
<view wx:if="{{staffShop&&!canPay}}" class="btn flex_cc diable_btn">积分不足</view> <view bind:tap="toCreatedOrder" class="btn flex_cc">确认</view>
<view wx:else bind:tap="toCreatedOrder" class="btn flex_cc">确认</view>
</view> </view>
<view style="height:290rpx"></view> <view style="height:290rpx"></view>
</view> </view>
</view> </view>
<address staff="{{staffShop}}" address="{{address}}" idIndex="{{defaultAddress.id}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents":{ "usingComponents":{
"mp-html":"/components/mp-html/index", "mp-html":"/components/mp-html/index",
"sku": "/components/Sku" "sku": "./components/Sku/index",
"address":"/components/Adress/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -134,6 +134,8 @@ page { ...@@ -134,6 +134,8 @@ page {
.content { .content {
width: 520rpx; width: 520rpx;
height: 44rpx; height: 44rpx;
font-size: 24rpx;
color: #2D2D2E;
.address-text { .address-text {
width: 520rpx; width: 520rpx;
overflow: hidden; overflow: hidden;
...@@ -151,9 +153,10 @@ page { ...@@ -151,9 +153,10 @@ page {
} }
.goods-detail-box { .goods-detail-box {
.title { .title {
text-align: center; margin-left: 40rpx;
font-size: 24rpx; font-size: 32rpx;
color: #B1B1B3; color: #282829;
font-weight: 500;
} }
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</view> </view>
</navigation-bar> </navigation-bar>
</view> </view>
<view class="tab-widget flex_sc" style="top:{{padding_bottom}}px;opacity:{{opacity}};z-index:{{opacity>0.9?99:1}}"> <view class="tab-widget flex_sc" wx:if="{{!showSku}}" style="top:{{padding_bottom}}px;opacity:{{opacity}};z-index:{{opacity>0.9?99:1}}">
<block wx:for="{{tabs}}" wx:key="index"> <block wx:for="{{tabs}}" wx:key="index">
<view bind:tap="changeTab" data-index="{{index}}" class="tab-box flex_cc"> <view bind:tap="changeTab" data-index="{{index}}" class="tab-box flex_cc">
<text>{{item}}</text> <text>{{item}}</text>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<view class="price"> <view class="price">
<view class="price-box"> <view class="price-box">
<view class="sale-price"> <view class="sale-price">
{{activeSku ? detailInfo.skuPrice : detailInfo.sellPrice}} {{detailInfo.sellPrice}}
<text>积分</text> <text>积分</text>
</view> </view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view> <view class="market-price">¥{{detailInfo.marketPrice}}</view>
...@@ -48,22 +48,22 @@ ...@@ -48,22 +48,22 @@
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text> <text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view> </view>
</view> </view>
<view class="goods-title">{{detailInfo.goodsName}}</view> <view class="goods-title">{{detailInfo.brandName}}{{detailInfo.goodsSkuName}}</view>
</view> </view>
<view class="container-item select-params-box"> <view class="container-item select-params-box">
<view class="cell" wx:if="{{activeSku}}"> <view class="cell" bind:tap="showSkuModal" data-type="choose">
<view class="flex" bind:tap="showSkuModal"> <view class="flex">
<view class="title">已选</view> <view class="title">已选</view>
<view class="content flex_ccc"> <view class="content flex_ccc">
<view>{{activeSku}}</view> <view>{{skuInfo}}</view>
</view> </view>
</view> </view>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon> <mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view> </view>
<view class="cell" bindtap="jump" > <view class="cell" bindtap="toShowAddressModal">
<view class="flex"> <view class="flex">
<view class="title">配送</view> <view class="title">配送</view>
<view data-is-choose-address data-url="/packageMine/pages/address/index/index" class="content flex_ccc"> <view data-is-choose-address class="content flex_ccc">
<view class="address-text">{{contactAddress || '--'}}</view> <view class="address-text">{{contactAddress || '--'}}</view>
</view> </view>
</view> </view>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</view> </view>
</view> </view>
<view class="goods-detail-box"> <view class="goods-detail-box">
<view class="title">图文详情</view> <view class="title">商品详情</view>
<view class="image-list-wrap"> <view class="image-list-wrap">
<mp-html content="{{detailInfo.goodsDescribe}}"></mp-html> <mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view> </view>
...@@ -115,4 +115,5 @@ ...@@ -115,4 +115,5 @@
<block wx:if="{{navHeight&&!staffShop}}"> <block wx:if="{{navHeight&&!staffShop}}">
<goods-action platformShop="{{true}}" bindready="goodsActionReady" pay-disabled="{{false}}" upgradeSet="{{!detailInfo.retailPrice&&detailInfo.exchangeIntegral}}" stock="{{detailInfo.goodsStock===0}}" buyFlag="{{false}}" bindclick="goodsActionClick" hideShop="{{false}}"></goods-action> <goods-action platformShop="{{true}}" bindready="goodsActionReady" pay-disabled="{{false}}" upgradeSet="{{!detailInfo.retailPrice&&detailInfo.exchangeIntegral}}" stock="{{detailInfo.goodsStock===0}}" buyFlag="{{false}}" bindclick="goodsActionClick" hideShop="{{false}}"></goods-action>
</block> </block>
<sku staffShop="{{staffShop}}" canPay="{{canPay}}" bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" defaultAddress="{{defaultAddress}}" clickType="{{clickType}}" address="{{addressList}}"></sku>
\ No newline at end of file \ No newline at end of file
<sku bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" clickType="{{clickType}}" address="{{addressList}}"></sku>
<address staff="{{staffShop}}" address="{{addressList}}" defaultAddress="{{defaultAddress}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
\ No newline at end of file \ No newline at end of file
{
"navigationStyle": "custom",
"usingComponents": {
"selfSku": "/components/selfSku/index",
"address": "/components/Adress/index"
}
}
\ No newline at end of file \ No newline at end of file
/* packageIndex/pages/selfGoodsDetail/index.wxss */
page {
background: #F7F8FA;
}
.flex {
display: flex;
align-items: center;
position: relative;
}
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
.navigation {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.back {
position: absolute;
left: 20rpx;
width: 64rpx;
height: 64rpx;
background: #ffffff80;
border: 1rpx solid #E5E5E5;
border-radius: 32rpx;
}
.page-title {
font-size: 34rpx;
font-weight: 600;
color: #282829;
}
}
}
.layout {
.banner-box {
height: 750rpx;
position: relative;
.banner {
height: 100%;
}
.dot-box {
position: absolute;
bottom: 24rpx;
border-radius: 2rpx;
overflow: hidden;
display: flex;
}
.banner video {
width: 100%;
height: 100%;
}
.dot {
width: 20rpx;
height: var(--borderRadius);
background: rgba(255, 255, 255, 0.3);
transition: all .5s;
}
.dot.active {
background-color: #fff;
}
}
.goods-container {
background: #F7F8FA;
padding: 16rpx 0;
.container-item {
margin: 0 16rpx;
padding: 28rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
margin-bottom: 16rpx;
}
.goods-box {
.price{
display: flex;
justify-content: space-between;
}
.price-box {
display: flex;
.sale-price {
font-size: 54rpx;
color: #FC5B32;
font-weight: 700;
text {
font-size: 28rpx;
font-weight: 500;
}
}
.market-price {
text-decoration: line-through;
font-size: 24rpx;
color: #B1B1B3;
margin: 36rpx 0 0 12rpx;
}
}
.count {
color: #B1B1B3;
font-size: 24rpx;
}
.goods-title {
margin-top: 20rpx;
color: #282829;
font-size: 34rpx;
font-weight: 500;
font-family: PingFangSC-Medium;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
.select-params-box {
.cell {
height: 88rpx;
display: flex;
align-items: center;
.flex {
width: 100%;
}
.title {
width: 80rpx;
font-size: 24rpx;
color: #707071;
}
.content {
width: 520rpx;
height: 44rpx;
font-size: 24rpx;
color: #2D2D2E;
.address-text {
width: 520rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
}
}
.flex_ccc {
display: flex;
justify-content: center;
flex-direction: column;
}
}
}
.goods-detail-box {
.title {
font-size: 32rpx;
color: #282829;
font-weight: 500;
}
}
}
}
.tab-widget {
position: fixed;
left: 0;
right: 0;
top: 0;
background: white;
height: 88rpx;
z-index: 99;
opacity: 0;
.tab-box {
position: relative;
width: 50%;
height: 88rpx;
font-weight: 400;
font-size: 28rpx;
color: #656566;
.line {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 66rpx;
height: 6rpx;
background: #FC5B32;
border-radius: 2rpx;
}
}
}
.fixed_btn_wrap {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 100rpx;
background: #FFFFFF;
box-sizing: border-box;
padding:4rpx 48rpx;
.dh_btn {
background: #FC5B32;
border: 1.6rpx solid #FC5B32;
box-shadow: 0 4rpx 12rpx 4rpx #f13c3d1a;
border-radius: 20rpx;
height: 80rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.grey_btn{
background: #999999;
border: none;
box-shadow: none;
}
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
\ No newline at end of file \ No newline at end of file
<view class="navigation-bar">
<navigation-bar custom navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="商品详情">
<view class="navigation">
<view class="back text-center" bindtap="back">
<mp-icon icon="back" color="#323233" size="{{12}}"></mp-icon>
</view>
<view class="page-title">商品详情</view>
</view>
</navigation-bar>
</view>
<block wx:if="{{goodsFlag}}">
<view class="{{posterUrl==''?'layout':'layout hidden'}} " style="padding-bottom:{{padding_bottom + 20}}px;">
<view class="banner-box">
<swiper class="banner" bindchange="changeBanner">
<block wx:for="{{goodsInfo.goodsDetailImageList}}" wx:key="index">
<swiper-item>
<image mode="aspectFill" webp src="{{item.content}}" bindtap="previewImage" data-current="{{item.content}}" data-item="{{goodsInfo.goodsDetailImageList}}"></image>
</swiper-item>
</block>
</swiper>
<block wx:if="{{goodsInfo.goodsDetailImageList.length > 1}}">
<view class="dot-box x-center">
<block wx:for="{{goodsInfo.goodsDetailImageList}}" wx:key="index">
<view class="dot {{bannerIndex == index ? 'active':''}}">
</view>
</block>
</view>
</block>
</view>
<view class="goods-container">
<view class="container-item goods-box">
<view class="price">
<view class="price-box">
<view class="sale-price">
{{goodsInfo.skuPrice}}
<text>积分</text>
</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
</view>
<view class="count">
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view>
</view>
<view class="goods-title">{{detailInfo.brandName}}{{detailInfo.goodsSkuName}}</view>
</view>
<view class="container-item select-params-box">
<view class="cell" bind:tap="showSkuFun" wx:if="{{activeSku}}" data-type="choose">
<view class="flex">
<view class="title">已选</view>
<view class="content flex_ccc">
<view>{{activeSku}}</view>
</view>
</view>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell" bind:tap="toShowAddressModal">
<view class="flex">
<view class="title">配送</view>
<view data-is-choose-address class="content flex_ccc">
<view class="address-text">{{contactAddress || '--'}}</view>
</view>
</view>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell">
<view class="title">运费</view>
<view class="content flex_ccc">
<block wx:if="{{goodsInfo.expressFee}}">{{goodsInfo.expressFee}}元</block>
<block wx:else>免运费(请以提交订单时为准)</block>
</view>
</view>
<view class="cell" wx:if="{{goodsInfo.serviceDesc}}">
<view class="title">服务说明</view>
<view class="content flex_ccc">
<text>{{goodsInfo.serviceDesc}}</text>
</view>
</view>
</view>
<view class="goods-detail-box" wx:if="{{goodsInfo.goodsDescList.length}}">
<view class="title">商品详情</view>
<block wx:for="{{goodsInfo.goodsDescList}}" wx:key="index">
<view class="content">
<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>
</block>
<block wx:elif="{{item.resType == 2}}">
{{item.content}}
</block>
<block wx:else>
<video src="{{item.content}}" style="height:{{item.height}}px;width:100%"></video>
</block>
</view>
</block>
</view>
</view>
</view>
</block>
<block wx:if="{{navHeight && goodsFlag}}">
<goods-action payText="{{isShowPointStyle?'立即兑换':'立即购买'}}" bindready="goodsActionReady" pay-disabled="{{goodsInfo.activityStatus != 2 }}" stock="{{goodsInfo.goodsStock === 0}}" buyFlag="{{goodsInfo.buyFlag == 2}}" bindclick="goodsActionClick" upgradeSet="{{upgrade==true||goodsInfo.discoverGoodsSource==3||isShowPointStyle}}"></goods-action>
<block wx:if="{{activeSku}}">
<selfSku show="{{showSku}}" showName="showSku" defaultAds="{{contactAddress}}" defaultAddress="{{defaultAddress}}" clickType="{{clickType}}" skuData="{{goodsInfo}}" bindpay="pay" bindjoin="join"></selfSku>
</block>
<address staff="{{staffShop}}" address="{{addressList}}" idIndex="{{defaultAddress.id}}" defaultAddress="{{defaultAddress}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
</block>
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
...@@ -5,41 +5,45 @@ Page({ ...@@ -5,41 +5,45 @@ Page({
data: {}, data: {},
//退出登录 //退出登录
logout() { logout() {
wx.p.api.userApi.logout().then(async ({ wx.p.isLogin = false
code, wx.p.storage.rm('userInfo')
message wx.p.storage.rm('sessionId')
}) => { wx.p.router.reLaunch('/pages/Login/Login')
wx.p.wxApi.showLoading() // wx.p.api.userApi.logout().then(async ({
if (code == '0') { // code,
// wx.$Track.setTrack({}, 4) // message
wx.p.isLogin = false // }) => {
// wx.$util.removeSystemStorage() // wx.p.wxApi.showLoading()
wx.p.storage.rm('userInfo') // if (code == '0') {
wx.p.storage.rm('sessionId') // // wx.$Track.setTrack({}, 4)
wx.p.storage.rm('isVIP') // wx.p.isLogin = false
wx.p.router.back(prevPage => { // // wx.$util.removeSystemStorage()
wx.hideLoading() // wx.p.storage.rm('userInfo')
prevPage.setData({ // wx.p.storage.rm('sessionId')
userInfo: null, // wx.p.storage.rm('isVIP')
isMember: false, // wx.p.router.back(prevPage => {
vipInfo: null, // wx.hideLoading()
orderNumberList: null // prevPage.setData({
}) // userInfo: null,
}) // isMember: false,
} else { // vipInfo: null,
if (code == '21' || code == '20') { // orderNumberList: null
try { // })
const res = await wx.p.api.userApi.login() // })
if (res.code == 0) { // } else {
wx.p.storage.set('sessionId', res.data.sessionId) // if (code == '21' || code == '20') {
this.logout() // try {
} else throw res.message // const res = await wx.p.api.userApi.login()
} catch (error) { // if (res.code == 0) {
wx.p.wxApi.showToast(error) // wx.p.storage.set('sessionId', res.data.sessionId)
} // this.logout()
} else wx.p.wxApi.showToast(message) // } else throw res.message
} // } catch (error) {
}) // wx.p.wxApi.showToast(error)
// }
// } else wx.p.wxApi.showToast(message)
// }
// })
}, },
goAgreement() { goAgreement() {
wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/hmd/privacy.html', true) wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/hmd/privacy.html', true)
......
...@@ -20,7 +20,8 @@ Page({ ...@@ -20,7 +20,8 @@ Page({
extClass: 'btn_primary' extClass: 'btn_primary'
}], }],
pointsSource: [], pointsSource: [],
walletObj: {} walletObj: {},
loginData: {}
}, },
changeLoginType() { changeLoginType() {
const { const {
...@@ -192,12 +193,13 @@ Page({ ...@@ -192,12 +193,13 @@ Page({
/**登录回调 */ /**登录回调 */
customerLoginCallBack(data) { customerLoginCallBack(data) {
wx.p.storage.set('sessionId', data?.sessionId) wx.p.storage.set('sessionId', data?.sessionId)
wx.p.storage.set('userInfo', data) this.setData({loginData: data})
// 获取积分来源 // 获取积分来源
this.getSource(data) this.getSource()
}, },
getSource(loginData) { getSource() {
let { loginData } = this.data
commonApi.getPointsSourceList({ commonApi.getPointsSourceList({
staffPhone: loginData?.phone staffPhone: loginData?.phone
}).then(res => { }).then(res => {
...@@ -209,9 +211,7 @@ Page({ ...@@ -209,9 +211,7 @@ Page({
showChooseSource: true showChooseSource: true
}) })
} else if (data?.length == 1) { } else if (data?.length == 1) {
this.setChannelSource(data[0]?.channelSource, loginData) this.setChannelSource(data[0]?.channelSource)
} else { // 无积分渠道游客
this.setChannelSource(4, loginData)
} }
} else { } else {
wx.p.wxApi.showToast(message) wx.p.wxApi.showToast(message)
...@@ -219,104 +219,41 @@ Page({ ...@@ -219,104 +219,41 @@ Page({
}) })
}, },
// 设置积分渠道 // 设置积分渠道
setChannelSource(source, loginData) { setChannelSource(source) {
wx.p.isLogin = true let { loginData } = this.data
wx.p.storage.set('userInfo', {...loginData, channelSource: source}) // 查询门店数据
// 查询积分钱包 this.getMerchantList(source, loginData)
this.getPointsWallet()
}, },
// 获取积分钱包数据 getMerchantList(source, loginData) {
getPointsWallet() { commonApi.getMerchantData({staffPhone: loginData?.phone, channelSource: source}).then(res => {
let userInfo = wx.p.cache.userInfo.getUserInfo() let { code, data, message } = res
// 获取当前积分数量
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: userInfo?.channelSource}).then(r => {
if (r?.code == 0) {
this.setData({
walletObj: {name: r?.data?.staffName, phone: userInfo?.phone, scoreSource: userInfo?.channelSource, currentScore: r?.data?.currentScore || 0}
})
// 获取钱包数据
commonApi.getPointsWalletData({
phone: userInfo?.phone,
name: r?.data?.staffName,
scoreSource: userInfo?.channelSource
}).then(res => {
let { code, data, message } = res
if (code == 0) {
if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包
// 调用替换钱包昵称接口
this.replaceNickName(data)
} else {
// 未开通弹出开通钱包弹窗
this.setData({
showEnableWallet: true
})
}
} else {
wx.p.wxApi.showToast(message)
}
})
} else {
wx.p.wxApi.showToast(r.message)
}
})
},
// 替换积分钱包名称
replaceNickName(data) {
let userInfo = wx.p.cache.userInfo.getUserInfo()
commonApi.replaceWalletName({
nickName: data?.name,
phone: data?.phone,
scoreSource: data?.scoreSource
}).then(res => {
let { code, message } = res
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
if (code == 0) { if (code == 0) {
// 返回上一页 // 当没有门店数据返回时 默认赋值一个merchantId为 -1的门店作为游客使用
wx.p.router.back(thisPage => { if (!data?.length) {
thisPage && thisPage.setData({ data = [{merchantId: -1}]
userInfo: {...userInfo, nickName: data?.name} }
if (data?.length == 1) { // 仅有一个门店时跳过选择门店页面 直接登录成功
const { merchantId, merchantName } = data[0] || {}
wx.p.isLogin = true;
wx.p.storage.set('userInfo', {
...loginData,
channelSource: source,
merchantId,
merchantName
}) })
}) wx.p.router.reLaunch('/pages/tab/index/index', {loginPageFlag: true})
} else { // 跳转到选择门店页面
wx.p.router.go('/pages/chooseMerchant/index', {loginData: {channelSource: source, ...loginData}, merchantList: data})
}
} else { } else {
wx.p.wxApi.showToast(message) wx.p.wxApi.showToast(message)
} }
}) })
}, },
// 选择积分来源 // 选择积分来源确定
pointSourceEvent(e) { pointSourceEvent(e) {
wx.p.storage.set('channelSource', `${e.detail}`) this.setChannelSource(e.detail)
},
// 关闭开通积分钱包弹窗
closeWallet() {
this.setData({ showEnableWallet: false })
let { walletObj } = this.data
let data = {
name: walletObj?.nickName,
phone: walletObj?.phone,
scoreSource: walletObj?.channelSource
}
// 替换钱包昵称 使用登录信息返回的数据
this.replaceNickName(data)
},
// 一键开通积分钱包
enableWalletConfirm(e) {
let { walletObj } = e.detail
commonApi.openPointsWallet(walletObj).then(res => {
let { code, message } = res
if (code == 0) {
this.setData({
showEnableSuccess: true,
showEnableWallet: false,
walletObj
})
} else {
wx.p.wxApi.showToast(message)
}
})
}, },
// 开通成功 // 开通成功
......
{ {
"usingComponents": { "usingComponents": {
"points-source": "./components/PointsSource/PointsSource", "points-source": "./components/PointsSource/PointsSource"
"enable-wallet": "./components/EnableWallet/EnableWallet",
"enable-success": "./components/EnableSuccess/EnableSuccess"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
...@@ -66,8 +66,4 @@ ...@@ -66,8 +66,4 @@
</view> </view>
</Dialog> </Dialog>
<!-- 积分来源选择 --> <!-- 积分来源选择 -->
<points-source show="{{showChooseSource}}" pointsSource="{{pointsSource}}" bindconfirm="pointSourceEvent"></points-source>
<!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
\ No newline at end of file \ No newline at end of file
<points-source show="{{showChooseSource}}" pointsSource="{{pointsSource}}" bindconfirm="pointSourceEvent"></points-source>
\ No newline at end of file \ No newline at end of file
{ {
"component": true, "navigationBarTitleText": "选择账号",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file \ No newline at end of file
/* pages/chooseMerchant/index.wxss */
@keyframes opacity-view {
0% {
opacity: 0;
transform: scale(0.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.button {
width: 100% !important;
height: 88rpx;
background: var(--btnColor);
border-radius: 8rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 88rpx;
padding: 0;
&[disabled]:not([type]){
background: #CCCED1 !important;
color: #fff !important;
}
}
.btn-hover {
opacity: .75;
}
page {
background-color: #F6F8FA;
}
.layout {
font-size: 28rpx;
letter-spacing: 0;
padding: 32rpx 24rpx;
position: relative;
}
.title {
font-weight: 600;
font-size: 32rpx;
color: #1B233D;
line-height: 48rpx;
// margin-bottom: 24rpx;
}
.items {
width: 100%;
min-height: 144rpx;
box-shadow: 0 4rpx 16rpx 0 rgba(180, 186, 204, 0.32);
padding: 32rpx;
border-radius: 20rpx;
margin-bottom: 32rpx;
background-color: #fff;
display: flex;
align-items: center;
flex-wrap: nowrap;
box-sizing: border-box;
.info{
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.buiss{
font-weight: 500;
font-size: 28rpx;
color: #1B233D;
}
.merchant{
font-size: 22rpx;
color: #9299AD;
}
}
.right_arrow{
width: 24rpx;
height: 24rpx;
margin-left: 48rpx;
flex-shrink: 0;
}
}
.level{
width: 80rpx;
height: 44rpx;
line-height: 48rpx;
border-radius: 8rpx;
text-align: center;
font-weight: 400;
font-size: 22rpx;
flex-shrink: 0;
background: #fdb7571a;
color: #FA9E14;
border: 1.6rpx solid #fdb75780;
margin-right: 32rpx;
}
.items:last-of-type {
margin-bottom: 0;
}
.radio {
width: 28rpx;
height: 28rpx;
border: 2rpx solid #DDE3F0;
border-radius: 100%;
transition: all .2s;
box-sizing: border-box;
}
.icon {
width: 28rpx;
height: 28rpx;
transition: all .2s;
display: none;
}
.active .icon {
display: block;
}
.active .radio {
display: none;
}
.btn-box {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 140rpx;
display: flex;
justify-content: center;
align-items: center;
z-index: 20;
background-color: #fff;
color: #fff;
padding: 0 32rpx;
box-sizing: border-box;
}
.list-not {
height: calc(100vh - 159px);
font-size: 28rpx;
}
// v3.3.0
.search_wrap{
padding: 24rpx 0rpx;
.inner{
width: 100%;
height: 64rpx;
background: #FFFFFF;
border: 2rpx solid #CDD1D4;
border-radius: 32rpx;
box-sizing: border-box;
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
.input-placeholder{
font-weight: 400;
font-size: 24rpx;
color: #7E8A9D;
}
.intclass{
height: 100%;
width: calc(100% - 46rpx);
}
.search_icon{
width: 32rpx;
height: 32rpx;
margin-right: 24rpx;
}
}
}
.logout-btn-wrap{
position: fixed;
bottom: 0;
right: 0;
left: 0;
height: 180rpx;
background: white;
box-sizing: border-box;
padding-top: 16rpx;
display: flex;
justify-content: center;
.logout-btn{
background-image: linear-gradient(-85deg, #556AF5 0%, #7197FF 100%) !important;
color: white;
font-size: 28rpx;
width: 654rpx;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center
}
}
.a_widget{
display: flex;
align-items: center;
justify-content: center;
// margin-bottom: 24rpx;
background-color: #F6F8FA;
width: 100%;
padding: 16rpx 0;
.a_class{
color: #4466F0;
}
}
.bottom_0{
position: fixed;
bottom: 0;
right: 0;
left: 0;
}
\ No newline at end of file \ No newline at end of file
<!--pages/chooseMerchant/index.wxml-->
<view wx:if="{{flag}}" class="layout">
<view class="title">请选择登录的账号</view>
<view class="search_wrap">
<view class="inner">
<icon type="search" size="20"></icon>
<input class="intclass" confirm-type="search" bindconfirm="bindconfirm" bindinput="bindInput" placeholder-class="input-placeholder" placeholder="请输入门店名称/商户号" />
</view>
</view>
<view class="list">
<block>
<block wx:if="{{paramsData.merchantList.length}}">
<block wx:for="{{paramsData.merchantList}}" wx:key="index">
<view class="items {{item.active?'active':''}}" bindtap="chooseAccount" data-index="{{index}}">
<view class="info">
<view class="buiss"> {{item.merchantName}}</view>
<view class="merchant">商户号:{{item.merchantId || '--'}}</view>
</view>
<view class="level">门店</view>
<mp-icon icon="arrow" color="#1B233D" size="{{12}}"></mp-icon>
</view>
</block>
</block>
<block wx:else>
<view class="list-not">
搜索结果为空
</view>
</block>
</block>
</view>
<view style="height:210rpx"></view>
<view class="a_widget bottom_0">
<view class="a_class" catchtap="handleAgree" data-name="privacy">《隐私协议》</view>
<view class="a_class" catchtap="handleAgree" data-name="agreement">《服务使用协议》</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -27,20 +27,11 @@ Page({ ...@@ -27,20 +27,11 @@ Page({
async login(options = {}) { async login(options = {}) {
if (options.merchantId) wx.$merchant_id = options.merchantId; if (options.merchantId) wx.$merchant_id = options.merchantId;
try { try {
const { code, data, message } = await wx.p.api.userApi.login(); const { code, data, message } = await commonApi.getLoginInfo();
if (data) if (code == 0) {
wx.p.storage.set("merchant_info", {
merchantId: data.merchantId,
merchantName: data.merchantName,
});
if (code == "0") {
wx.p.isLogin = true; wx.p.isLogin = true;
wx.p.storage.set("sessionId", data.sessionId);
if (!data) throw message;
} else { } else {
wx.p.isLogin = false; return wx.p.router.reLaunch('/pages/Login/Login')
wx.p.storage.rm("userInfo");
wx.p.storage.rm("sessionId");
} }
console.log("登陆信息:", data); console.log("登陆信息:", data);
if (options.url) { if (options.url) {
......
...@@ -99,6 +99,7 @@ Page({ ...@@ -99,6 +99,7 @@ Page({
item item
} = e.currentTarget.dataset } = e.currentTarget.dataset
if (item.goodsNumber == count) return if (item.goodsNumber == count) return
let { userInfo } = this.data
this.setData({ this.setData({
[`goodsList[${index}].goodsNumber`]: count [`goodsList[${index}].goodsNumber`]: count
}) })
...@@ -107,8 +108,9 @@ Page({ ...@@ -107,8 +108,9 @@ Page({
let para = { let para = {
goodsId: 1, goodsId: 1,
sellQty: count, sellQty: count,
goodsSource: target?.goodsSource, goodsSource: item?.goodsSource,
scoreSource: 1 scoreSource: userInfo?.channelSource,
specificationData: item?.specificationData
} }
cartApi.updateGoodsFormCart(para).then(res => { cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading() wx.hideLoading()
...@@ -185,14 +187,17 @@ Page({ ...@@ -185,14 +187,17 @@ Page({
} = this.data } = this.data
let data = [] let data = []
goodsList?.map(e => (e.active ? data.push(e) : '')) goodsList?.map(e => (e.active ? data.push(e) : ''))
wx.p.router.go('/packageIndex/pages/confirmOrder/index', { let params = {
goodsList: data goodsList: data
}) }
wx.p.router.go('/packageIndex/pages/confirmOrder/index', {...params})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let userInfo = wx.p.storage.get(userInfo)
this.setData({userInfo})
// this.getShoppingcartList() // this.getShoppingcartList()
}, },
getShoppingcartList() { getShoppingcartList() {
...@@ -224,11 +229,13 @@ Page({ ...@@ -224,11 +229,13 @@ Page({
let { let {
target target
} = e.target.dataset } = e.target.dataset
let { userInfo } = this.data
let para = { let para = {
goodsId: 1, goodsId: 1,
sellQty: 0, sellQty: 0,
goodsSource: target?.goodsSource, goodsSource: target?.goodsSource,
scoreSource: 1 scoreSource: userInfo?.channelSource,
specificationData: target.specificationData
} }
cartApi.updateGoodsFormCart(para).then(res => { cartApi.updateGoodsFormCart(para).then(res => {
wx.p.wxApi.showToast('删除成功') wx.p.wxApi.showToast('删除成功')
......
...@@ -11,6 +11,7 @@ Page({ ...@@ -11,6 +11,7 @@ Page({
navStyle : "background-color: transparent;", navStyle : "background-color: transparent;",
animationData: {}, animationData: {},
bannerUrl: '', bannerUrl: '',
walletObj: {},
specialSaleArr: [{ specialSaleArr: [{
id: 1, id: 1,
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png', url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png',
...@@ -56,12 +57,14 @@ Page({ ...@@ -56,12 +57,14 @@ Page({
goodsId: '1', goodsId: '1',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png', goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: 'Tempo得宝手帕纸', goodsName: 'Tempo得宝手帕纸',
goodsSource: 1,
salePoints: '10', salePoints: '10',
marketPrice: '15.9' marketPrice: '15.9'
}, { }, {
goodsId: '2', goodsId: '2',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png', goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸', goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸',
goodsSource: 2,
salePoints: '69.9', salePoints: '69.9',
marketPrice: '79.9' marketPrice: '79.9'
}, { }, {
...@@ -130,22 +133,53 @@ Page({ ...@@ -130,22 +133,53 @@ Page({
onLoad(options) { onLoad(options) {
const userInfo = wx.p.cache.userInfo.getUserInfo() const userInfo = wx.p.cache.userInfo.getUserInfo()
this.setData({userInfo}) this.setData({userInfo})
// 获取当前积分数据 wx.p.router.getRouterParams(options).then(params => {
this.getPointsData() this.setData({loginPageFlag: params?.loginPageFlag}, () => {
this.getPointsWallet()
})
}).catch(err => {
console.error('参数获取失败:', err)
})
}, },
getPointsData() {
let { userInfo } = this.data // 获取积分钱包数据
if (!userInfo?.phone && !userInfo?.channelSource) return getPointsWallet() {
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: Number(userInfo?.channelSource)}).then(r => { let { loginPageFlag } = this.data
let userInfo = wx.p.cache.userInfo.getUserInfo()
// 获取当前积分数量
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: userInfo?.channelSource, merchantId: userInfo?.merchantId}).then(r => {
if (r?.code == 0) { if (r?.code == 0) {
this.setData({ this.setData({
currentScore: r?.data?.currentScore || 0 walletObj: {name: r?.data?.staffName || userInfo?.nickName, phone: r?.data?.staffPhone || userInfo?.phone, scoreSource: userInfo?.channelSource, currentScore: r?.data?.currentScore || 0}
})
// 获取钱包数据
commonApi.getPointsWalletData({
phone: userInfo?.phone,
name: r?.data?.staffName || userInfo?.phone,
scoreSource: userInfo?.channelSource
}).then(res => {
let { code, data, message } = res
if (code == 0) {
if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
} else {
if (!loginPageFlag) return // 只有通过登录页面进入首页弹出一次
// 未开通弹出开通钱包弹窗
this.setData({
showEnableWallet: true,
copyWalletObj: {name: r?.data?.staffName || userInfo?.nickName, phone: r?.data?.staffPhone || userInfo?.phone, scoreSource: userInfo?.channelSource}
})
}
} else {
wx.p.wxApi.showToast(message)
}
}) })
} else { } else {
wx.p.wxApi.showToast(r.message) wx.p.wxApi.showToast(r.message)
} }
}) })
}, },
// 跳转积分中心 // 跳转积分中心
handleToPointCenter() { handleToPointCenter() {
wx.p.router.go('/packageIndex/pages/integral/index/index') wx.p.router.go('/packageIndex/pages/integral/index/index')
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"usingComponents": { "usingComponents": {
"good-tab": "./components/good-tab/good-tab", "good-tab": "./components/good-tab/good-tab",
"goods": "/components/goods/goods", "goods": "/components/goods/goods",
"search-box": "./components/SearchBox/SearchBox" "search-box": "./components/SearchBox/SearchBox",
"enable-wallet": "/components/EnableWallet/EnableWallet"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"backgroundColor": "#F9F7F7" "backgroundColor": "#F9F7F7"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class="icon"> <view class="icon">
<glsx-image src="/index/points-icon.png"></glsx-image> <glsx-image src="/index/points-icon.png"></glsx-image>
</view> </view>
<view class="points-num" bind:tap="toIntegral">{{currentScore || '-'}}</view> <view class="points-num" bind:tap="toIntegral">{{walletObj.currentScore || '-'}}</view>
</view> </view>
<view class="arrow-icon"> <view class="arrow-icon">
<mp-icon icon="arrow" color="#F4776D" size="7"></mp-icon> <mp-icon icon="arrow" color="#F4776D" size="7"></mp-icon>
...@@ -55,4 +55,6 @@ ...@@ -55,4 +55,6 @@
</view> </view>
</view> </view>
</block> </block>
<!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}"></enable-wallet>
<glsx-privacy appletName="积分商城"></glsx-privacy> <glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
...@@ -248,7 +248,7 @@ class Router { ...@@ -248,7 +248,7 @@ class Router {
} }
// 检查登录状态 // 检查登录状态
const isLogin = wx.p.isLogin; const isLogin = wx.p.storage.get('userInfo') && Object.keys(wx.p.storage.get('userInfo'))?.length;
if (isLogin) { if (isLogin) {
// 已登录,放行 // 已登录,放行
return false; return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!