Commit d8af7165 by zhangxw

登录修改

1 parent 0b5ce1c9
Showing 49 changed files with 2478 additions and 682 deletions
......@@ -76,5 +76,9 @@ module.exports = {
/**获取用户信息 */
getLoginInfo(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 @@
"pages/tab/cart/index",
"pages/tab/mine/index",
"pages/webView/webView",
"pages/Login/Login"
"pages/Login/Login",
"pages/chooseMerchant/index"
],
"requiredPrivateInfos": [
"getLocation"
......@@ -60,7 +61,8 @@
"pages/integral/withdrawalRules/withdrawalRules",
"pages/confirmOrder/index",
"pages/exchangeSuccess/index",
"pages/integral/withdrawalDetail/withdrawalDetail"
"pages/integral/withdrawalDetail/withdrawalDetail",
"pages/selfGoodsDetail/index"
]
},
{
......
......@@ -4,19 +4,21 @@ Component({
* 组件的属性列表
*/
properties: {
idIndex: Number,
defaultAddress: Object,
address:Array,
show: {
type: Boolean,
observer: function (val, o) {
if (val && this.properties.address.length) {
console.log(this.properties.defaultAddress?.id)
this.properties.address.forEach((item, index) => {
if (item.id == this.properties.idIndex) {
this.setData({
currentIndex: index,
})
if (item.id == this.properties.defaultAddress?.id) {
item.active = true
}
})
this.setData({
address: this.properties.address
})
}
}
},
......@@ -27,7 +29,6 @@ Component({
* 组件的初始数据
*/
data: {
currentIndex: 0,
addressList: []
},
......@@ -36,10 +37,9 @@ Component({
*/
methods: {
back() {
// this.triggerEvent('getAddress', { addressInfo: this.data.addressInfo })
this.cancel()
},
addNew () {
addNew (e) {
let { url } = e.currentTarget.dataset
wx.p.router.go(url,{
platform:true,
......
......@@ -2,10 +2,6 @@
border-radius: 16rpx 16rpx 0 0;
}
.container {
height: 100%;
}
.address-container {
position: fixed;
left: 0;
......@@ -22,7 +18,7 @@
.container {
position: absolute;
width: 100%;
height: 80%;
height: 65%;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 32rpx 32rpx 0 0;
......
......@@ -26,7 +26,7 @@
</scroll-view>
</view>
<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>
</view>
......
......@@ -22,7 +22,7 @@ Component({
*/
methods: {
confirm() {
this.triggerEvent('confirm')
this.setData({show: false})
}
}
})
\ No newline at end of file
// components/Goods/Goods.js
import {
centsToyuan
} from '~/utils/format'
import homeApi from '~/api/module/home.js'
import cartApi from '~/api/module/cart.js'
Component({
/**
......@@ -39,12 +37,12 @@ Component({
// 进入商品详情
handleSale(e) {
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) {
let { target } = e.currentTarget.dataset
this.triggerEvent('join', target)
this.handleSale(e)
}
},
lifetimes: {
......
{
"component": true,
"usingComponents": {
"sku": "../Sku/index"
}
"usingComponents": {}
}
\ 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,
"usingComponents": {
"address":"../Adress/index",
"stepper": "/components/Stepper/Stepper"
}
}
\ 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
<!--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
// packageMall/pages/pay/pay.js
// import { shopmallApi, mineApi } from '~/api/api'
import NP from 'number-precision'
let timer
Page({
/**
......@@ -7,12 +8,8 @@ Page({
*/
data: {
contactInfo: {},
orderCouponDTO: '', //最大优惠券
userCouponDTOS: [], //优惠券列表,
couponCost: 0,
goodsNumber: 1,
isPay: false,
isCoupon: true,
goodsInfo: {},
goodsNum: 0,
shopFlag: true,
shopCartFlag: true,
addressFlag: true,
......@@ -30,22 +27,20 @@ Page({
onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => {
console.log(params)
params = {
contactInfo: {
contactAddress: '广东省智园崇文园区1号楼14楼崇文园区1号楼2222',
contactName: '文晶晶',
contactPhone: '15707380000'
},
isDefault: 1,
goodsList: params.goodsList
}
// params = {
// contactInfo: {
// contactAddress: '广东省智园崇文园区1号楼14楼崇文园区1号楼2222',
// contactName: '文晶晶',
// contactPhone: '15707380000'
// },
// isDefault: 1,
// goodsList: params.goodsList
// }
this.setData({
contactInfo: params.contactInfo,
isDefault: params.isDefault,
goodsList: params.goodsList
goodsInfo: params
})
// this.getDetail(options)
this.getMoney()
this.getMoney(params)
}).catch(err => {
console.error('参数获取失败:', err)
})
......@@ -54,33 +49,6 @@ Page({
if(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 = []
if(obj.platformShop){
......@@ -102,7 +70,6 @@ Page({
this.setData({
...obj
})
}
})
},
dialogConfirm(e) {
......@@ -115,61 +82,31 @@ Page({
}
},
changeCount(e) {
console.log(e)
let { index, id } = e.currentTarget.dataset
let goodsNumber = e.detail
let { orderParams, goodsList } = this.data
goodsList[index].goodsNumber = 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
let count = e.detail,
{
index
} = e.currentTarget.dataset
const name = `goodsInfo.goodsList[${index}].goodsNumber`
this.setData({
orderParams,
goodsList
[name]: count
}, async () => {
this.getMoney(this.data.goodsInfo)
})
},
getMoney() {
let { isActivity, goodsList, couponCost, isPay } = this.data
let expressFeeArray = []
if (isActivity) {
couponCost = 0
}
let retailPrice = 0
let expressFee = 0
let goodsNumber = 0
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)
// 计算商品总价或者积分
getMoney(goodsInfo) {
const goodsList = goodsInfo.goodsList
if (!goodsList || !goodsList.length) return
let money = 0,
goodsNum = 0
goodsList.forEach(el => {
money = NP.plus(money, NP.times(el.retailPrice, el.goodsNumber)) //总价
goodsNum = NP.plus(goodsNum, el.goodsNumber)
})
this.setData({
sum: sum,
expressFee,
goodsNumber,
money
money,
goodsNum,
goodsInfo
})
},
checkOut() {
......@@ -184,7 +121,7 @@ Page({
}
/**购物车 */
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))
if (!isPay) {
//购物车结算
......
{
"navigationBarTitleText": "确认订单"
"navigationBarTitleText": "确认订单",
"usingComponents": {
"stepper": "/components/Stepper/Stepper"
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@
</block>
</block>
<view class="content-box">
<block wx:for="{{goodsList}}" wx:key="index">
<block wx:for="{{goodsInfo.goodsList}}" wx:key="index">
<view class="item">
<view class="content">
<view class="goods-info">
......@@ -47,9 +47,7 @@
{{item.retailPrice}}
<text>积分</text>
</view>
<view class="goods-num">
x{{item.goodsNumber}}
</view>
<stepper data-item="{{item}}" count="{{item.goodsNumber}}" max="{{item.goodsStock}}" data-id="{{item.goodsId}}" bindchange="changeCount" data-index="{{index}}"></stepper>
</view>
</view>
</view>
......@@ -82,7 +80,7 @@
<view class="goods-action">
<view class="left">
<view class="radio">
共{{goodsNumber}}件,合计:
共{{goodsNum}}件,合计:
</view>
<view class="total">
<view class="price">
......
......@@ -105,14 +105,6 @@
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 {
margin-top: 24rpx;
padding: 0 24rpx;
......
import NP from 'number-precision'
import cartApi from '~/api/module/cart.js'
Component({
/**
* 组件的属性列表
......@@ -8,16 +6,12 @@ Component({
show: Boolean,
address: Array,
type: String,
goods: {
type: Object,
observer: function(n) {
this.setDefaultSku(n)
}
},
goods: Object,
defaultAddress: Object,
defaultAds: String,
staffShop:Boolean,
canPay:Boolean
canPay:Boolean,
clickType: String
},
data: {
currentIndex: 0,
......@@ -30,26 +24,6 @@ Component({
* 组件的方法列表
*/
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) {
let {goods,jfCount,staffShop} = this.data
if(!staffShop)return
......@@ -72,7 +46,8 @@ Component({
})
},
toShowAddressModal() {
this.setData({
let thisPage = wx.p.router.getPageInstance()
thisPage.setData({
showAddress: true
})
},
......@@ -88,39 +63,17 @@ Component({
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() {
const userInfo = wx.p.storage.get('userInfo')
const { remain, goods, goodsNumber, defaultAddress,staffShop, clickType } = this.data
let { clickType } = this.data
if (clickType != 'pay') {
return this.cancel()
}
const { remain, goods, goodsNumber, defaultAddress,staffShop } = this.data
if(!defaultAddress.receiveName){
return wx.$api.showToast('请选择收货地址')
return wx.p.wxApi.showToast('请选择收货地址')
}
const params = {
// 跳转到确认订单
let query = {
receiveName: defaultAddress.receiveName,
receiveMobile: defaultAddress.receiveMobile,
provinceId: defaultAddress.provinceId,
......@@ -138,20 +91,7 @@ Component({
sellQty: goodsNumber,
}],
}
if (clickType == 'join') {
// 添加购物车
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')
}
wx.p.router.go('/packageIndex/pages/confirmOrder/index', query)
}
}
})
{
"component": true,
"usingComponents": {
"stepper": "/components/Stepper/Stepper"
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
right: 0;
top: 0;
z-index: 9;
height: 100vh;
.sku-bg {
position: absolute;
width: 100%;
......@@ -79,34 +80,25 @@
}
.sku-list {
.sku-title {
color: #2D2D2E;
font-weight: 500;
padding-top: var(--margin);
display: flex;
align-items: center;
justify-content: space-between;
}
.sku-item {
display: flex;
flex-wrap: wrap;
.item {
height: 52rpx;
background: #F7F8FA;
padding: 0 20rpx;
margin: 20rpx 20rpx 0 0;
font-size: 24rpx;
color: #656566;
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);
}
}
}
display: flex;
flex-wrap: wrap;
.sku {
padding: 6rpx 20rpx;
background: #F7F8FA;
border-radius: 4rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
}
.sku_active {
background: #fc5b320f;
border: 2rpx solid #FC5B32;
border-radius: 4rpx;
font-weight: 400;
font-size: 24rpx;
color: #FC5B32;
}
}
}
......
......@@ -8,28 +8,22 @@
</view>
<view class="right-box">
<view class="price-box">
<text class="price">{{goods.salePrice || 35}}</text><text>积分</text>
<text class="price">{{goods.sellPrice}}</text><text>积分</text>
</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 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 class="sku-box">
<view class="title">规格</view>
<view class="sku-list">
<block wx:for="{{goods.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>
<!-- <block wx:for="{{goods.specificationResponses}}" wx:key="index">
<block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block> -->
</block>
</view>
</view>
<view class="count-box flex_scb">
......@@ -41,13 +35,13 @@
</view>
</view>
</view>
<view class="textarea-box">
<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="{{true}}">
<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>
......@@ -55,10 +49,8 @@
</view>
</view>
<view class="btn-wrap flex_cc">
<view wx:if="{{staffShop&&!canPay}}" class="btn flex_cc diable_btn">积分不足</view>
<view wx:else bind:tap="toCreatedOrder" class="btn flex_cc">确认</view>
<view bind:tap="toCreatedOrder" class="btn flex_cc">确认</view>
</view>
<view style="height:290rpx"></view>
</view>
</view>
<address staff="{{staffShop}}" address="{{address}}" idIndex="{{defaultAddress.id}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
......@@ -21,223 +21,70 @@ Page({
},
skuInfo: '',
staffShop: false,
isCarOwner: false,
payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }],
detailInfo: {
"id" : 267,
"goodsSkuCode" : "2888888889071442",
"goodsSkuName" : "系统商品009 鹅黄 28寸",
"id" : 233,
"goodsSkuCode" : "2888888889106169",
"goodsSkuName" : "书架 丹青",
"goodsSkuTitle" : "",
"firstCategoryName" : "箱包",
"secondCategoryName" : "功能箱包",
"lastCategoryName" : "拉杆箱",
"goodsStock" : 695,
"firstCategoryName" : "家具",
"secondCategoryName" : "家具",
"lastCategoryName" : "书架",
"goodsStock" : 11690,
"salePrice" : 0.00,
"redeemPoints" : 40,
"sellPrice" : 150.00,
"marketPrice" : 700.00,
"redeemPoints" : null,
"sellPrice" : 100.00,
"marketPrice" : 100.00,
"startQty" : 1,
"brandName" : "膳魔师",
"brandName" : "土匠坊",
"returnGoodsRules" : 1001,
"goodsCharacteristic" : "系统商品009",
"goodsUnit" : "",
"modelNumber" : "系统商品009",
"productPlace" : "",
"goodsCharacteristic" : "书架",
"goodsUnit" : "个",
"modelNumber" : "书架",
"productPlace" : "湖南",
"haveShelfLife" : 0,
"shelfLife" : "0",
"fragileGoods" : 0,
"grossWeight" : 0.0000,
"grossWeightUnit" : "kg",
"density" : 0.0000,
"extent" : 0,
"width" : 0,
"height" : 0,
"extent" : 11,
"width" : 12,
"height" : 11,
"attributeResponses" : [ {
"attributeCode" : "1001",
"attributeName" : "锁具类型",
"attributeValueCode" : "2888888888892503",
"attributeValueName" : "系统商品009"
"attributeCode" : null,
"attributeName" : null,
"attributeValueCode" : null,
"attributeValueName" : null
}, {
"attributeCode" : "990",
"attributeName" : "拉杆种类",
"attributeValueCode" : "2888888888892497",
"attributeValueName" : "系统商品009"
"attributeCode" : null,
"attributeName" : null,
"attributeValueCode" : null,
"attributeValueName" : null
}, {
"attributeCode" : "995",
"attributeName" : "闭合方式",
"attributeValueCode" : "2888888888892500",
"attributeValueName" : "系统商品009"
}, {
"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"
"attributeCode" : null,
"attributeName" : null,
"attributeValueCode" : null,
"attributeValueName" : null
} ],
"imageResponses" : [ {
"imgUrl" : "https://img.yunzhonghe.com/image/1618215408263PefyXSUtQW.jpg",
"imgUrl" : "https://img.yunzhonghe.com/image/1650252368566tfAMIHdsHJ.jpg",
"imgMain" : 1,
"imgSort" : 0
"imgSort" : 1
}, {
"imgUrl" : "https://img.yunzhonghe.com/image/1618215556741tYVyESRNzw.jpg",
"imgUrl" : "https://img.yunzhonghe.com/image/1685065224278RMJRENGzEu.jpg",
"imgMain" : 0,
"imgSort" : 1
} ],
"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"
} ]
"imgSort" : 2
}, {
"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"
} ]
"imgUrl" : "https://img.yunzhonghe.com/image/1685065228949FBsBtEXxrq.jpg",
"imgMain" : 0,
"imgSort" : 3
} ],
"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"
"specificationResponses" : [ {
"specName" : "颜色",
"specValue" : "丹青"
} ],
"goodsDescribe" : "<p>22</p>",
"goodsDescribe" : "<p>书架</p>",
"goodsPosition" : 2,
"saleFlag" : 1,
"shelvesStatus" : 1001,
......@@ -249,7 +96,7 @@ Page({
},
addressList: [{
id: 1,
receiveName: '何瑶',
receiveName: '何瑶1',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
......@@ -258,7 +105,7 @@ Page({
isDefault: 1
}, {
id: 2,
receiveName: '何瑶',
receiveName: '何瑶2',
receiveMobile: '15044526870',
provinceName: '广东省',
cityName: '深圳市',
......@@ -311,7 +158,7 @@ Page({
address: '南山智园崇文园区1号楼14层',
isDefault: 0
}],
defaultAddress: {}
defaultAddress: {id: 3}
},
appHide() {
wx.offAppHide()
......@@ -320,6 +167,16 @@ Page({
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) {
navBarHeight = e.detail.height
......@@ -340,6 +197,7 @@ Page({
})
},
goodsActionClick(e) {
if (e.detail == 'join') return this.toAddShopCar()
this.showSkuModal(e.detail)
},
onLoad(options) {
......@@ -348,10 +206,9 @@ Page({
}).catch(err => {
console.error('参数获取失败:', err)
})
this.getPlatFormAddress()
// this.getPlatFormAddress()
},
showSkuModal(type) {
// if (this.data.isCarOwner) return
this.setData({
showSku: true,
clickType: type
......@@ -415,13 +272,17 @@ Page({
// })
// })
},
jump(e) {
let { url, isChooseAddress } = e.currentTarget.dataset
wx.p.router.go(url, {
isChooseAddress,
platform: true,
staff: this.data.staffShop,
notIntercept: this.data.staffShop
// 显示地址选择弹窗
toShowAddressModal() {
this.setData({
showAddress: true
})
},
// 地址选择确定
getAddress(e) {
this.setData({
contactAddress: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
})
},
back() {
......@@ -443,32 +304,16 @@ Page({
// 获取详情
getDetail(options) {
// 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");
// this.merchantId = merchantId
// let para = { id }, canPay = true
// 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 activeSku = null
if (data?.specificationDetailList && data?.specificationDetailList?.length) {
activeSku = data?.specificationDetailList[0]?.specificationData
data.skuPrice = data.specificationDetailList[0].retailPrice
}
this.toGetSpecString(data, data.startQty)
this.setData({
detailInfo: data,
activeSku
detailInfo: data
})
console.log(data)
// this.toGetSpecString(this.data.detailInfo, this.data.detailInfo.startQty)
// shopmallApi.platformGoodsDetail(para).then(res => {
// if (res && res.specificationResponses) {
......@@ -477,35 +322,27 @@ Page({
// if (staff) {
// canPay = score > res.redeemPoints
// }
// // if (isCarOwner) {
// // res.retailPrice = NP.divide(res.retailPrice, 100)
// // }
// this.setData({
// detailInfo: res || {},
// canPay,
// isCarOwner
// canPay
// })
// })
},
getCount(e) {
// this.toGetSpecString(this.data.detailInfo, e.detail)
this.toGetSpecString(this.data.detailInfo, e.detail)
this.count = e.detail
},
// 添加购物车
toAddShopCar() {
const { detailInfo, isCarOwner } = this.data
const { detailInfo } = this.data
let userInfo = wx.p.storage.get('userInfo')
const PARAMS = {
goodsId: detailInfo.id,
goodsNumber: this.count || detailInfo.startQty,
cartType: 2,
goodsSkuCode: detailInfo.goodsSkuCode
}
if (isCarOwner) {
PARAMS.carOwnerPlatformFlag = 1
PARAMS.merchantId = this.merchantId
PARAMS.cartType = 4
sellQty: this.count || detailInfo.startQty,
goodsSkuCode: detailInfo.goodsSkuCode,
goodsSource: detailInfo.goodsSource,
scoreSource: userInfo?.channelSource
}
if(isCarOwner&&!detailInfo.retailPrice&&detailInfo.exchangeIntegral)return
cartApi.addToCart(PARAMS).then(res => {
wx.$api.showToast('加入购物车成功')
})
......@@ -526,6 +363,9 @@ Page({
)
},
closeSku() {
this.setData({
showSku: false
})
wx.setPageStyle({
style: {
overflow: 'unset'
......
......@@ -2,6 +2,7 @@
"navigationStyle": "custom",
"usingComponents":{
"mp-html":"/components/mp-html/index",
"sku": "/components/Sku"
"sku": "./components/Sku/index",
"address":"/components/Adress/index"
}
}
\ No newline at end of file
......@@ -134,6 +134,8 @@ page {
.content {
width: 520rpx;
height: 44rpx;
font-size: 24rpx;
color: #2D2D2E;
.address-text {
width: 520rpx;
overflow: hidden;
......@@ -151,9 +153,10 @@ page {
}
.goods-detail-box {
.title {
text-align: center;
font-size: 24rpx;
color: #B1B1B3;
margin-left: 40rpx;
font-size: 32rpx;
color: #282829;
font-weight: 500;
}
}
}
......
......@@ -8,7 +8,7 @@
</view>
</navigation-bar>
</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">
<view bind:tap="changeTab" data-index="{{index}}" class="tab-box flex_cc">
<text>{{item}}</text>
......@@ -39,7 +39,7 @@
<view class="price">
<view class="price-box">
<view class="sale-price">
{{activeSku ? detailInfo.skuPrice : detailInfo.sellPrice}}
{{detailInfo.sellPrice}}
<text>积分</text>
</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
......@@ -48,22 +48,22 @@
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view>
</view>
<view class="goods-title">{{detailInfo.goodsName}}</view>
<view class="goods-title">{{detailInfo.brandName}}{{detailInfo.goodsSkuName}}</view>
</view>
<view class="container-item select-params-box">
<view class="cell" wx:if="{{activeSku}}">
<view class="flex" bind:tap="showSkuModal">
<view class="cell" bind:tap="showSkuModal" data-type="choose">
<view class="flex">
<view class="title">已选</view>
<view class="content flex_ccc">
<view>{{activeSku}}</view>
<view>{{skuInfo}}</view>
</view>
</view>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell" bindtap="jump" >
<view class="cell" bindtap="toShowAddressModal">
<view class="flex">
<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>
</view>
......@@ -77,7 +77,7 @@
</view>
</view>
<view class="goods-detail-box">
<view class="title">图文详情</view>
<view class="title">商品详情</view>
<view class="image-list-wrap">
<mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view>
......@@ -115,4 +115,5 @@
<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>
</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
<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
// 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
{
"navigationStyle": "custom",
"usingComponents": {
"selfSku": "/components/selfSku/index",
"address": "/components/Adress/index"
}
}
\ 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
<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
......@@ -5,41 +5,45 @@ Page({
data: {},
//退出登录
logout() {
wx.p.api.userApi.logout().then(async ({
code,
message
}) => {
wx.p.wxApi.showLoading()
if (code == '0') {
// wx.$Track.setTrack({}, 4)
wx.p.isLogin = false
// wx.$util.removeSystemStorage()
wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId')
wx.p.storage.rm('isVIP')
wx.p.router.back(prevPage => {
wx.hideLoading()
prevPage.setData({
userInfo: null,
isMember: false,
vipInfo: null,
orderNumberList: null
})
})
} else {
if (code == '21' || code == '20') {
try {
const res = await wx.p.api.userApi.login()
if (res.code == 0) {
wx.p.storage.set('sessionId', res.data.sessionId)
this.logout()
} else throw res.message
} catch (error) {
wx.p.wxApi.showToast(error)
}
} else wx.p.wxApi.showToast(message)
}
})
wx.p.isLogin = false
wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId')
wx.p.router.reLaunch('/pages/Login/Login')
// wx.p.api.userApi.logout().then(async ({
// code,
// message
// }) => {
// wx.p.wxApi.showLoading()
// if (code == '0') {
// // wx.$Track.setTrack({}, 4)
// wx.p.isLogin = false
// // wx.$util.removeSystemStorage()
// wx.p.storage.rm('userInfo')
// wx.p.storage.rm('sessionId')
// wx.p.storage.rm('isVIP')
// wx.p.router.back(prevPage => {
// wx.hideLoading()
// prevPage.setData({
// userInfo: null,
// isMember: false,
// vipInfo: null,
// orderNumberList: null
// })
// })
// } else {
// if (code == '21' || code == '20') {
// try {
// const res = await wx.p.api.userApi.login()
// if (res.code == 0) {
// wx.p.storage.set('sessionId', res.data.sessionId)
// this.logout()
// } else throw res.message
// } catch (error) {
// wx.p.wxApi.showToast(error)
// }
// } else wx.p.wxApi.showToast(message)
// }
// })
},
goAgreement() {
wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/hmd/privacy.html', true)
......
......@@ -20,7 +20,8 @@ Page({
extClass: 'btn_primary'
}],
pointsSource: [],
walletObj: {}
walletObj: {},
loginData: {}
},
changeLoginType() {
const {
......@@ -192,12 +193,13 @@ Page({
/**登录回调 */
customerLoginCallBack(data) {
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({
staffPhone: loginData?.phone
}).then(res => {
......@@ -209,9 +211,7 @@ Page({
showChooseSource: true
})
} else if (data?.length == 1) {
this.setChannelSource(data[0]?.channelSource, loginData)
} else { // 无积分渠道游客
this.setChannelSource(4, loginData)
this.setChannelSource(data[0]?.channelSource)
}
} else {
wx.p.wxApi.showToast(message)
......@@ -219,104 +219,41 @@ Page({
})
},
// 设置积分渠道
setChannelSource(source, loginData) {
wx.p.isLogin = true
wx.p.storage.set('userInfo', {...loginData, channelSource: source})
// 查询积分钱包
this.getPointsWallet()
setChannelSource(source) {
let { loginData } = this.data
// 查询门店数据
this.getMerchantList(source, loginData)
},
// 获取积分钱包数据
getPointsWallet() {
let userInfo = wx.p.cache.userInfo.getUserInfo()
// 获取当前积分数量
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
getMerchantList(source, loginData) {
commonApi.getMerchantData({staffPhone: loginData?.phone, channelSource: source}).then(res => {
let { code, data, message } = res
if (code == 0) {
// 返回上一页
wx.p.router.back(thisPage => {
thisPage && thisPage.setData({
userInfo: {...userInfo, nickName: data?.name}
// 当没有门店数据返回时 默认赋值一个merchantId为 -1的门店作为游客使用
if (!data?.length) {
data = [{merchantId: -1}, {merchantId: 1, merchantName: '1111'}]
}
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 {
wx.p.wxApi.showToast(message)
}
})
},
// 选择积分来源
// 选择积分来源确定
pointSourceEvent(e) {
wx.p.storage.set('channelSource', `${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)
}
})
this.setChannelSource(e.detail)
},
// 开通成功
......
{
"usingComponents": {
"points-source": "./components/PointsSource/PointsSource",
"enable-wallet": "./components/EnableWallet/EnableWallet",
"enable-success": "./components/EnableSuccess/EnableSuccess"
"points-source": "./components/PointsSource/PointsSource"
},
"navigationStyle": "custom"
}
\ No newline at end of file
......@@ -66,8 +66,4 @@
</view>
</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
<points-source show="{{showChooseSource}}" pointsSource="{{pointsSource}}" bindconfirm="pointSourceEvent"></points-source>
\ 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
{
"navigationBarTitleText": "选择账号",
"usingComponents": {}
}
\ 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
<!--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
......@@ -27,20 +27,11 @@ Page({
async login(options = {}) {
if (options.merchantId) wx.$merchant_id = options.merchantId;
try {
const { code, data, message } = await wx.p.api.userApi.login();
if (data)
wx.p.storage.set("merchant_info", {
merchantId: data.merchantId,
merchantName: data.merchantName,
});
if (code == "0") {
const { code, data, message } = await commonApi.getLoginInfo();
if (code == 0) {
wx.p.isLogin = true;
wx.p.storage.set("sessionId", data.sessionId);
if (!data) throw message;
} else {
wx.p.isLogin = false;
wx.p.storage.rm("userInfo");
wx.p.storage.rm("sessionId");
return wx.p.router.reLaunch('/pages/Login/Login')
}
console.log("登陆信息:", data);
if (options.url) {
......
......@@ -99,6 +99,7 @@ Page({
item
} = e.currentTarget.dataset
if (item.goodsNumber == count) return
let { userInfo } = this.data
this.setData({
[`goodsList[${index}].goodsNumber`]: count
})
......@@ -107,8 +108,9 @@ Page({
let para = {
goodsId: 1,
sellQty: count,
goodsSource: target?.goodsSource,
scoreSource: 1
goodsSource: item?.goodsSource,
scoreSource: userInfo?.channelSource,
specificationData: item?.specificationData
}
cartApi.updateGoodsFormCart(para).then(res => {
wx.hideLoading()
......@@ -185,14 +187,17 @@ Page({
} = this.data
let data = []
goodsList?.map(e => (e.active ? data.push(e) : ''))
wx.p.router.go('/packageIndex/pages/confirmOrder/index', {
let params = {
goodsList: data
})
}
wx.p.router.go('/packageIndex/pages/confirmOrder/index', {...params})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let userInfo = wx.p.storage.get(userInfo)
this.setData({userInfo})
// this.getShoppingcartList()
},
getShoppingcartList() {
......@@ -224,11 +229,13 @@ Page({
let {
target
} = e.target.dataset
let { userInfo } = this.data
let para = {
goodsId: 1,
sellQty: 0,
goodsSource: target?.goodsSource,
scoreSource: 1
scoreSource: userInfo?.channelSource,
specificationData: target.specificationData
}
cartApi.updateGoodsFormCart(para).then(res => {
wx.p.wxApi.showToast('删除成功')
......
......@@ -11,6 +11,7 @@ Page({
navStyle : "background-color: transparent;",
animationData: {},
bannerUrl: '',
walletObj: {},
specialSaleArr: [{
id: 1,
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png',
......@@ -56,12 +57,14 @@ Page({
goodsId: '1',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: 'Tempo得宝手帕纸',
goodsSource: 1,
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '2',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸',
goodsSource: 2,
salePoints: '69.9',
marketPrice: '79.9'
}, {
......@@ -130,22 +133,84 @@ Page({
onLoad(options) {
const userInfo = wx.p.cache.userInfo.getUserInfo()
this.setData({userInfo})
// 获取当前积分数据
this.getPointsData()
this.getPointsWallet()
},
getPointsData() {
let { userInfo } = this.data
if (!userInfo?.phone && !userInfo?.channelSource) return
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: Number(userInfo?.channelSource)}).then(r => {
// 获取积分钱包数据
getPointsWallet() {
let userInfo = wx.p.cache.userInfo.getUserInfo()
// 获取当前积分数量
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: userInfo?.channelSource, merchantId: userInfo?.merchantId}).then(r => {
if (r?.code == 0) {
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 {
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() {
wx.p.router.go('/packageIndex/pages/integral/index/index')
......
......@@ -2,7 +2,9 @@
"usingComponents": {
"good-tab": "./components/good-tab/good-tab",
"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",
"backgroundColor": "#F9F7F7"
......
......@@ -13,7 +13,7 @@
<view class="icon">
<glsx-image src="/index/points-icon.png"></glsx-image>
</view>
<view class="points-num" bind:tap="toIntegral">{{currentScore || '-'}}</view>
<view class="points-num" bind:tap="toIntegral">{{walletObj.currentScore || '-'}}</view>
</view>
<view class="arrow-icon">
<mp-icon icon="arrow" color="#F4776D" size="7"></mp-icon>
......@@ -55,4 +55,8 @@
</view>
</view>
</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>
\ No newline at end of file
......@@ -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) {
// 已登录,放行
return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!