Commit d8af7165 by zhangxw

登录修改

1 parent 0b5ce1c9
Showing 49 changed files with 1414 additions and 441 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>
......@@ -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
{
"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
{
"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!