Commit 57410bf0 by chenwq

create

1 parent 9e93c071
......@@ -4,8 +4,7 @@
"pages/tab/index/index",
"pages/tab/mine/index",
"pages/webView/webView",
"pages/Login/Login",
"pages/chooseMerchant/index"
"pages/Login/Login"
],
"requiredPrivateInfos": [
"getLocation"
......
......@@ -286,7 +286,7 @@ Page({
})
wx.p.router.reLaunch('/pages/tab/index/index', {loginPageFlag: true})
} else { // 跳转到选择门店页面
wx.p.router.go('/pages/chooseMerchant/index', {loginData: {channelSource: source, ...loginData}, merchantList: data, loginPageFlag: true})
// wx.p.router.go('/pages/chooseMerchant/index', {loginData: {channelSource: source, ...loginData}, merchantList: data, loginPageFlag: true})
}
} else {
wx.p.wxApi.showToast(message)
......
// pages/chooseMerchant/index.js
import commonApi from '~/api/module/common.js'
import {
systemApi
} from '~/api/index'
Page({
/**
* 页面的初始数据
*/
data: {
flag: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
this.setData({
paramsData: params
})
}).catch(err => {
console.error('参数获取失败:', err)
})
},
// 跳转隐私政策页面
async handleAgree(e) {
const {
name
} = e.currentTarget.dataset
let v = await systemApi.getImageVersion()
wx.p.router.jumpH5(`https://img01.glsx.com.cn/weapp/resource/miniprogram/points-mall/html/${name}.html?v=${v}`, true)
},
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
if (!paramsData.loginData?.phone || !paramsData.loginData?.channelSource) {
wx.p.sentry.reportParamError(
'门店选择异常:phone, channelSource',
{phone: paramsData.loginData?.phone, channelSource: paramsData.loginData?.channelSource}
)
}
wx.p.storage.set('userInfo', { ...paramsData.loginData, merchantId: obj?.merchantId, merchantName: obj?.merchantName })
wx.p.router.reLaunch('/pages/tab/index/index', {loginPageFlag: paramsData?.loginPageFlag})
},
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 */
page{
background: #F7F8FA;
}
@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-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 46rpx;
.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
......@@ -94,28 +94,28 @@ Page({
wx.p.router.go(url);
},
// 切换门店
changeMerchant() {
// 获取门店接口 门店数量大于1跳转切换,否则不需切换
let { userInfo } = this.data;
commonApi
.getMerchantData({
staffPhone: userInfo?.phone,
channelSource: userInfo?.channelSource,
})
.then((res) => {
let { code, data, message } = res;
if (code == 0) {
if (data?.length > 1) {
wx.p.router.go("/pages/chooseMerchant/index", {
loginData: userInfo,
merchantList: data,
});
}
} else {
wx.p.wxApi.showToast(message);
}
});
},
// changeMerchant() {
// // 获取门店接口 门店数量大于1跳转切换,否则不需切换
// let { userInfo } = this.data;
// commonApi
// .getMerchantData({
// staffPhone: userInfo?.phone,
// channelSource: userInfo?.channelSource,
// })
// .then((res) => {
// let { code, data, message } = res;
// if (code == 0) {
// if (data?.length > 1) {
// wx.p.router.go("/pages/chooseMerchant/index", {
// loginData: userInfo,
// merchantList: data,
// });
// }
// } else {
// wx.p.wxApi.showToast(message);
// }
// });
// },
onShow:function() {
this.searchScoreSummaryData();
// this.getOrderNumberList();
......
......@@ -26,12 +26,12 @@
</view>
</view>
<view class="phone">{{username}}{{userInfo.phone}}</view>
<view class="merchant_box" bindtap="changeMerchant" wx:if="{{userInfo.merchantId != -1}}">
<!-- <view class="merchant_box" bindtap="changeMerchant" wx:if="{{userInfo.merchantId != -1}}">
<view class="name">{{userInfo.merchantName}}</view>
<view class="change_icon">
<glsx-image src="/mine/change.png"></glsx-image>
</view>
</view>
</view> -->
</block>
<block wx:else>
点击登录
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!