会员相关功能更新
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<view class="card_info_con flex-between">
|
||||
<view class="balance">{{userInfo.amount || '0.00'}}</view>
|
||||
<view class="card_info_con_right flex-end">
|
||||
<view class="card_info_con_right_item flex-colum" v-for="(item,index) in cardManageList" :key="index">
|
||||
<view class="card_info_con_right_item flex-colum" @click="handleClick(item)" v-for="(item,index) in cardManageList" :key="index">
|
||||
<image class="card_info_con_right_item_icon" :src="item.icon" mode="aspectFill"></image>
|
||||
<text class="card_info_con_right_item_text">{{item.name}}</text>
|
||||
</view>
|
||||
@@ -41,6 +41,17 @@
|
||||
|
||||
</viwe>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="gift" v-if="giftList && giftList.length > 0">
|
||||
<view class="gift_title">您将获得:</view>
|
||||
<view class="gift_list">
|
||||
<view class="gift_list_item" v-for="(item,index) in giftList" :key="index">
|
||||
<text class="icon"></text>
|
||||
<text class="text"> {{ item }} </text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="explain">
|
||||
@@ -57,28 +68,40 @@
|
||||
</view>
|
||||
|
||||
<view class="rechargeBox">
|
||||
<view class="agreement">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<text>已同意</text>
|
||||
<text class="agreement_text" @click="Privacy(1)">《用户储值协议》</text>
|
||||
<text class="agreement_text" @click="Privacy(3)">《用户授权协议》</text>
|
||||
</view>
|
||||
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
|
||||
</view>
|
||||
|
||||
<registermember :show="memberOpen" :shopId="shopId" :userInfo="userInfo" @getRegisterMember="getRegisterMember"></registermember>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import registermember from './components/registermember.vue'
|
||||
export default {
|
||||
components: {
|
||||
registermember
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inputshow: 0,
|
||||
memberOpen: false,
|
||||
isProtocol: false,
|
||||
listdata: [],
|
||||
amount: '',
|
||||
userInfo: {},
|
||||
shopId: '',
|
||||
|
||||
giftList: [],
|
||||
cardManageList: [
|
||||
{name: "明细",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"},
|
||||
{name: "管理",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"}
|
||||
{name: "明细", url: "member/billDetails",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"},
|
||||
{name: "管理", url: "member/storedManage",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"}
|
||||
],
|
||||
|
||||
}
|
||||
@@ -104,9 +127,9 @@
|
||||
console.log(this.shopId)
|
||||
},
|
||||
methods: {
|
||||
|
||||
openLocation () {
|
||||
},
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async init() {
|
||||
let res = await this.api.shopUserInfo({
|
||||
"shopId": this.shopId,
|
||||
@@ -122,50 +145,98 @@
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
},
|
||||
memberCancel () {
|
||||
let pages = getCurrentPages()
|
||||
if ( pages.length > 1) {
|
||||
uni.navigateBack()
|
||||
|
||||
/**
|
||||
* 获取充值金额列表
|
||||
*/
|
||||
async paygetActive() {
|
||||
let res = await this.api.paygetActive({
|
||||
shopId: this.shopId,
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
try {
|
||||
this.listdata = res.data.list;
|
||||
this.giftList = this.listdata[0].giftList;
|
||||
this.amount = res.data.list[0].minNum
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 进入明细\管理
|
||||
* @param {Object} e
|
||||
*/
|
||||
handleClick (item) {
|
||||
uni.pro.navigateTo(item.url, this.userInfo)
|
||||
},
|
||||
|
||||
async Privacy(e) {
|
||||
if (e == 1) {
|
||||
//用户协议
|
||||
let res = await this.api.agreementgetAgreementOne({
|
||||
discern: 0
|
||||
});
|
||||
uni.pro.navigateTo('my/about/agreement', {
|
||||
discern: 0,
|
||||
list: res.data.content
|
||||
});
|
||||
} else {
|
||||
uni.exitMiniProgram({
|
||||
success: function () {
|
||||
console.log('退出成功');
|
||||
},
|
||||
fail: function () {
|
||||
console.log('退出失败');
|
||||
}
|
||||
let res3 = await this.api.agreementgetAgreementOne({
|
||||
discern: 3
|
||||
});
|
||||
uni.pro.navigateTo('my/about/agreement', {
|
||||
discern: 3,
|
||||
list: res3.data.content
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否同意协议
|
||||
* @param {Object} n
|
||||
*/
|
||||
radioChange(n) {
|
||||
this.isProtocol = n;
|
||||
},
|
||||
|
||||
/**
|
||||
* 注册会员卡
|
||||
* @param {Object} e
|
||||
*/
|
||||
getRegisterMember (e) {
|
||||
this.memberOpen = e;
|
||||
this.paygetShopByMember()
|
||||
this.paygetActive()
|
||||
},
|
||||
|
||||
/**
|
||||
* 拉起地图
|
||||
*/
|
||||
openLocation () {
|
||||
|
||||
uni.openLocation({
|
||||
latitude: Number(this.userInfo.lat), // 目的地的纬度,浮点数,范围为-90~90
|
||||
longitude: Number(this.userInfo.lng), // 目的地的经度,浮点数,范围为-180~180
|
||||
scale: 18, // 缩放比例,范围5~18
|
||||
name: this.userInfo.shopName, // 位置名
|
||||
address: this.userInfo.address, // 地址的详细说明
|
||||
success() {
|
||||
console.log('导航启动成功');
|
||||
},
|
||||
fail(error) {
|
||||
console.log('导航启动失败', error);
|
||||
}
|
||||
});
|
||||
},
|
||||
sumbit(d) {
|
||||
if (d.detail.iv) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
let res = await this.api.userwxlogins({
|
||||
code: data.code,
|
||||
encryptedData: d.detail.encryptedData,
|
||||
iv: d.detail.iv,
|
||||
shopId: this.shopId
|
||||
})
|
||||
if (res.code == 0) {
|
||||
let resdata = await this.api.loginwxuserInfo({
|
||||
userId: uni.cache.get('userInfo').id
|
||||
})
|
||||
if (resdata.code == 0) {
|
||||
uni.cache.set('userInfo', resdata .data);
|
||||
this.memberOpen = false
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 解析地址传参
|
||||
* @param {Object} url
|
||||
* @param {Object} name
|
||||
*/
|
||||
getQueryString(url, name) { //解码
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
var r = url.substr(1).match(reg)
|
||||
@@ -174,6 +245,11 @@
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取门店会员信息
|
||||
* @param {Object} w
|
||||
*/
|
||||
async paygetShopByMember(w) {
|
||||
let res = await this.api.paygetShopByMember({
|
||||
page: 1,
|
||||
@@ -183,20 +259,24 @@
|
||||
})
|
||||
this.userInfo = res.data.list[0]
|
||||
},
|
||||
async paygetActive() {
|
||||
let res = await this.api.paygetActive({
|
||||
shopId: this.shopId,
|
||||
page: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
try {
|
||||
this.listdata = res.data.list
|
||||
this.amount = res.data.list[0].minNum
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 充值金额切换
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
*/
|
||||
clickinput(a, b) {
|
||||
console.log(a, b)
|
||||
this.inputshow = b;
|
||||
this.amount = a.minNum;
|
||||
this.giftList = a.giftList;
|
||||
},
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
async userbalancerechangesub() {
|
||||
if (this.amount == null || this.amount == '') {
|
||||
uni.showToast({
|
||||
@@ -257,11 +337,8 @@
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
clickinput(a, b) {
|
||||
console.log(a, b)
|
||||
this.inputshow = b
|
||||
this.amount = a.minNum
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -386,13 +463,13 @@
|
||||
justify-content: center;
|
||||
text:nth-child(1){
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
color: #C14D3A;
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
}
|
||||
text:nth-child(2){
|
||||
font-weight: 400;
|
||||
font-size: 20rpx;
|
||||
color: #F7664E;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,6 +503,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
.gift{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 22rpx;
|
||||
margin-bottom: 48rpx;
|
||||
.gift_title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.gift_list{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.gift_list_item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon{
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #F7853D;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.text{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.explain{
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
@@ -471,6 +581,18 @@
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
.agreement{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
text{
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.agreement_text{
|
||||
color: #E3AD7F;
|
||||
}
|
||||
}
|
||||
.recharge {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
|
||||
Reference in New Issue
Block a user