Commit d8af7165 by zhangxw

登录修改

1 parent 0b5ce1c9
Showing 49 changed files with 2478 additions and 682 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
// 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>
...@@ -21,223 +21,70 @@ Page({ ...@@ -21,223 +21,70 @@ Page({
}, },
skuInfo: '', skuInfo: '',
staffShop: false, staffShop: false,
isCarOwner: false,
payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }], payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }],
detailInfo: { detailInfo: {
"id" : 267, "id" : 233,
"goodsSkuCode" : "2888888889071442", "goodsSkuCode" : "2888888889106169",
"goodsSkuName" : "系统商品009 鹅黄 28寸", "goodsSkuName" : "书架 丹青",
"goodsSkuTitle" : "", "goodsSkuTitle" : "",
"firstCategoryName" : "箱包", "firstCategoryName" : "家具",
"secondCategoryName" : "功能箱包", "secondCategoryName" : "家具",
"lastCategoryName" : "拉杆箱", "lastCategoryName" : "书架",
"goodsStock" : 695, "goodsStock" : 11690,
"salePrice" : 0.00, "salePrice" : 0.00,
"redeemPoints" : 40, "redeemPoints" : null,
"sellPrice" : 150.00, "sellPrice" : 100.00,
"marketPrice" : 700.00, "marketPrice" : 100.00,
"startQty" : 1, "startQty" : 1,
"brandName" : "膳魔师", "brandName" : "土匠坊",
"returnGoodsRules" : 1001, "returnGoodsRules" : 1001,
"goodsCharacteristic" : "系统商品009", "goodsCharacteristic" : "书架",
"goodsUnit" : "", "goodsUnit" : "个",
"modelNumber" : "系统商品009", "modelNumber" : "书架",
"productPlace" : "", "productPlace" : "湖南",
"haveShelfLife" : 0, "haveShelfLife" : 0,
"shelfLife" : "0", "shelfLife" : "0",
"fragileGoods" : 0, "fragileGoods" : 0,
"grossWeight" : 0.0000, "grossWeight" : 0.0000,
"grossWeightUnit" : "kg", "grossWeightUnit" : "kg",
"density" : 0.0000, "density" : 0.0000,
"extent" : 0, "extent" : 11,
"width" : 0, "width" : 12,
"height" : 0, "height" : 11,
"attributeResponses" : [ { "attributeResponses" : [ {
"attributeCode" : "1001", "attributeCode" : null,
"attributeName" : "锁具类型", "attributeName" : null,
"attributeValueCode" : "2888888888892503", "attributeValueCode" : null,
"attributeValueName" : "系统商品009" "attributeValueName" : null
}, { }, {
"attributeCode" : "990", "attributeCode" : null,
"attributeName" : "拉杆种类", "attributeName" : null,
"attributeValueCode" : "2888888888892497", "attributeValueCode" : null,
"attributeValueName" : "系统商品009" "attributeValueName" : null
}, { }, {
"attributeCode" : "995", "attributeCode" : null,
"attributeName" : "闭合方式", "attributeName" : null,
"attributeValueCode" : "2888888888892500", "attributeValueCode" : null,
"attributeValueName" : "系统商品009" "attributeValueName" : null
}, {
"attributeCode" : "992",
"attributeName" : "适用场景",
"attributeValueCode" : "2888888888892498",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "1003",
"attributeName" : "轮子种类",
"attributeValueCode" : "2888888888892505",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "997",
"attributeName" : "类别",
"attributeValueCode" : "2888888888892502",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "989",
"attributeName" : "商品产地",
"attributeValueCode" : "345",
"attributeValueName" : "中国"
}, {
"attributeCode" : "994",
"attributeName" : "适用性别",
"attributeValueCode" : "349",
"attributeValueName" : "女"
}, {
"attributeCode" : "1002",
"attributeName" : "适用人群",
"attributeValueCode" : "2888888888892504",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "991",
"attributeName" : "是否带锁",
"attributeValueCode" : "348",
"attributeValueName" : "是"
}, {
"attributeCode" : "996",
"attributeName" : "箱包硬度",
"attributeValueCode" : "2888888888892501",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "987",
"attributeName" : "商品毛重",
"attributeValueCode" : "2888888888892496",
"attributeValueName" : "系统商品009"
}, {
"attributeCode" : "993",
"attributeName" : "材质",
"attributeValueCode" : "2888888888892499",
"attributeValueName" : "系统商品009"
} ], } ],
"imageResponses" : [ { "imageResponses" : [ {
"imgUrl" : "https://img.yunzhonghe.com/image/1618215408263PefyXSUtQW.jpg", "imgUrl" : "https://img.yunzhonghe.com/image/1650252368566tfAMIHdsHJ.jpg",
"imgMain" : 1, "imgMain" : 1,
"imgSort" : 0 "imgSort" : 1
}, { }, {
"imgUrl" : "https://img.yunzhonghe.com/image/1618215556741tYVyESRNzw.jpg", "imgUrl" : "https://img.yunzhonghe.com/image/1685065224278RMJRENGzEu.jpg",
"imgMain" : 0, "imgMain" : 0,
"imgSort" : 1 "imgSort" : 2
} ],
"specificationList" : [ {
"id" : 3957,
"goodsId" : null,
"specificationName" : "1",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"specificationValueList" : [ {
"id" : 4946,
"goodsSpecificationId" : 3957,
"specificationValue" : "1",
"createdBy" : "bobodmd",
"createdDate" : 1755518778000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755518778000,
"deletedFlag" : "N"
}, {
"id" : 4948,
"goodsSpecificationId" : 3957,
"specificationValue" : "2",
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ]
}, { }, {
"id" : 3958, "imgUrl" : "https://img.yunzhonghe.com/image/1685065228949FBsBtEXxrq.jpg",
"goodsId" : null, "imgMain" : 0,
"specificationName" : "2", "imgSort" : 3
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"specificationValueList" : [ {
"id" : 4947,
"goodsSpecificationId" : 3958,
"specificationValue" : "2",
"createdBy" : "bobodmd",
"createdDate" : 1755518778000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755518778000,
"deletedFlag" : "N"
}, {
"id" : 4949,
"goodsSpecificationId" : 3958,
"specificationValue" : "3",
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ]
} ], } ],
"specificationDetailList" : [ { "specificationResponses" : [ {
"id" : 5448, "specName" : "颜色",
"goodsId" : 22525, "specValue" : "丹青"
"retailPrice" : 500,
"stock" : 3,
"specificationData" : "1-1&2-3",
"specificationKey" : "d61482cdf947ade156679a5f861a8701",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5447,
"goodsId" : 22525,
"retailPrice" : 1000,
"stock" : 1,
"specificationData" : "1-1&2-2",
"specificationKey" : "8ab61fe03f6398a177cbcd988f7b7b96",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5450,
"goodsId" : 22525,
"retailPrice" : 1000,
"stock" : 1,
"specificationData" : "1-2&2-3",
"specificationKey" : "a5798f7c9dfc46609c85f76c67e8915b",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5449,
"goodsId" : 22525,
"retailPrice" : 1500,
"stock" : 2,
"specificationData" : "1-2&2-2",
"specificationKey" : "4348e92ea0b37d7a36b5f64feb467ead",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ], } ],
"goodsDescribe" : "<p>22</p>", "goodsDescribe" : "<p>书架</p>",
"goodsPosition" : 2, "goodsPosition" : 2,
"saleFlag" : 1, "saleFlag" : 1,
"shelvesStatus" : 1001, "shelvesStatus" : 1001,
...@@ -249,7 +96,7 @@ Page({ ...@@ -249,7 +96,7 @@ Page({
}, },
addressList: [{ addressList: [{
id: 1, id: 1,
receiveName: '何瑶', receiveName: '何瑶1',
receiveMobile: '15044526870', receiveMobile: '15044526870',
provinceName: '广东省', provinceName: '广东省',
cityName: '深圳市', cityName: '深圳市',
...@@ -258,7 +105,7 @@ Page({ ...@@ -258,7 +105,7 @@ Page({
isDefault: 1 isDefault: 1
}, { }, {
id: 2, id: 2,
receiveName: '何瑶', receiveName: '何瑶2',
receiveMobile: '15044526870', receiveMobile: '15044526870',
provinceName: '广东省', provinceName: '广东省',
cityName: '深圳市', cityName: '深圳市',
...@@ -311,7 +158,7 @@ Page({ ...@@ -311,7 +158,7 @@ Page({
address: '南山智园崇文园区1号楼14层', address: '南山智园崇文园区1号楼14层',
isDefault: 0 isDefault: 0
}], }],
defaultAddress: {} defaultAddress: {id: 3}
}, },
appHide() { appHide() {
wx.offAppHide() wx.offAppHide()
...@@ -320,6 +167,16 @@ Page({ ...@@ -320,6 +167,16 @@ Page({
this.trackQuery.view = 5 this.trackQuery.view = 5
}) })
}, },
// 处理已选商品
toGetSpecString(info, count) {
let skuInfo = this.data, num = '', weight = ''
num = `${count}${info.goodsUnit}`
weight = `${info.grossWeight}${info.grossWeightUnit}`
skuInfo = `${info.specificationResponses[0].specValue}` + `,${weight}` + `,${num}`
this.setData({
skuInfo
})
},
/**添加埋点结束 */ /**添加埋点结束 */
navbarReady(e) { navbarReady(e) {
navBarHeight = e.detail.height navBarHeight = e.detail.height
...@@ -340,6 +197,7 @@ Page({ ...@@ -340,6 +197,7 @@ Page({
}) })
}, },
goodsActionClick(e) { goodsActionClick(e) {
if (e.detail == 'join') return this.toAddShopCar()
this.showSkuModal(e.detail) this.showSkuModal(e.detail)
}, },
onLoad(options) { onLoad(options) {
...@@ -348,10 +206,9 @@ Page({ ...@@ -348,10 +206,9 @@ Page({
}).catch(err => { }).catch(err => {
console.error('参数获取失败:', err) console.error('参数获取失败:', err)
}) })
this.getPlatFormAddress() // this.getPlatFormAddress()
}, },
showSkuModal(type) { showSkuModal(type) {
// if (this.data.isCarOwner) return
this.setData({ this.setData({
showSku: true, showSku: true,
clickType: type clickType: type
...@@ -415,13 +272,17 @@ Page({ ...@@ -415,13 +272,17 @@ Page({
// }) // })
// }) // })
}, },
jump(e) { // 显示地址选择弹窗
let { url, isChooseAddress } = e.currentTarget.dataset toShowAddressModal() {
wx.p.router.go(url, { this.setData({
isChooseAddress, showAddress: true
platform: true, })
staff: this.data.staffShop, },
notIntercept: this.data.staffShop // 地址选择确定
getAddress(e) {
this.setData({
contactAddress: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
}) })
}, },
back() { back() {
...@@ -443,32 +304,16 @@ Page({ ...@@ -443,32 +304,16 @@ Page({
// 获取详情 // 获取详情
getDetail(options) { getDetail(options) {
// if(!options || !options.id)return // if(!options || !options.id)return
// const { id, staff, score, isCarOwner, openId } = options // const { id, staff, score, openId } = options
// const merchantId = wx.$storage.get("srcm_shopmall_merchant_id"); // const merchantId = wx.$storage.get("srcm_shopmall_merchant_id");
// this.merchantId = merchantId // this.merchantId = merchantId
// let para = { id }, canPay = true // let para = { id }, canPay = true
// if (staff) para.businessType = 1 // if (staff) para.businessType = 1
// if (isCarOwner) {
// if (openId) {
// this.shareOpenId = options.openId
// }
// this.data.enter_time = new Date().format('yyyy-MM-dd hh:mm:ss')
// this.firstEnter = true
// this.appHide()
// this.getMyIntegral()
// para.merchantId = merchantId
// }
let data = this.data.detailInfo let data = this.data.detailInfo
let activeSku = null this.toGetSpecString(data, data.startQty)
if (data?.specificationDetailList && data?.specificationDetailList?.length) {
activeSku = data?.specificationDetailList[0]?.specificationData
data.skuPrice = data.specificationDetailList[0].retailPrice
}
this.setData({ this.setData({
detailInfo: data, detailInfo: data
activeSku
}) })
console.log(data)
// this.toGetSpecString(this.data.detailInfo, this.data.detailInfo.startQty) // this.toGetSpecString(this.data.detailInfo, this.data.detailInfo.startQty)
// shopmallApi.platformGoodsDetail(para).then(res => { // shopmallApi.platformGoodsDetail(para).then(res => {
// if (res && res.specificationResponses) { // if (res && res.specificationResponses) {
...@@ -477,35 +322,27 @@ Page({ ...@@ -477,35 +322,27 @@ Page({
// if (staff) { // if (staff) {
// canPay = score > res.redeemPoints // canPay = score > res.redeemPoints
// } // }
// // if (isCarOwner) {
// // res.retailPrice = NP.divide(res.retailPrice, 100)
// // }
// this.setData({ // this.setData({
// detailInfo: res || {}, // detailInfo: res || {},
// canPay, // canPay
// isCarOwner
// }) // })
// }) // })
}, },
getCount(e) { getCount(e) {
// this.toGetSpecString(this.data.detailInfo, e.detail) this.toGetSpecString(this.data.detailInfo, e.detail)
this.count = e.detail this.count = e.detail
}, },
// 添加购物车 // 添加购物车
toAddShopCar() { toAddShopCar() {
const { detailInfo, isCarOwner } = this.data const { detailInfo } = this.data
let userInfo = wx.p.storage.get('userInfo')
const PARAMS = { const PARAMS = {
goodsId: detailInfo.id, goodsId: detailInfo.id,
goodsNumber: this.count || detailInfo.startQty, sellQty: this.count || detailInfo.startQty,
cartType: 2, goodsSkuCode: detailInfo.goodsSkuCode,
goodsSkuCode: detailInfo.goodsSkuCode goodsSource: detailInfo.goodsSource,
} scoreSource: userInfo?.channelSource
if (isCarOwner) {
PARAMS.carOwnerPlatformFlag = 1
PARAMS.merchantId = this.merchantId
PARAMS.cartType = 4
} }
if(isCarOwner&&!detailInfo.retailPrice&&detailInfo.exchangeIntegral)return
cartApi.addToCart(PARAMS).then(res => { cartApi.addToCart(PARAMS).then(res => {
wx.$api.showToast('加入购物车成功') wx.$api.showToast('加入购物车成功')
}) })
...@@ -526,6 +363,9 @@ Page({ ...@@ -526,6 +363,9 @@ Page({
) )
}, },
closeSku() { closeSku() {
this.setData({
showSku: false
})
wx.setPageStyle({ wx.setPageStyle({
style: { style: {
overflow: 'unset' overflow: 'unset'
......
...@@ -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
// packageIndex/pages/selfGoodsDetail/index.js
const navStyle = 'background-color: transparent;'
let navBarHeight = 38
Page({
/**
* 页面的初始数据
*/
data: {
navStyle,
goodsFlag: true,
goodsInfo : {
"id" : 22525,
"merchantId" : 44210895,
"merchantName" : "波波的单店门店",
"goodsName" : "ghggh",
"goodsVideo" : "",
"goodsStatus" : 1,
"goodsImage" : "https://scrm.test.glsx.com.cn/group1/M00/0F/55/wKgD3mijFyOAXwfvAAC8AC2y3cM676.png",
"zoneId" : null,
"retailPrice" : 500,
"originalPrice" : 100,
"supplyPrice" : null,
"goodsStock" : null,
"goodsSource" : 1,
"originGoodsId" : null,
"originGoodsStatus" : null,
"deliveryType" : 2,
"expressFee" : 1000,
"install" : "Y",
"orderNo" : 0,
"offReason" : null,
"erpMaterialNo" : "",
"serviceCode" : "",
"relatedCouponId" : null,
"createdBy" : null,
"createdDate" : 1755518778000,
"updatedBy" : null,
"updatedDate" : 1755674245000,
"deletedFlag" : null,
"takeType" : "",
"takeFee" : "1",
"memberPrice" : null,
"serviceDesc" : "",
"giveEquityCard" : null,
"discoverGoodsId" : null,
"activityPrice" : null,
"retainagePrice" : null,
"giveIntegral" : null,
"exchangeIntegralFlag" : null,
"exchangeIntegral" : null,
"goodsDetailImageList" : [ {
"id" : null,
"goodsId" : null,
"content" : "https://scrm.test.glsx.com.cn/group1/M00/0F/55/wKgD3mijFyaAdEvhAAC8AC2y3cM705.png",
"resType" : 1,
"bizType" : 1,
"orderNo" : null,
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null
} ],
"goodsDescList" : [ ],
"classifyList" : [ ],
"supplyMerchantList" : [ ],
"specificationDetailList" : [ {
"id" : 5448,
"goodsId" : 22525,
"retailPrice" : 500,
"stock" : 3,
"specificationData" : "1-1&2-3",
"specificationKey" : "d61482cdf947ade156679a5f861a8701",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5447,
"goodsId" : 22525,
"retailPrice" : 1000,
"stock" : 1,
"specificationData" : "1-1&2-2",
"specificationKey" : "8ab61fe03f6398a177cbcd988f7b7b96",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5450,
"goodsId" : 22525,
"retailPrice" : 1000,
"stock" : 1,
"specificationData" : "1-2&2-3",
"specificationKey" : "a5798f7c9dfc46609c85f76c67e8915b",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
}, {
"id" : 5449,
"goodsId" : 22525,
"retailPrice" : 1500,
"stock" : 2,
"specificationData" : "1-2&2-2",
"specificationKey" : "4348e92ea0b37d7a36b5f64feb467ead",
"originGoodsId" : null,
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ],
"startTime" : null,
"endTime" : null,
"goodsStatistics" : {
"id" : null,
"goodsId" : null,
"viewAmount" : 16,
"saleAmount" : 0,
"salePriceAmount" : 0,
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null
},
"specificationList" : [ {
"id" : 3957,
"goodsId" : null,
"specificationName" : "1",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"specificationValueList" : [ {
"id" : 4946,
"goodsSpecificationId" : 3957,
"specificationValue" : "1",
"createdBy" : "bobodmd",
"createdDate" : 1755518778000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755518778000,
"deletedFlag" : "N"
}, {
"id" : 4948,
"goodsSpecificationId" : 3957,
"specificationValue" : "2",
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ]
}, {
"id" : 3958,
"goodsId" : null,
"specificationName" : "2",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"specificationValueList" : [ {
"id" : 4947,
"goodsSpecificationId" : 3958,
"specificationValue" : "2",
"createdBy" : "bobodmd",
"createdDate" : 1755518778000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755518778000,
"deletedFlag" : "N"
}, {
"id" : 4949,
"goodsSpecificationId" : 3958,
"specificationValue" : "3",
"createdBy" : "bobodmd",
"createdDate" : 1755674239000,
"updatedBy" : "bobodmd",
"updatedDate" : 1755674239000,
"deletedFlag" : "N"
} ]
} ],
"takeGoodsIdList" : null,
"merchantIdList" : null,
"linkUrl" : null,
"qrCodeUrl" : null,
"posterUrl" : null,
"needActivityInfo" : null,
"activityInfo" : null,
"orderByType" : null,
"relatedCoupon" : null,
"businessTypeList" : [ {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "1",
"businessTypeName" : "整车/新车",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
}, {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "2",
"businessTypeName" : "保养",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
}, {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "3",
"businessTypeName" : "维修",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
}, {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "4",
"businessTypeName" : "汽车金融",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
}, {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "5",
"businessTypeName" : "零配件/精品",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
}, {
"id" : null,
"merchantId" : null,
"merchantName" : null,
"goodsId" : null,
"businessType" : "6",
"businessTypeName" : "车险",
"createdBy" : null,
"createdDate" : null,
"updatedBy" : null,
"updatedDate" : null,
"deletedFlag" : null,
"isChoose" : 0
} ],
"takeAllMerchant" : null,
"isMemberGoods" : null,
"goodsSources" : null,
"isActivityUsing" : null,
"goodsIds" : null,
"originGoods" : null,
"paymentType" : null,
"depositPrice" : null,
"saleAmount" : null,
"discoverGoodsSource" : null,
"associationClassifyFirstId" : null,
"associationClassifyFirstName" : null
},
addressList: [{
id: 1,
receiveName: '何瑶1',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 1
}, {
id: 2,
receiveName: '何瑶2',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 3,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 4,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 5,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 6,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}, {
id: 7,
receiveName: '何瑶',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
countyName: '南山区',
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}],
defaultAddress: {id: 2}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
this.getDetail(options)
}).catch(err => {
console.error('参数获取失败:', err)
})
// this.getPlatFormAddress()
},
navbarReady(e) {
navBarHeight = e.detail.height
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
onPageScroll(e) {
const { curTabIndex } = this.data
if (curTabIndex == 0) {
this.scrollY = e.scrollTop
}
this.setData({
navStyle: e.scrollTop >= navBarHeight || curTabIndex ? '' : navStyle,
opacity: curTabIndex == 1 ? 1 : e.scrollTop / 200,
})
},
// 点击添加购物车或立即兑换
goodsActionClick(e) {
let type = e.detail
this.showSkuFun()
this.setData({
clickType: type
})
},
// 显示sku弹窗
showSkuFun() {
this.setData({
showSku: true
})
wx.setPageStyle({
style: {
overflow: 'hidden'
}
})
},
// 显示地址选择弹窗
toShowAddressModal() {
this.setData({
showAddress: true
})
},
// 地址选择确定
getAddress(e) {
this.setData({
contactAddress: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
})
},
changeBanner(e) {
this.setData({
bannerIndex: e.detail.current
})
},
previewImage(e) {
let {
current,
item
} = e.currentTarget.dataset
let urls = []
item.map(i => {
urls.push(i.content)
})
wx.p.wxApi.previewImage({
current,
urls
})
},
back() {
wx.p.router.back()
},
getDetail(options) {
let { goodsInfo } = this.data
let activeSku = null
if (goodsInfo.specificationList && goodsInfo.specificationList.length) {
activeSku = goodsInfo.specificationDetailList[0].specificationData
goodsInfo.skuPrice = goodsInfo.specificationDetailList[0].retailPrice
}
this.setData({
goodsInfo,
activeSku
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ 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}, {merchantId: 1, merchantName: '1111'}]
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')
} 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
// pages/chooseMerchant/index.js
import commonApi from '~/api/module/common.js'
Page({
/**
* 页面的初始数据
*/
data: {
"merchantList" : [ {
"accountName" : "18372203315",
"merchantId" : 44212483,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt",
"duty" : null,
"merchantName" : "自动化园区店01",
"channelType" : 1,
"isSuper" : false,
"uuid" : "a4ab56c695c0455fa49c9a7c5c33e789",
"createdDate" : "2024-08-06 11:31:36",
"bussinessId" : 12518,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "3,0,2,5",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44209813,
"accountLevel" : 1,
"userType" : 2,
"phone" : "18372203315",
"name" : "0422篱笆",
"duty" : null,
"merchantName" : "广联数科(内部使用)",
"channelType" : 1,
"isSuper" : false,
"uuid" : "5787ecfc61a54480a8baa2c391c0eca7",
"createdDate" : "2024-02-23 16:44:10",
"bussinessId" : 7938,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "0,1,4,3,2,5,6",
"department" : 0,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6", "7" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44210823,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "0914测试ymt",
"duty" : null,
"merchantName" : "腾势",
"channelType" : 2,
"isSuper" : false,
"uuid" : "2b247311169d4a728312a4a799cf874e",
"createdDate" : "2024-09-14 17:06:37",
"bussinessId" : 13287,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "6,0",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44212571,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "尹梦甜",
"duty" : null,
"merchantName" : "test2204",
"channelType" : 1,
"isSuper" : false,
"uuid" : "95f59c8460af43d4a22b86a17fffa860",
"createdDate" : "2024-02-27 10:35:26",
"bussinessId" : 7939,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "0,3,4",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44218105,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt",
"duty" : null,
"merchantName" : "第一个鸿蒙4S店",
"channelType" : 1,
"isSuper" : false,
"uuid" : "d79d9c0f2ecd4b02b9460137fee768f2",
"createdDate" : "2025-04-21 14:52:13",
"bussinessId" : 13686,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "1,6,0",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2", "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44212540,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "0523ymt",
"duty" : null,
"merchantName" : "xiejq园区店",
"channelType" : 1,
"isSuper" : false,
"uuid" : "2ca629aa379244a787536a55259a7126",
"createdDate" : "2024-05-23 16:38:17",
"bussinessId" : 10548,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "1,4,3,0,2",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44218088,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "草稿门店",
"duty" : null,
"merchantName" : "ymt门店001",
"channelType" : 1,
"isSuper" : false,
"uuid" : "8a36fdda9cdb41dbb251d85a1af42a5e",
"createdDate" : "2024-07-18 14:09:01",
"bussinessId" : 12264,
"weChatOpenId" : "ooPYo49bo4-UlPdOPY9v11KmUJRA",
"weChatUnionId" : "oV6hWt2o3sH9x5-wjiFgYgvaODOE",
"weChatNickName" : "篱笆泥巴",
"weChatAvatarUrl" : "https://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaEIXAllSgFVOVwLdyD3icNH9ewwu6NtBXJOFXB8gPLlDBQHM55x8PNSB9911eyZIeZ6X1ibEZia4hsib6RBMtZMF9PiccdH7u6b1hQYicia6icc7yKqXmQ/132",
"weChatAppId" : "wxe10067a63c1856ac",
"weChatPhone" : "18372203315",
"staffLabel" : "1",
"department" : 0,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44210895,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "尹梦甜",
"duty" : null,
"merchantName" : "波波的单店门店",
"channelType" : 1,
"isSuper" : false,
"uuid" : "397fa2a027bf409d988039608d605082",
"createdDate" : "2023-09-18 10:19:57",
"bussinessId" : 7833,
"weChatOpenId" : "ooPYo49bo4-UlPdOPY9v11KmUJRA",
"weChatUnionId" : "oV6hWt2o3sH9x5-wjiFgYgvaODOE",
"weChatNickName" : "篱笆泥巴",
"weChatAvatarUrl" : "https://thirdwx.qlogo.cn/mmopen/vi_32/78vDM2vOOAhc6CH3Z9QzhBiatQGJE4SQLxrNWXon89DwELFkfGGlldj8eM9L6msSLcR1pAMD6XV6jRhJPC9OiblA/132",
"weChatAppId" : "wxe10067a63c1856ac",
"weChatPhone" : "18372203315",
"staffLabel" : "3,1,4,0,2,6,5",
"department" : 1,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44217969,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt-xiejq4s店10",
"duty" : null,
"merchantName" : "xiejq4s店-10",
"channelType" : 1,
"isSuper" : false,
"uuid" : "4aaaa49ea16b443c9f147bce099ba0f7",
"createdDate" : "2025-04-21 16:06:28",
"bussinessId" : 13689,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "6,1,0",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44218276,
"accountLevel" : 1,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt",
"duty" : null,
"merchantName" : "ymt门店003(享界)",
"channelType" : 1,
"isSuper" : false,
"uuid" : "3d0f933e73df46a4bf15ac1506c6910b",
"createdDate" : "2025-04-24 11:07:19",
"bussinessId" : 13691,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "1,6,0",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44211560,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "0528ymt",
"duty" : null,
"merchantName" : "经营模式园区店test",
"channelType" : 1,
"isSuper" : false,
"uuid" : "883443ae75414397a0dac05aac215cfe",
"createdDate" : "2024-05-28 13:59:24",
"bussinessId" : 10560,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "0",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44209480,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt测试1号",
"duty" : null,
"merchantName" : "测试园区店",
"channelType" : 2,
"isSuper" : false,
"uuid" : "caf2c1d54fdb43dcbe5c7f55912ec320",
"createdDate" : "2023-12-07 10:29:46",
"bussinessId" : 7903,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "4,3",
"department" : null,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44211025,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "尹梦甜",
"duty" : null,
"merchantName" : "流程测试园区门店",
"channelType" : 2,
"isSuper" : false,
"uuid" : "6825aaebf4f04f6a8a4c3d5a9b26c914",
"createdDate" : "2023-09-19 18:25:40",
"bussinessId" : 7838,
"weChatOpenId" : null,
"weChatUnionId" : null,
"weChatNickName" : null,
"weChatAvatarUrl" : null,
"weChatAppId" : null,
"weChatPhone" : "18372203315",
"staffLabel" : "1,4,3,0,2",
"department" : 0,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "6" ]
}, {
"accountName" : "18372203315",
"merchantId" : 44212556,
"accountLevel" : 4,
"userType" : 2,
"phone" : "18372203315",
"name" : "ymt测试1号",
"duty" : null,
"merchantName" : "0918测试1.1.2-门店",
"channelType" : 1,
"isSuper" : false,
"uuid" : "d4b283988d104d8e814a167539886248",
"createdDate" : "2023-09-20 15:22:44",
"bussinessId" : 7840,
"weChatOpenId" : "ooPYo49bo4-UlPdOPY9v11KmUJRA",
"weChatUnionId" : "oV6hWt2o3sH9x5-wjiFgYgvaODOE",
"weChatNickName" : "篱笆泥巴",
"weChatAvatarUrl" : "https://thirdwx.qlogo.cn/mmopen/vi_32/78vDM2vOOAhc6CH3Z9QzhBiatQGJE4SQLxrNWXon89DwELFkfGGlldj8eM9L6msSLcR1pAMD6XV6jRhJPC9OiblA/132",
"weChatAppId" : "wxe10067a63c1856ac",
"weChatPhone" : "18372203315",
"staffLabel" : "3,1,4,0,2,6",
"department" : 1,
"permissionMerchantIds" : null,
"subLoginUser" : null,
"merchantAccountList" : [ "2" ]
} ],
flag: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
this.setData({
paramsData: params
})
}).catch(err => {
console.error('参数获取失败:', err)
})
},
chooseAccount(e) {
let { index } = e.currentTarget.dataset
this.setData({
checkedId: index
})
this.choiceAccountLogin()
},
choiceAccountLogin() {
let { paramsData } = this.data
let obj = paramsData?.merchantList[this.data.checkedId]
if (!obj?.merchantId) {
wx.p.wxApi.showToast('请选择账号')
return
}
wx.p.isLogin = true
wx.p.storage.set('userInfo', { ...paramsData.loginData, merchantId: obj?.merchantId, merchantName: obj?.merchantName })
wx.p.router.reLaunch('/pages/tab/index/index', )
},
bindconfirm(e){
const searchValue = e.detail.value
let result = []
let {paramsData} = this.data
if(this.orginValue){
paramsData.merchantList = this.orginValue
}else{
this.orginValue = paramsData.merchantList.concat([])
}
paramsData.merchantList.forEach(item=>{
if((item.merchantName.indexOf(searchValue)!=-1) || ((item.merchantId.toString()).indexOf(searchValue)!=-1)){
result.push(item)
}
})
if(!searchValue){
result = paramsData.merchantList
}
this.setData({
['paramsData.merchantList']: result
})
},
bindInput(e){
if(!(e.detail.value)){
this.setData({
['paramsData.merchantList']: this.orginValue || this.data.paramsData.merchantList
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "选择账号",
"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,84 @@ Page({ ...@@ -130,22 +133,84 @@ 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})
// 获取当前积分数据 this.getPointsWallet()
this.getPointsData()
}, },
getPointsData() {
let { userInfo } = this.data // 获取积分钱包数据
if (!userInfo?.phone && !userInfo?.channelSource) return getPointsWallet() {
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: Number(userInfo?.channelSource)}).then(r => { 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 {
// 未开通弹出开通钱包弹窗
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)
} }
}) })
}, },
closeWallet() {
let { copyWalletObj } = this.data
this.setData({showEnableWallet: 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)
}
})
},
// 一键开通积分钱包
enableWalletConfirm(e) {
let { walletObj } = e.detail
commonApi.openPointsWallet(walletObj).then(res => {
let { code, message } = res
if (code == 0) {
this.setData({
showEnableSuccess: true,
showEnableWallet: false
})
this.replaceNickName(walletObj)
} else {
wx.p.wxApi.showToast(message)
}
})
},
// 跳转积分中心 // 跳转积分中心
handleToPointCenter() { handleToPointCenter() {
wx.p.router.go('/packageIndex/pages/integral/index/index') wx.p.router.go('/packageIndex/pages/integral/index/index')
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
"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",
"enable-success": "/components/EnableSuccess/EnableSuccess"
}, },
"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,8 @@ ...@@ -55,4 +55,8 @@
</view> </view>
</view> </view>
</block> </block>
<!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
<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!