Commit 9c62e414 by wangzhihui

Merge branch 'SAAS+V4.56.0-0908' of http://192.168.3.233:8090/saas/mini-program/…

…points-mall into SAAS+V4.56.0-0908
2 parents 32d514a8 aafbf6fe
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2 let index = 1
/** /**
* *
......
...@@ -36,27 +36,45 @@ module.exports = { ...@@ -36,27 +36,45 @@ module.exports = {
return http.getMock(); return http.getMock();
}, },
/**手机号验证码登录 */ /**手机号验证码登录 */
phoneSmsLogin() { phoneSmsLogin(data) {
return http.fetch('scrm.api.sso.sms.login', { return http.fetch('scrm.api.sso.sms.login', {
source: 'MINIAPP', source: 'MINIAPP',
...data ...data
}) })
}, },
/**微信授权手机号登录 */ /**微信授权手机号登录 */
authPhoneLogin() { authPhoneLogin(data) {
return http.fetch('scrm.api.sso.weapp.auth.phone', { return http.fetch('scrm.api.sso.weapp.auth.phone', {
source: 'MINIAPP', source: 'MINIAPP',
...data ...data
}) })
}, },
/**查询积分钱包开通状态 */ /**获取积分渠道列表 */
getPointsWalletStatus() { getPointsSourceList(data) {
return http.fetch('scrm.api.shopmall.score.get.channelSource', {
...data
})
},
/**查询积分钱包 */
getPointsWalletData(data) {
return http.fetch('scrm.api.shopmall.pointswallet.get', { return http.fetch('scrm.api.shopmall.pointswallet.get', {
...data ...data
}) })
}, },
/**开通积分钱包 */ /**开通积分钱包 */
openPointsWallet() { openPointsWallet(data) {
return http.fetch('scrm.api.shopmall.pointswallet.open', {...data}) return http.fetch('scrm.api.shopmall.pointswallet.open', {...data})
},
/**替换积分钱包昵称 */
replaceWalletName(data) {
return http.fetch('scrm.api.sso.nickName.replace', {...data})
},
/**获取积分汇总数据 */
getPointsSummary(data) {
return http.fetch('scrm.api.shopmall.score.summary.search', {...data})
},
/**获取用户信息 */
getLoginInfo(data) {
return http.fetch('scrm.api.sso.weapp.loginfo.get', {...data})
} }
}; };
...@@ -78,28 +78,20 @@ class Request { ...@@ -78,28 +78,20 @@ class Request {
}, },
data data
} = response } = response
if (returnAll) {
resolve(data)
return
}
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId')
wx.p.storage.rm('channelSource')
wx.hideLoading() wx.hideLoading()
const thisPage = wx.p.router.getPageInstance(), // session过期跳转到登录页
options = Object.keys(thisPage.options) wx.p.router.reLaunch('/pages/Login/Login')
let currentRoute = thisPage.route,
query = []
if (options.length) {
options.map(key => {
query.push(`${key}=${thisPage.options[key]}`)
})
}
if (query.length) currentRoute += `?${query.join('&')}`
return wx.p.router.redirectTo('/pages/loading/loading', {
url: `/${currentRoute}`
})
} else { } else {
if (code == '0') { if (code == '0') {
resolve(data.data) if (returnAll) {
resolve(data)
} else {
resolve(data.data)
}
} else { } else {
wx.showToast({ wx.showToast({
title: message || '系统异常', title: message || '系统异常',
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { import {
centsToyuan centsToyuan
} from '~/utils/format' } from '~/utils/format'
import cartApi from '~/api/module/cart.js'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -43,12 +44,14 @@ Component({ ...@@ -43,12 +44,14 @@ Component({
// 加入购物车 // 加入购物车
joinCart(e) { joinCart(e) {
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
console.log('33333') this.triggerEvent('join', target)
} }
}, },
lifetimes: { lifetimes: {
attached() { attached() {
this.setWidth() this.setWidth()
let userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo})
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents":{ "usingComponents":{
"mp-html":"/components/mp-html/index", "mp-html":"/components/mp-html/index",
"sku": "./components/Sku" "sku": "/components/Sku"
} }
} }
\ No newline at end of file \ No newline at end of file
import { commonApi } from '~/api/module/common' import commonApi from '~/api/module/common.js'
const phoneRex = /^[1]([3-9])[0-9]{9}$/ const phoneRex = /^[1]([3-9])[0-9]{9}$/
Page({ Page({
/** /**
...@@ -18,7 +18,9 @@ Page({ ...@@ -18,7 +18,9 @@ Page({
}, { }, {
text: '同意', text: '同意',
extClass: 'btn_primary' extClass: 'btn_primary'
}] }],
pointsSource: [],
walletObj: {}
}, },
changeLoginType() { changeLoginType() {
const { const {
...@@ -48,7 +50,7 @@ Page({ ...@@ -48,7 +50,7 @@ Page({
data, data,
code code
} = await wx.p.api.userApi.login() } = await wx.p.api.userApi.login()
if (code == '0') this.customerLoginCallBack(data) // if (code == '0') this.customerLoginCallBack(data)
if (data) this.sessionId = data.sessionId if (data) this.sessionId = data.sessionId
wx.hideLoading() wx.hideLoading()
}, },
...@@ -139,7 +141,6 @@ Page({ ...@@ -139,7 +141,6 @@ Page({
if (!mobile) throw '请输入手机号' if (!mobile) throw '请输入手机号'
if (!captcha) throw '请输入验证码' if (!captcha) throw '请输入验证码'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号' if (!phoneRex.test(mobile)) throw '请输入正确的手机号'
// if (!isAgree) throw '请同意以下用户协议'
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
const { const {
code, code,
...@@ -164,57 +165,146 @@ Page({ ...@@ -164,57 +165,146 @@ Page({
async getPhoneNumber({ async getPhoneNumber({
detail detail
}) { }) {
const {
isAgree
} = this.data
try { try {
if (detail.errMsg && ['authorized', 'deny'].findIndex(e => detail.errMsg.toLowerCase().includes(e)) != -1) return if (detail.errMsg && ['authorized', 'deny'].findIndex(e => detail.errMsg.toLowerCase().includes(e)) != -1) return
if (!detail?.code) throw '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' if (!detail?.code) throw '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
// if (!isAgree) throw '请同意以下用户协议'
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
let obj = {
encryptedData: detail.encryptedData,
iv: detail.iv,
sessionId: this.sessionId
}
const { const {
code, code,
data, data,
message message
} = await commonApi.authPhoneLogin(detail, this.sessionId) } = await commonApi.authPhoneLogin(obj)
wx.hideLoading() wx.hideLoading()
if (code == '0') this.customerLoginCallBack(data) if (code == '0') this.customerLoginCallBack(data)
else throw message else throw message
} catch (error) { } catch (error) {
console.log(error, '222222')
this.showTips(error || '服务不可用') this.showTips(error || '服务不可用')
setTimeout(() => { setTimeout(() => {
this.onLoad() this.onLoad()
}, 1500) }, 1500)
} }
}, },
/**C端登录回调 */ /**登录回调 */
customerLoginCallBack(data) { customerLoginCallBack(data) {
wx.p.storage.set('sessionId', data?.sessionId)
// 获取积分来源
this.getSource(data)
},
getSource(loginData) {
commonApi.getPointsSourceList({
staffPhone: loginData?.phone
}).then(res => {
let { code, data, message } = res
if (code == 0) {
this.setData({pointsSource: data?.map(val => { return val.channelSource })})
if (data?.length > 1) { // 积分渠道来源大于1 需要选择
this.setData({
showChooseSource: true
})
} else if (data?.length == 1) {
this.setChannelSource(data[0]?.channelSource, loginData)
}
} else {
wx.p.wxApi.showToast(message)
}
})
},
// 设置积分渠道
setChannelSource(source, loginData) {
wx.p.isLogin = true wx.p.isLogin = true
wx.p.storage.set('userInfo', data) wx.p.storage.set('userInfo', {...loginData})
wx.p.storage.set('sessionId', data.sessionId) wx.p.storage.set('channelSource', `${source}`)
// 返回上一页 wx.p.storage.set('sessionId', loginData?.sessionId)
wx.p.router.back(thisPage => { // 查询积分钱包
thisPage && thisPage.setData({ this.getPointsWallet()
userInfo: data },
}) // 获取积分钱包数据
thisPage.onLoginSuccess && thisPage.onLoginSuccess() //登陆成功后页面回调 getPointsWallet() {
let userInfo = wx.p.cache.userInfo.getUserInfo()
commonApi.getPointsWalletData({
phone: userInfo?.phone,
name: userInfo?.nickName,
scoreSource: wx.p.storage.get('channelSource')
}).then(res => {
let { code, data, message } = res
if (code == 0) {
if (data && Object.keys(data)?.length) { // 有数据返回说明已开通钱包
// 调用替换钱包昵称接口
this.replaceNickName(data)
} else {
let channelSource = wx.p.storage.get('channelSource')
// 获取当前积分数量
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource}).then(r => {
if (r?.code == 0) {
this.setData({
showEnableWallet: true,
walletObj: {name: userInfo?.nickName, phone: userInfo?.phone, scoreSource: channelSource, currentScore: r?.data?.currentScore || 0}
})
} else {
wx.p.wxApi.showToast(r.message)
}
})
}
} else {
wx.p.wxApi.showToast(message)
}
}) })
}, },
// 选择积分来源 // 替换积分钱包昵称
pointSourceEvent() { replaceNickName(data) {
let userInfo = wx.p.cache.userInfo.getUserInfo()
commonApi.replaceWalletName({
nickName: data?.name,
phone: data?.phone,
scoreSource: data?.scoreSource
}).then(res => {
let { code, data, message } = res
wx.p.storage.set('userInfo', {...userInfo, nickName: data?.name}) // 更新storage中的nickName
if (code == 0) {
wx.p.router.reLaunch('/pages/tab/index/index')
} else {
wx.p.wxApi.showToast(message)
}
})
},
// 选择积分来源
pointSourceEvent(e) {
wx.p.storage.set('channelSource', `${e.detail}`)
}, },
// 关闭开通积分钱包弹窗 // 关闭开通积分钱包弹窗
closeWallet() { closeWallet() {
this.setData({ showEnableWallet: false }) this.setData({ showEnableWallet: false })
let userInfo = wx.p.cache.userInfo.getUserInfo()
let data = {
name: userInfo?.nickName,
phone: userInfo?.phone,
scoreSource: wx.p.storage.get('channelSource')
}
// 替换钱包昵称 使用登录信息返回的数据
this.replaceNickName(data)
}, },
// 一键开通积分钱包 // 一键开通积分钱包
enableWalletConfirm() { enableWalletConfirm(e) {
let { walletObj } = e.detail
commonApi.openPointsWallet(walletObj).then(res => {
let { code, message } = res
if (code == 0) {
// 替换钱包昵称
this.replaceNickName({...walletObj})
} else {
wx.p.wxApi.showToast(message)
}
})
}, },
// 开通成功 // 开通成功
......
...@@ -66,8 +66,8 @@ ...@@ -66,8 +66,8 @@
</view> </view>
</Dialog> </Dialog>
<!-- 积分来源选择 --> <!-- 积分来源选择 -->
<points-source show="{{showChooseSource}}" bindconfirm="pointSourceEvent"></points-source> <points-source show="{{showChooseSource}}" pointsSource="{{pointsSource}}" bindconfirm="pointSourceEvent"></points-source>
<!-- 开通钱包 --> <!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet> <enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet>
<!-- 钱包开通成功 --> <!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success> <enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,10 @@ Component({ ...@@ -7,6 +7,10 @@ Component({
properties: { properties: {
show: { show: {
type: Boolean type: Boolean
},
walletObj: {
type: Object,
value: {}
} }
}, },
...@@ -43,14 +47,15 @@ Component({ ...@@ -43,14 +47,15 @@ Component({
let { value } = e.detail let { value } = e.detail
value = target == 'phone' ? value.replace(/[^0-9]/g, '') : value value = target == 'phone' ? value.replace(/[^0-9]/g, '') : value
this.setData({ this.setData({
[target]: value [`walletObj.${target}`]: value
}) })
}, },
// 开通 // 开通
confirm() { confirm() {
let { name, phone } = this.data let { walletObj } = this.data
if (!name) return wx.p.wxApi.showToast('姓名不能为空') if (!walletObj?.name) return wx.p.wxApi.showToast('姓名不能为空')
if (!phone || !/^[1]([3-9])[0-9]{9}$/.test(phone)) return wx.p.wxApi.showToast('请输入正确手机号') if (!walletObj?.phone || !/^[1]([3-9])[0-9]{9}$/.test(walletObj?.phone)) return wx.p.wxApi.showToast('请输入正确手机号')
this.triggerEvent('confirm', {walletObj})
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
<view class="label">{{item.label}}</view> <view class="label">{{item.label}}</view>
<view class="tips"> <view class="tips">
{{item.tips}} {{item.tips}}
<text class="label" wx:if="{{item.pointsFlag}}">{{1500}}</text> <text class="label" wx:if="{{item.pointsFlag}}">{{walletObj.currentScore}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="text">请确认信息无误</view> <view class="text">请确认信息无误</view>
<view class="input-box"> <view class="input-box">
<view class="input-label">姓名</view> <view class="input-label">姓名</view>
<input bindinput="input" data-target="name" maxlength="10" value="{{name}}" type="text" placeholder="请输入"/> <input bindinput="input" data-target="name" maxlength="10" value="{{walletObj.name}}" type="text" placeholder="请输入"/>
</view> </view>
<view class="input-box"> <view class="input-box">
<view class="input-label">手机号</view> <view class="input-label">手机号</view>
<input bindinput="input" data-target="phone" maxlength="11" value="{{phone}}" type="text" placeholder="请输入"/> <input bindinput="input" data-target="phone" maxlength="11" value="{{walletObj.phone}}" type="text" placeholder="请输入"/>
</view> </view>
<view class="wallet-btn" bindtap="confirm">一键开通</view> <view class="wallet-btn" bindtap="confirm">一键开通</view>
</view> </view>
......
...@@ -7,6 +7,16 @@ Component({ ...@@ -7,6 +7,16 @@ Component({
properties: { properties: {
show: { show: {
type: Boolean type: Boolean
},
pointsSource: {
type: Array,
observer: function(val) {
let { sourceArr } = this.data
const filteredArr = sourceArr.filter(item => val?.includes(Number(item.id)))
this.setData({
channelSourceArr: filteredArr
})
}
} }
}, },
...@@ -14,25 +24,26 @@ Component({ ...@@ -14,25 +24,26 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
sourceArr: [{ sourceArr: [ {
id: 1, id: 1,
label: '续保用户',
color: '#AF531F',
background: 'linear-gradient(90deg, #FCF5E5 0%, #FFE9BD 100%)',
icon: 'source-1'
}, {
id: 2,
label: '阳光激励用户', label: '阳光激励用户',
color: '#C7462B', color: '#C7462B',
background: 'linear-gradient(90deg, #FCF3F2 0%, #FFE0DB 100%)', background: 'linear-gradient(90deg, #FCF3F2 0%, #FFE0DB 100%)',
icon: 'source-2' icon: 'source-2'
}, { }, {
id: 2,
label: '续保用户',
color: '#AF531F',
background: 'linear-gradient(90deg, #FCF5E5 0%, #FFE9BD 100%)',
icon: 'source-1'
}, {
id: 3, id: 3,
label: '管理层', label: '管理层',
color: '#244BCA', color: '#244BCA',
background: 'linear-gradient(90deg, #E7F5FD 0%, #C3E7FF 100%)', background: 'linear-gradient(90deg, #E7F5FD 0%, #C3E7FF 100%)',
icon: 'source-3' icon: 'source-3'
}] }],
channelSourceArr: []
}, },
/** /**
...@@ -42,21 +53,22 @@ Component({ ...@@ -42,21 +53,22 @@ Component({
// 切换选择来源 // 切换选择来源
checkSource(e) { checkSource(e) {
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
let { sourceArr } = this.data let { channelSourceArr } = this.data
sourceArr?.forEach(val => { channelSourceArr?.forEach(val => {
val.isChecked = false val.isChecked = false
if (val.id == target.id) { if (val.id == target.id) {
val.isChecked = true val.isChecked = true
} }
}) })
this.setData({sourceArr}) this.setData({channelSourceArr})
}, },
// 下一步 // 下一步
nextStep(e) { nextStep(e) {
let { target } = e.currentTarget.dataset let { target } = e.currentTarget.dataset
if (target) return // 未选择来源不可点击 if (target) return // 未选择来源不可点击
// 请求接口 let { channelSourceArr } = this.data
console.log('请求接口') let channelSource = channelSourceArr?.find(val => val.isChecked == true)?.id
this.triggerEvent('confirm', channelSource)
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="source-content isFullSucreen {{close?'close':''}}"> <view class="source-content isFullSucreen {{close?'close':''}}">
<view class="title">您的积分渠道来源</view> <view class="title">您的积分渠道来源</view>
<view class="source-box"> <view class="source-box">
<view class="source-item" wx:for="{{sourceArr}}" wx:key="index" bindtap="checkSource" data-target="{{item}}" style="color: {{item.color}};background-image: {{item.background}};"> <view class="source-item" wx:for="{{channelSourceArr}}" wx:key="index" bindtap="checkSource" data-target="{{item}}" style="color: {{item.color}};background-image: {{item.background}};">
<view> <view>
<view class="source-icon"> <view class="source-icon">
<glsx-image src="/login/{{item.icon}}.png"></glsx-image> <glsx-image src="/login/{{item.icon}}.png"></glsx-image>
...@@ -28,6 +28,6 @@ ...@@ -28,6 +28,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="btn {{fn.btnDisabled(sourceArr) ? 'disabled' : ''}}" bindtap="nextStep" data-target="{{fn.btnDisabled(sourceArr)}}">下一步</view> <view class="btn {{fn.btnDisabled(channelSourceArr) ? 'disabled' : ''}}" bindtap="nextStep" data-target="{{fn.btnDisabled(channelSourceArr)}}">下一步</view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
// pages/loading/loading.js // pages/loading/loading.js
import { systemApi } from "~/api/index"; import { systemApi } from "~/api/index";
import commonApi from '~/api/module/common.js'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -24,23 +25,16 @@ Page({ ...@@ -24,23 +25,16 @@ Page({
this.login(); this.login();
}, },
async login(options = {}) { async login(options = {}) {
if (options.merchantId) wx.$merchant_id = options.merchantId;
try { try {
const { code, data, message } = await wx.p.api.userApi.login(); const { code, data, message } = await commonApi.getLoginInfo();
if (data)
wx.p.storage.set("merchant_info", {
merchantId: data.merchantId,
merchantName: data.merchantName,
});
if (code == "0") { if (code == "0") {
wx.p.isLogin = true; wx.p.isLogin = true;
wx.p.storage.set("userInfo", data); wx.p.storage.set("userInfo", data)
wx.p.storage.set("sessionId", data.sessionId); if (!data) throw message
if (!data) throw message;
} else { } else {
wx.p.isLogin = false; wx.p.isLogin = false;
wx.p.storage.rm("userInfo"); wx.p.storage.rm("userInfo");
wx.p.storage.rm("sessionId"); wx.p.storage.rm("channelSource")
} }
console.log("登陆信息:", data); console.log("登陆信息:", data);
if (options.url) { if (options.url) {
......
...@@ -27,17 +27,8 @@ ...@@ -27,17 +27,8 @@
background: #FFFFFF; background: #FFFFFF;
} }
.type-1 .button {
width: 104rpx;
height: 60rpx;
border-radius: 38rpx;
background-color: var(--btnColor);
color: #fff;
font-size: var(--margin);
}
.type-1 .input-box { .type-1 .input-box {
width: calc(100% - 110rpx); width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
......
...@@ -42,27 +42,21 @@ Component({ ...@@ -42,27 +42,21 @@ Component({
methods: { methods: {
handleFixedTabChange(e) { handleFixedTabChange(e) {
let { value } = e.currentTarget.dataset let { value } = e.currentTarget.dataset
let { activeSubTab } = this.data
this.setData({ this.setData({
activeTab: value, activeTab: value,
to: `to-${value}` to: `to-${value}`
}) })
this.triggerEvent('tabchange', { activeTab: value, activeSubTab })
}, },
handleDynamicTabChange(e) { handleDynamicTabChange(e) {
let { value } = e.currentTarget.dataset let { value } = e.currentTarget.dataset
let { activeTab } = this.data
this.setData({ this.setData({
activeSubTab: value, activeSubTab: value,
subTo: `to-${value}` subTo: `to-${value}`
}) })
}, this.triggerEvent('tabchange', { activeTab, activeSubTab: value })
click(e) {
let {
count
} = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`
})
this.triggerEvent('click', count)
} }
} }
}) })
......
import { import homeApi from '~/api/module/home.js'
kfMixin, import commonApi from '~/api/module/common.js'
} from '~/mixins/index'
Page({ Page({
behaviors: [kfMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
...@@ -12,6 +10,7 @@ Page({ ...@@ -12,6 +10,7 @@ Page({
customerlist: [], customerlist: [],
navStyle : "background-color: transparent;", navStyle : "background-color: transparent;",
animationData: {}, animationData: {},
bannerUrl: '',
specialSaleArr: [{ specialSaleArr: [{
id: 1, id: 1,
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png', url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png',
...@@ -129,6 +128,24 @@ Page({ ...@@ -129,6 +128,24 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
const userInfo = wx.p.cache.userInfo.getUserInfo()
let channelSource = wx.p.storage.get('channelSource')
this.setData({userInfo, channelSource})
// 获取当前积分数据
this.getPointsData()
},
getPointsData() {
let { userInfo, channelSource } = this.data
if (!userInfo?.phone && !channelSource) return
commonApi.getPointsSummary({staffPhone: userInfo?.phone, channelSource: Number(channelSource)}).then(r => {
if (r?.code == 0) {
this.setData({
currentScore: r?.data?.currentScore || 0
})
} else {
wx.p.wxApi.showToast(r.message)
}
})
}, },
// 跳转积分中心 // 跳转积分中心
handleToPointCenter() { handleToPointCenter() {
...@@ -152,6 +169,19 @@ Page({ ...@@ -152,6 +169,19 @@ Page({
toIntegral(){ toIntegral(){
wx.p.router.go('/packageIndex/pages/integral/index/index') wx.p.router.go('/packageIndex/pages/integral/index/index')
}, },
// 商品搜素
handleSearch(e) {
console.log(e)
},
// 切换分类筛选
changeTab(e) {
console.log(e, '===')
},
// 加入购物车
handleAddToCart(e) {
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
...@@ -13,8 +13,6 @@ page { ...@@ -13,8 +13,6 @@ page {
.bg { .bg {
width: 100%; width: 100%;
height: 480rpx; height: 480rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png') no-repeat;
background-size: 100% 480rpx;
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
......
<navigation-bar page-title="积分商城" custom navStyle="{{navStyle}}"> <navigation-bar page-title="积分商城" custom navStyle="{{navStyle}}">
<view class="page-title">积分商城</view> <view class="page-title">积分商城</view>
</navigation-bar> </navigation-bar>
<view class="bg"></view> <view class="bg">
<glsx-image src="{{bannerUrl || 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png'}}"></glsx-image>
</view>
<block wx:if="{{navHeight}}"> <block wx:if="{{navHeight}}">
<view class="container-box"> <view class="container-box">
<view class="container" style="height: calc(100vh - {{navHeight}}px);margin-top: {{navHeight}}px;"> <view class="container" style="height: calc(100vh - {{navHeight}}px);margin-top: {{navHeight}}px;">
<view class="points-box"> <view class="points-box">
<view class="points-btn" bindtap="handleToPointCenter"> <view class="points-btn" bindtap="handleToPointCenter">
<view> <view style="display: flex;align-items: center;">
<view class="icon"> <view class="icon">
<glsx-image src="/index/points-icon.png"></glsx-image> <glsx-image src="/index/points-icon.png"></glsx-image>
</view> </view>
<view class="points-num" bind:tap="toIntegral">1680</view> <view class="points-num" bind:tap="toIntegral">{{currentScore || '-'}}</view>
</view> </view>
<view class="arrow-icon"> <view class="arrow-icon">
<mp-icon icon="arrow" color="#F4776D" size="7"></mp-icon> <mp-icon icon="arrow" color="#F4776D" size="7"></mp-icon>
...@@ -41,11 +43,11 @@ ...@@ -41,11 +43,11 @@
<view class="goods-content"> <view class="goods-content">
<view class="goods-box-title">商品兑换</view> <view class="goods-box-title">商品兑换</view>
<view class="sticky"> <view class="sticky">
<search-box placeholder="搜索商品"></search-box> <search-box placeholder="搜索商品" bindsearch="handleSearch"></search-box>
<good-tab tab="{{tab}}" subTab="{{subTab}}" align="left" openScroll bindclick="changeTab" index="{{goodsIndex}}"></good-tab> <good-tab tab="{{tab}}" subTab="{{subTab}}" align="left" openScroll bindtabchange="changeTab" index="{{goodsIndex}}"></good-tab>
</view> </view>
<view class="goods-box"> <view class="goods-box">
<goods list="{{goodsList}}"></goods> <goods list="{{goodsList}}" bindjoin="handleAddToCart"></goods>
</view> </view>
</view> </view>
</block> </block>
...@@ -53,5 +55,4 @@ ...@@ -53,5 +55,4 @@
</view> </view>
</view> </view>
</block> </block>
<glsx-privacy appletName="积分商城"></glsx-privacy> <glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,8 @@ Page({ ...@@ -12,6 +12,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let userInfo = wx.p.storage.get('userInfo')
this.setData({userInfo})
// this.getMemberCardData(); // this.getMemberCardData();
}, },
navbarReady(e) { navbarReady(e) {
......
...@@ -11,7 +11,8 @@ export const STORAGE_OBJECTkEY = { ...@@ -11,7 +11,8 @@ export const STORAGE_OBJECTkEY = {
sessionId: 'sessionId', sessionId: 'sessionId',
bindInfo:'bindInfo', bindInfo:'bindInfo',
unauthorized:'unauthorized', unauthorized:'unauthorized',
wx_user_info:'wx_user_info' wx_user_info:'wx_user_info',
channelSource: 'channelSource'
} }
export default{ export default{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!