优惠卷和商品卷

This commit is contained in:
wwz
2025-03-10 16:33:43 +08:00
parent 70edc6756d
commit 5342133cbd
30 changed files with 2820 additions and 3338 deletions

View File

@@ -17,9 +17,9 @@
<view class="containertopbox">
<view class="containertopboxitem flex-start" v-for="(item,index) in fromInfo.list" :key="index">
<view class="containertopboxitemleft flex-colum"
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': fromInfo.status != 1,}">
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': fromInfo.status == 0}">
<view class="containertopboxitemleft_one"
:class="fromInfo.status == 1?'':'containertopboxitemleft_ones'">
:class="fromInfo.status != 0?'':'containertopboxitemleft_ones'">
<block v-if="item.type == 2">
<text>{{item.num || 0}}</text>
<text style="font-size: 28rpx;margin-left: 6rpx;"></text>
@@ -31,7 +31,7 @@
</view>
<view class="containertopboxitemleft_tow" :class="{
'containertopboxitemleft_tows': fromInfo.status != 1,
'containertopboxitemleft_tows': fromInfo.status == 0,
'containertopboxitemleft_nameVip': item.type == 2,
}">
{{ item.type == 2 ? item.name : '优惠券(元)'}}
@@ -51,8 +51,8 @@
<view class="containertopboxitemright_tow">
<view> {{ item.type == 2 ? '会员商品券' : item.name}}</view>
<view @click="navigatorGo(item)"
:class="fromInfo.status == 1?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{fromInfo.status == 1 ? '去使用':'已使用'}}
:class="fromInfo.status == 0?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{fromInfo.status == 0 ? '去使用':'已使用'}}
</view>
</view>
<view class="containertopboxitemright_there" v-if="item.type == 1 ">
@@ -66,12 +66,9 @@
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<up-loadmore :status="form.status" iconSize='12' fontSize='12' height='20' />
<up-loadmore :status="form.status" fontSize="14" color="#999" iconSize="14" />
</view>
</view>
<!-- <view class="btnBox" >
<view class="btn" @click="cancelCoupon">暂不使用券</view>
</view> -->
</view>
</template>
@@ -79,10 +76,18 @@
import {
ref,
reactive,
onMounted
onMounted,
} from 'vue';
import {
APIcouponfindByUserId
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom
} from '@dcloudio/uni-app'
import {
APIcouponfindByUserId,
APIfindCoupon
} from '@/common/api/member.js'
const tabList = [{
@@ -101,8 +106,7 @@
const fromInfo = reactive({
tabIndex: 0,
list: [],
status: 1,
payAmount: 0,
status: 0,
shopId: null,
orderId: null,
couopnInfo: null,
@@ -115,6 +119,25 @@
status: 'loadmore',
})
// 判断是选择优惠卷
const Orderinfo = reactive({
typeOrder: '',
shopUserId: "",
payAmount: "",
shoppingCart: [],
show: false
})
// 初始化
const init_fn = () => {
fromInfo.list = []
form.page = 1
form.size = 10
form.status = 'loadmore'
// navtabindex.value == '1' ? getorderList() : userorderList()
getCouponList()
}
const towcontentclick = (item) => {
fromInfo.tabIndex = item.status;
fromInfo.status = item.status;
@@ -123,9 +146,7 @@
}
// 去使用优惠券
const navigatorGo = (item) => {
}
const navigatorGo = (item) => {}
const getCouponList = async () => {
let res = await APIcouponfindByUserId({
@@ -140,7 +161,7 @@
fromInfo.list = []
return false
}
if (res.totalPage == 1 && res.totalRow <= 10) {
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
form.status = 'nomore'
fromInfo.list = res.records
if (form.page == 1 && res.records.length == 0) {
@@ -149,7 +170,11 @@
return false;
} else {
form.status = 'loading';
fromInfo.list = [...fromInfo.list, ...res.records];
if (form.page == 1) {
fromInfo.list = res.records
} else {
fromInfo.list = [...fromInfo.list, ...res.records];
}
form.page = ++form.page;
if (form.page > res.totalPage) {
form.status = 'nomore';
@@ -157,12 +182,16 @@
form.status = 'loading';
}
}
console.log(fromInfo.list)
}
const cancelCoupon = () => {
uni.navigateBack();
}
onReachBottom(() => {
if (form.status != 'nomore') {
getCouponList()
}
})
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
@@ -174,9 +203,6 @@
if (options.shopId) {
fromInfo.shopId = options.shopId
}
if (options.payAmount) {
fromInfo.payAmount = options.payAmount
}
// if (options.orderId) {
// fromInfo.orderId = options.orderId
// }
@@ -189,7 +215,7 @@
// if (options.productList) {
// this.productList = JSON.parse(decodeURIComponent(options.productList))
// }
getCouponList()
init_fn()
})
</script>

View File

@@ -4,92 +4,120 @@
<view class="bild">
<view class="bildLeft">
<text>我的余额</text>
<view>{{info.amount||0}}</view>
<view>{{formData.info.amount||0}}</view>
</view>
<view class="bildRight">
<text>我的积分</text>
<view>{{info.accountPoints||0}}</view>
<view>{{formData.info.accountPoints||0}}</view>
</view>
</view>
<view class="navTop">
<view @click="clickEvent(1)" :class="[active==1?'fonts':'']">
<view @click="clickEvent(1)" :class="[formData.active==1?'fonts':'']">
余额明细
<view :class="[active==1?'xian':'']" style="left: 36rpx;"> </view>
<view :class="[formData.active==1?'xian':'']" style="left: 36rpx;"> </view>
</view>
<view @click="clickEvent(2)" :class="[active==2?'fonts':'']">
<view @click="clickEvent(2)" :class="[formData.active==2?'fonts':'']">
积分明细
<view :class="[active==2?'xian':'']" style="left: 36rpx;"> </view>
<view :class="[formData.active==2?'xian':'']" style="left: 36rpx;"> </view>
</view>
</view>
<view class="listStyle " v-for="(item,i) in list" :key="i">
<view class="listStyle " v-for="(item,i) in formData.list" :key="i">
<!-- <image class="head_img" :src="item.head_img?item.head_img:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" style="width: 76rpx;height: 76rpx;float: left;" mode=""></image> -->
<view class="flex-start">
<view class="listStyle_left">
<view class="listrigth">
<view>{{active == 1 ? item.biz_name : item.content}}</view>
<view>{{formData.active == 1 ? item.biz_name : item.content}}</view>
<view
:class="{colorStyle: (active==1&&item.type == '+') || (active==2&&item.floatType=='add')}">
{{ active == 1 ? item.type : (item.floatType == 'add'?'+':'')}}
{{active == 1 ? item.amount : item.floatPoints}}
:class="{colorStyle: (formData.active==1&&item.type == '+') || (formData.active==2&&item.floatType=='add')}">
{{ formData.active == 1 ? item.type : (item.floatType == 'add'?'+':'')}}
{{formData.active == 1 ? item.amount : item.floatPoints}}
</view>
</view>
</view>
<view class="listrigth2">
<view>{{$u.timeFormat(active == 1 ? item.create_time : item.createTime, 'yyyy-mm-dd hh:MM:ss')}}
<view>{{item.createTime}}
</view>
<view v-if="active == 1">余额:{{item.balance}}</view>
<view v-if="formData.active == 1">余额:{{item.balance}}</view>
</view>
</view>
</view>
<view v-if="formData.list.length <= 0" style="text-align: center;">
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<up-loadmore :status="formData.form.status" fontSize="14" color="#999" iconSize="14" />
</view>
</template>
<script setup>
import {
ref,
reactive
reactive,
onMounted
} from 'vue'
import {
onReachBottom
} from '@dcloudio/uni-app'
import {
APIshopUsermoneyRecord,
APIshopUserpointsRecord
} from '@/common/api/member.js'
const formData = reactive({
active: 1,
list: [],
form: {
page: 1,
pageSize: 10,
size: 10,
status: 'loadmore',
},
info: {
amount: '',
accountPoints: ''
},
info: null,
shopId: null
})
const getlist = () => {
return false;
// if (this.active == 1) {
// let res = await this.api.queryMemberAccount({
// ...this.form
// })
// if (res.code == 0 && res.data.list.length > 0) {
// this.list = this.list.concat(res.data.list)
// this.form.page++
// }
// } else {
// let res = await this.api.queryMemberPointsLog({
// shopId: formData.info.shopId,
// ...this.form
// })
// if (res.code == 0 && res.data.list.length > 0) {
// this.list = this.list.concat(res.data.list)
// this.form.page++
// }
// }
const getlist = async () => {
let res = null
if (formData.active == 1) {
res = await APIshopUsermoneyRecord({
page: formData.form.page,
size: formData.form.size,
status: formData.status,
shopId: formData.shopId
})
} else {
res = await APIshopUserpointsRecord({
page: formData.form.page,
size: formData.form.size,
status: formData.status
})
}
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
formData.form.status = 'nomore'
formData.list = res.records
if (formData.form.page == 1 && res.records.length == 0) {
formData.records = []
formData.is_end = true
}
return false;
} else {
formData.form.status = 'loading';
if (formData.form.page == 1) {
formData.list = res.records
} else {
formData.list = [...formData.list, ...res.records];
}
formData.form.page = ++formData.form.page;
if (formData.form.page > res.totalPage) {
formData.form.status = 'nomore';
} else {
formData.form.status = 'loading';
}
}
}
// 检测是否包含In
@@ -101,7 +129,10 @@
const clickEvent = (i) => {
formData.active = i;
formData.form.page = 1;
formData.list = []
formData.is_end = false
formData.form.page = 1
formData.form.size = 10
formData.form.status = 'loadmore'
getlist()
}
@@ -116,7 +147,9 @@
const currentPage = pages[pages.length - 1];
// 获取页面参数
const options = currentPage.options;
formData.info = JSON.parse(options.shopUserInfo)
formData.info = JSON.parse(decodeURIComponent(options.shopInfo))
formData.shopId = options.shopId
formData.active = options.type
console.log(formData.info)
getlist()
})

View File

@@ -46,14 +46,15 @@
</view>
<view class="reg-cell">
<view class="lable">手机号</view>
<u-input class="value" v-model="formInfo.telephone" fontSize="14px" type="text" input-align="left"
<up-input class="value" v-model="formInfo.telephone" fontSize="14px" type="text" input-align="left"
readonly placeholder="获取手机号" :custom-style="{border:'none'}"
placeholder-style="color:#999;font-size: 28rpx" />
<!-- #ifdef MP-WEIXIN || H5 -->
<button class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<button class="getPhone" size="10" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="getPhone" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone">
<button class="getPhone" size="10" open-type="getAuthorize" scope='phoneNumber'
@getAuthorize="getPhone">
<!-- #endif -->
<view class="text">{{'获取手机号'}}</view>
</button>
@@ -63,7 +64,7 @@
<view class="agreement_item" @click="isProtocol = !isProtocol">
<up-checkbox-group>
<up-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F"
@change="radioChange" size="35" iconSize="20"></up-checkbox>
@change="radioChange" size="15" iconSize="10"></up-checkbox>
</up-checkbox-group>
<text @click.stop="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text>
</view>
@@ -87,6 +88,11 @@
ref
} from 'vue';
import {
APIshopUser
} from '@/common/api/member.js'
const props = defineProps({
shopUserInfo: {
type: Object,
@@ -241,13 +247,14 @@
uni.login({
provider: 'weixin',
success: async (data) => {
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
source: "wechar"
})
this.telephone = res.data
console.log(data)
// let res = await APIshopUser({
// code: data.code,
// encryptedData: d.detail.encryptedData,
// iv: d.detail.iv,
// source: "wechar"
// })
formInfo.telephone = res.data
}
})
}
@@ -418,8 +425,8 @@
background-color: none;
border: 2rpx solid #E3AD7F;
color: #E3AD7F;
font-size: 28rpx;
padding: 5rpx 10rpx;
font-size: 24rpx;
padding: 5rpx 30rpx;
// #ifdef MP-ALIPAY
padding-top: 0;
display: initial;

View File

@@ -59,12 +59,12 @@
</view>
<view class="gift" v-if="infoForn.giftList && infoForn.giftList.length > 0">
<view class="gift" v-if="infoForn.couponList && infoForn.couponList.length > 0">
<view class="gift_title">您将获得</view>
<view class="gift_list">
<view class="gift_list_item" v-for="(item,index) in infoForn.giftList" :key="index">
<view class="gift_list_item" v-for="(item,index) in infoForn.couponList" :key="index">
<text class="icon"></text>
<text class="text"> {{ item }} </text>
<text class="text"> {{ item.title }} </text>
</view>
</view>
</view>
@@ -94,7 +94,7 @@
</view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view>
<registermember :show="infoForn.shopUserInfo.isVip == 1? false : true" :shopUserInfo="infoForn.shopUserInfo">
<registermember :memberOpen="infoForn.show" :shopUserInfo="infoForn.shopUserInfo">
</registermember>
</view>
@@ -122,12 +122,12 @@
const cardManageList = [{
name: "明细",
url: "member/billDetails",
url: "user/member/billDetails",
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"
},
{
name: "管理",
url: "member/storedManage",
url: "user/member/storedManage",
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"
}
]
@@ -141,10 +141,10 @@
giftAmount: 0,
shopUserInfo: {},
shopId: '',
giftList: [],
couponList: [],
type: "",
userInfo: ''
userInfo: '',
show: false
})
@@ -157,7 +157,7 @@
})
try {
infoForn.listdata = res;
infoForn.giftList = infoForn.listdata[0].gives;
infoForn.couponList = infoForn.listdata[0].couponList;
infoForn.giftAmount = infoForn.listdata[0].giftAmount
if (infoForn.type == 'topUpActivity') {
infoForn.amountChange()
@@ -206,7 +206,7 @@
})
} else {
infoForn.inputshow = '';
infoForn.giftList = [];
infoForn.couponList = [];
infoForn.giftAmount = '';
}
@@ -245,9 +245,16 @@
// * 进入明细\管理
const handleClick = (item) => {
uni.navigateTo({
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(infoForn.shopUserInfo)}`
console.log(item)
uni.pro.navigateTo(item.url, {
shopId: infoForn.shopId,
type: item.name == '明细' ? 1 : 2,
shopInfo: JSON.stringify(infoForn.userInfo.shopInfo)
})
// uni.navigateTo({
// url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(infoForn.shopUserInfo)}`
// })
}
// * 是否同意协议
const radioChange = (n) => {
@@ -281,8 +288,9 @@
// 充值金额切换
const clickinput = (a, b) => {
console.log(a, b)
infoForn.inputshow = b;
infoForn.giftList = a.gives;
infoForn.couponList = a.couponList;
infoForn.amount = a.amount;
infoForn.giftAmount = a.giftAmount;
}
@@ -354,8 +362,7 @@
infoForn.userInfo = await APIshopUserInfo({
shopId: options.shopId
})
// shopUserInfo.shopExtend = res.shopExtend.member_bg
infoForn.show == infoForn.userInfo.isVip == 1 ? true : false
}
if (options.type) {

View File

@@ -7,7 +7,8 @@
<view class="list-cell-item" v-for="(item1,index1) in item.list" :key="index1">
<view class="list-cell-item-title"> {{ item1.title }}</view>
<view class="list-cell-item-content">
<view class="list-cell-item-content-text" v-for="(item2,index2) in item1.list" :key="index2">{{item2}}</view>
<view class="list-cell-item-content-text" v-for="(item2,index2) in item1.list"
:key="index2">{{item2}}</view>
</view>
</view>
</view>
@@ -16,110 +17,107 @@
</view>
</template>
<script>
export default {
data() {
return {
userInfo: null,
list: [
{
title: "充值规则",
list: [
{
title: "满赠规则",
list: [
"充300元送150积分+0元券",
"充500元送40元0积分+0元券",
"充1000元送100元0积分+0元券",
]
},
{
title: "适用门店",
list: [
"适用于1家门店",
]
},
],
},
{
title: "使用规则",
list: [
{
title: "使用须知",
list: [
"按比例",
]
},
{
title: "免密支付",
list: [
"免密支付已开通",
]
},
{
title: "适用商品",
list: [
"全部商品可用",
]
},
],
},
]
}
<script setup>
import {
ref
} from 'vue'
const list = [{
title: "充值规则",
list: [{
title: "满赠规则",
list: [
"充300元送15元0积分+0元券",
"充500元送40元0积分+0元券",
"充1000元送1000积分+0元券",
]
},
{
title: "适用门店",
list: [
"适用于1家门店",
]
},
],
},
onLoad(e) {
this.userInfo = e
{
title: "使用规则",
list: [{
title: "使用须知",
list: [
"按比例",
]
},
{
title: "免密支付",
list: [
"免密支付已开通",
]
},
{
title: "适用商品",
list: [
"全部商品可用",
]
},
],
},
]
methods: {
/**
* 跳转
*/
handleClick ( item ) {
uni.pro.navigateTo(item.url, this.userInfo)
}
}
const userInfo = ref()
const handleClick = (item) => {
// uni.pro.navigateTo(item.url, userInfo.value)
}
</script>
<style lang="less">
page{
<style lang="less">
page {
background-color: #fff;
}
.container{
.container {
padding: 48rpx 20rpx;
.list{
.list {
display: flex;
flex-direction: column;
.list_item{
.list_item {
display: flex;
flex-direction: column;
margin-bottom: 32rpx;
.list_item_title{
margin-bottom: 32rpx;
.list_item_title {
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 32rpx;
}
.list-cell{
.list-cell {
display: flex;
flex-direction: column;
.list-cell-item{
.list-cell-item {
display: flex;
flex-direction: column;
border-bottom: 2rpx solid #E5E5E5;
padding-bottom: 32rpx;
margin-bottom: 32rpx;
.list-cell-item-title{
.list-cell-item-title {
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
.list-cell-item-content{
.list-cell-item-content {
display: flex;
flex-direction: column;
.list-cell-item-content-text{
.list-cell-item-content-text {
font-weight: 400;
font-size: 24rpx;
color: #999999;
@@ -128,7 +126,8 @@
}
}
}
.list_item:last-child .list-cell-item:last-child{
.list_item:last-child .list-cell-item:last-child {
border-bottom: none;
}
}

View File

@@ -35,7 +35,7 @@
<view class="card_bom_item" @click="itemClick(1)">
<text>{{shopUserInfo.shopInfo.amount || '0.00'}}</text><text>储值</text>
</view>
<view class="card_bom_item">
<view class="card_bom_item" @click="itemClick(2)">
<text>{{shopUserInfo.shopInfo.accountPoints || '0'}}</text><text>积分</text>
</view>
<view class="card_bom_item" @click="itemClick(3)">
@@ -88,7 +88,7 @@
</view>
</view>
<registermember :show="shopUserInfo.shopInfo.isVip == 1? false : true" :shopUserInfo="shopUserInfo.shopInfo">
<registermember :memberOpen="form.memberOpen" :shopUserInfo="shopUserInfo.shopInfo">
</registermember>
</view>
@@ -129,19 +129,27 @@
if (type == 1) {
uni.pro.navigateTo('user/member/index', {
shopId: shopUserInfo.shopId,
type: 'index',
type: type
})
} else if (type == 2) {
uni.pro.navigateTo('user/member/billDetails', {
shopId: shopUserInfo.shopId,
type: type,
shopInfo: JSON.stringify(shopUserInfo.shopInfo)
})
} else if (type == 3) {
uni.pro.navigateTo('user/coupon', {
shopId: shopUserInfo.shopId,
shopInfo: shopUserInfo.shopInfo
})
}
}
// * 注册会员卡
const clickEvent = () => {
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(this.shopUserInfo)
uni.pro.navigateTo('user/member/paycode', {
shopId: shopUserInfo.shopId,
shopInfo: JSON.stringify(shopUserInfo.shopInfo)
})
}
@@ -152,34 +160,27 @@
}
onMounted(async () => {
try {
// 获取当前页面栈
const pages = getCurrentPages();
// 检查页面栈是否为空
if (pages.length === 0) {
console.error('未获取到页面栈');
return;
}
// 获取当前页面实例
const currentPage = pages[pages.length - 1];
// 获取页面参数
const pageParams = currentPage.options;
console.log(pageParams, 169)
let res = await APIusershopInfodetail({
shopId: pageParams.shopId
})
// 根据传的shopInfo来返回上面的值
shopUserInfo.shopInfo = await APIshopUserInfo({
shopId: pageParams.shopId
})
shopUserInfo.shopExtend = res.shopExtend.member_bg
shopUserInfo.shopId = pageParams.shopId
} catch (error) {
console.error('获取页面参数时出错:', error);
// 获取当前页面栈
const pages = getCurrentPages();
// 检查页面栈是否为空
if (pages.length === 0) {
console.error('未获取到页面栈');
return;
}
// 获取当前页面实例
const currentPage = pages[pages.length - 1];
// 获取页面参数
const pageParams = currentPage.options;
let res = await APIusershopInfodetail({
shopId: pageParams.shopId
})
// 根据传的shopInfo来返回上面的值
shopUserInfo.shopInfo = await APIshopUserInfo({
shopId: pageParams.shopId
})
shopUserInfo.shopExtend = res.shopExtend.member_bg
shopUserInfo.shopId = pageParams.shopId
form.memberOpen = shopUserInfo.shopInfo.isVip == 1 ? false : true
})
</script>

View File

@@ -0,0 +1,179 @@
<template>
<view class="container">
<view class="header">
<text class="t"></text>
</view>
<view class="code-wrap">
<view class="num-wrap">
<text class="t">账户余额</text>
<text class="num">{{formInfo.shopInfo.amount || '0'}}</text>
</view>
<view class="line-code">
<canvas id="barcodeCanvas" style="width: 300px; height: 100px;"></canvas>
</view>
<view class="ewm-wrap">
<!-- <tki-qrcode show :size="qrcodeSize"></tki-qrcode> -->
<up-qrcode size="200" :val="formInfo.url" background="#fff" foreground="#000"></up-qrcode>
</view>
<view class="name">
<text>使用门店{{formInfo.shopInfo.shopName || '--'}}</text>
</view>
<view class="line"></view>
</view>
</view>
</template>
<script setup>
import {
onMounted,
reactive,
watch,
nextTick
} from 'vue';
import JsBarcode from "jsbarcode";
import {
APIshopUsercode
} from '@/common/api/member.js'
const formInfo = reactive({
shopInfo: '',
url: '',
shopId: ''
})
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
// 获取当前页面实例
const currentPage = pages[pages.length - 1];
// 获取页面参数
const pageParams = currentPage.options;
formInfo.shopInfo = JSON.parse(decodeURIComponent(pageParams.shopInfo))
formInfo.shopId = pageParams.shopId
let res = await APIshopUsercode({
shopId: pageParams.shopId
})
console.log(formInfo.shopInfo)
if (res) {
formInfo.url = res;
nextTick(() => {
const barcodeText = '1234567890';
const query = uni.createSelectorQuery();
query.select('#barcodeCanvas')
.fields({ node: true, size: true })
.exec((res) => {
if (res[0]) {
const canvas = res[0].node;
const ctx = canvas.getContext('2d');
const dpr = uni.getSystemInfoSync().pixelRatio;
canvas.width = res[0].width * dpr;
canvas.height = res[0].height * dpr;
ctx.scale(dpr, dpr);
JsBarcode(canvas, barcodeText, {
width: 2,
height: 100,
displayValue: true,
fontOptions: 'bold',
font: 'monospace',
textAlign: 'center',
textPosition: 'bottom',
textMargin: 2,
fontSize: 20,
background: '#ffffff',
lineColor: '#000000'
});
}
});
});
}
})
</script>
<style>
page {
background-color: #eb6c37;
}
</style>
<style scoped lang="scss">
.container {
padding: 40upx;
}
.header {
display: flex;
padding-bottom: 40upx;
.t {
color: #fff;
font-size: 32upx;
padding-bottom: 20upx;
position: relative;
&::after {
content: '';
width: 100%;
border-bottom: 1upx solid #fff;
position: absolute;
left: 0;
bottom: 0;
}
}
}
.code-wrap {
background-color: #fff;
border-radius: 20upx;
padding: 40upx;
position: relative;
&::before,
&::after {
content: '';
background-color: #eb6c37;
border-radius: 50%;
position: absolute;
top: 42%;
z-index: 2;
}
&::before {}
&::after {}
.num-wrap {
display: flex;
align-items: flex-end;
.num {
font-size: 42upx;
position: relative;
top: 8upx;
}
}
.line-code {
padding: 40upx 0;
display: flex;
justify-content: center;
}
.ewm-wrap {
display: flex;
justify-content: center;
padding: 40upx 0;
}
.line {
width: 100%;
border-bottom: 1px dashed #ececec;
position: absolute;
top: calc(42% + 20upx);
left: 0;
z-index: 1;
}
}
</style>

View File

@@ -3,19 +3,21 @@
<view class="box_box">
<view class="box_item flex-between">
<text class="top_box_one_text">当前账号</text>
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
<button v-if="!mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<input type="number" v-model="form.mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
<button v-if="!form.mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<view class="text">获取手机号</view>
</button>
</view>
<view class="box_item flex-between" style="position:relative;">
<text class="top_box_one_text"></text>
<input type="number" v-model="form.checkCode" placeholder="请输入验证码" style="padding-right: 140rpx;color: #333" />
<input type="number" v-model="form.checkCode" placeholder="请输入验证码"
style="padding-right: 140rpx;color: #333" />
<view class="top_box_one_texts">
<view v-if="showText == true" class="yzm" @click="CodeRegister">{{ Recapture }}</view>
<view v-if="datalist.showText == true" class="yzm" @click="CodeRegister">{{ datalist.Recapture }}
</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; border-radius:16px; padding: 10rpx;">
{{ second }}s重新发送
{{ datalist.second }}s重新发送
</view>
</view>
</view>
@@ -29,178 +31,179 @@
<input type="number" v-model="form.payPassword" placeholder="请再次输入密码" maxlength="6"
:password="!payPasswords" />
</view>
</view>
<view class="flex-colum">
<view class="Box_bottom" :class="(form.checkCode!=''&&form.password!=''&&form.payPassword!='')?'active':''" @click="userInfosavePayPassword">确定</view>
<view class="Box_bottom" :class="(form.checkCode!=''&&form.password!=''&&form.payPassword!='')?'active':''"
@click="userInfosavePayPassword">确定</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isPwd: "",
mobile: "",
form: {
mobile: '',
password: '',
payPassword: '',
checkCode: ''
},
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '获取验证码',
shopUserInfo: null,
};
},
onLoad(e) {
console.log(e)
if ( e.shopUserInfo ) {
this.shopUserInfo = JSON.parse(e.shopUserInfo);
console.log(this.shopUserInfo)
this.isPwd = this.shopUserInfo.isPwd;
this.mobile = this.shopUserInfo.telephone ? ( this.shopUserInfo.telephone.slice(0, 3)+'****'+this.shopUserInfo.telephone.slice(7) ) : '';
this.form.mobile = this.shopUserInfo.telephone;
}
<script setup>
import {
reactive,
onMounted
} from 'vue';
},
methods: {
async CodeRegister() {
const res = await this.api.phoneValidateCode({
// post 手机验证码
phone: this.form.mobile
});
if (res.code == 0) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
/**
* 获取手机号
* @param {Object} d
*/
async getPhone(d) {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.form.mobile = res.data;
this.mobile = this.form.mobile ? ( this.form.mobile.slice(0, 3)+'****'+this.form.mobile.slice(7) ) : '';
let res2 = await this.api.upVipPhont({
id: this.shopUserInfo.id,
telephone: res.data,
})
}
})
}
},
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
},
async userInfosavePayPassword() {
const shopUserInfo = reactive({
shopInfo: "",
shopId: ''
})
if (this.form.mobile.length != 11 && this.isPwd == 0) {
uni.showToast({
title: '手机号必须是11位',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (this.form.payPassword == null || this.form.payPassword == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (this.form.password.length != 6 || this.form.payPassword.length != 6) {
uni.showToast({
title: '密码必须是6位',
icon: 'none'
});
return false;
}
if (this.form.payPassword != this.form.password) {
uni.showToast({
title: '密码和确认密码不一致',
icon: 'none'
});
return false;
}
if (this.form.checkCode == null || this.form.checkCode == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
let res = await this.api.loginresetPwd({
vipId: this.shopUserInfo.id,
pwd: this.form.password,
code: this.form.checkCode
})
const form = reactive({
mobile: '',
password: '',
payPassword: '',
checkCode: ''
})
if (res.code == 0) {
if (uni.cache.get('userInfo').isPwd != 0) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
} else {
uni.showToast({
title: '设置成功',
icon: 'none'
});
}
setTimeout(() => {
// 获取用户信息
this.loginwxuserInfo()
uni.navigateBack();
}, 1000);
}
}
const datalist = reactive({
isPwd: "",
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '获取验证码',
shopUserInfo: null,
})
const CodeRegister = async () => {
const res = await this.api.phoneValidateCode({
// post 手机验证码
phone: form.mobile
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
datalist.showText = false;
datalist.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --datalist.second;
datalist.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
datalist.second = 60;
datalist.showText = true;
}, 60000);
}
};
}
/**
* 获取手机号
* @param {Object} d
*/
const getPhone = async (d) => {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
// form.mobile = res ? (res.slice(0, 3) + '****' + res.slice(7)) : '';
form.mobile = res
}
})
}
}
const loginwxuserInfo = async () => {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
}
const userInfosavePayPassword = async () => {
if (form.mobile.length != 11) {
uni.showToast({
title: '手机号必须是11位',
icon: 'none'
});
return false;
}
if (form.password == null || form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (form.payPassword == null || form.payPassword == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (form.password.length != 6 || form.payPassword.length != 6) {
uni.showToast({
title: '密码必须是6位',
icon: 'none'
});
return false;
}
if (form.payPassword != form.password) {
uni.showToast({
title: '密码和确认密码不一致',
icon: 'none'
});
return false;
}
if (form.checkCode == null || form.checkCode == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
let res = await this.api.loginresetPwd({
vipId: this.shopUserInfo.id,
pwd: this.form.password,
code: this.form.checkCode
})
if (res.code == 0) {
if (datalist.isPwd != 0) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
} else {
uni.showToast({
title: '设置成功',
icon: 'none'
});
}
setTimeout(() => {
// 获取用户信息
this.loginwxuserInfo()
uni.navigateBack();
}, 1000);
}
}
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
// 获取当前页面实例
const currentPage = pages[pages.length - 1];
// 获取页面参数
const options = currentPage.options;
shopUserInfo.shopInfo = JSON.parse(decodeURIComponent(options.shopInfo))
console.log(shopUserInfo)
})
</script>
<style lang="scss">
@@ -226,6 +229,7 @@
.box_item {
border-bottom: 1rpx solid #E5E5E5;
position: relative;
.top_box_one_text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
@@ -247,7 +251,7 @@
position: absolute;
right: 0;
margin: auto;
font-size: 28rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
@@ -262,10 +266,12 @@
}
}
}
.box_item:nth-child(1){
.box_item:nth-child(1) {
border-bottom: none;
border-top: 1rpx solid #E5E5E5;
input{
input {
border-bottom: 1rpx solid #E5E5E5;
color: #333;
}
@@ -289,11 +295,13 @@
color: #ffffff;
text-align: center;
}
.Box_bottom.active{
.Box_bottom.active {
background-color: #E3AD7F;
}
}
.getPhone{
.getPhone {
line-height: initial;
background-color: none;
border: 2rpx solid #E3AD7F;

View File

@@ -3,66 +3,89 @@
<view class="list">
<view class="list_item" @click="handleClick(item)" v-for="(item,index) in list" :key="index">
<view>{{ item.name }}</view>
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
<u-icon name="arrow-right" color="#575B66" size="16"></u-icon>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
shopUserInfo: null,
list: [
{name: "余额明细", url: "member/billDetails"},
{name: "密码设置", url: "member/setPassword"},
{name: "使用须知", url: "member/instructions"},
]
}
<script setup>
import {
ref,
onMounted,
reactive
} from 'vue'
const list = ref([
// {
// name: "余额明细",
// url: "user/member/billDetails"
// },
{
name: "密码设置",
url: "user/member/setPassword"
},
onLoad(e) {
this.shopUserInfo = JSON.parse(e.shopUserInfo)
{
name: "使用须知",
url: "user/member/instructions"
},
methods: {
/**
* 跳转
*/
handleClick ( item ) {
uni.navigateTo({
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(this.shopUserInfo)}`
})
}
}
])
const shopUserInfo = reactive({
shopInfo: "",
shopId: ''
})
// 跳转
const handleClick = (item) => {
uni.pro.navigateTo(item.url, {
shopInfo: JSON.stringify(shopUserInfo.shopInfo)
})
}
//
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
// 获取当前页面实例
const currentPage = pages[pages.length - 1];
// 获取页面参数
const options = currentPage.options;
shopUserInfo.shopId = options.shopId
shopUserInfo.shopInfo = JSON.parse(decodeURIComponent(options.shopInfo))
console.log(shopUserInfo)
})
</script>
<style scoped lang="less">
page{
}
.container{
page {}
.container {
padding: 48rpx 20rpx;
.list{
.list {
display: flex;
flex-direction: column;
background-color: #fff;
border-radius: 24rpx;
padding: 16rpx 24rpx;
.list_item{
.list_item {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #E5E5E5;;
border-bottom: 2rpx solid #E5E5E5;
;
padding: 24rpx 0;
view{
view {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.list_item:last-child{
.list_item:last-child {
border-bottom: none;
}
}

View File

@@ -1,223 +0,0 @@
<template>
<view class="content">
<view v-if="isPwd == 0">
<view class="contenttext flex-center">
{{form.password.length == 6?'请再次确认支付密码':"请设置新密码,用于支付验证"}}
</view>
<view class="contentbox flex-between">
<view class="contentboxitem flex-colum">
{{consumeFee.slice(0,1)}}
</view>
<view class="contentboxitem flex-colum">
{{consumeFee.slice(1,2)}}
</view>
<view class="contentboxitem flex-colum">
{{consumeFee.slice(2,3)}}
</view>
<view class="contentboxitem flex-colum">
{{consumeFee.slice(3,4)}}
</view>
<view class="contentboxitem flex-colum">
{{consumeFee.slice(4,5)}}
</view>
<view class="contentboxitem flex-colum">
{{consumeFee.slice(5,6)}}
</view>
</view>
</view>
<view class="" v-else>
</view>
<cwx-keyboard ref="keyboard" v-if="isPwd == 0" @confirmEvent="confirmEvent"
:money.sync="consumeFee"></cwx-keyboard>
</view>
</template>
<script>
import cwxKeyboard from '@/components/cwx-keyboard/cwx-keyboard';
export default {
components: {
cwxKeyboard
},
data() {
return {
isPwd: uni.cache.get('userInfo').isPwd,
form: {
mobile: uni.cache.get('userInfo').telephone,
password: '', //密码
payPassword: '', //二次密码
checkCode: ''
},
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
consumeFee: '', //第一遍
consumeFees: '', //第二遍
money: ''
};
},
onLoad() {
if (uni.cache.get('userInfo').isPwd != 0) {
uni.setNavigationBarTitle({
title: '忘记支付密码', // 标题文本,必须是字符串
});
}
},
watch: {
consumeFee(newVal, oldVal) {
if (this.form.password.length == 6) {
this.form.payPassword = newVal
if (this.form.payPassword.length == 6) {
this.userInfosavePayPassword()
}
} else {
this.form.password = newVal
if (this.form.password.length == 6) {
this.$refs.keyboard._handleClearKey() //清空
}
}
}
},
methods: {
confirmEvent(e) {
console.log(e)
},
async CodeRegister() {
const res = await this.api.phoneValidateCode({
// post 手机验证码
phone: this.form.mobile
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.getStorageSync('userInfo').id,
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
},
async userInfosavePayPassword() {
if (this.form.mobile.length != 11 && this.isPwd == 0) {
uni.showToast({
title: '手机号必须是11位',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (this.form.payPassword == null || this.form.payPassword == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (this.form.password.length != 6 || this.form.payPassword.length != 6) {
uni.showToast({
title: '密码必须是6位',
icon: 'none'
});
return false;
}
if (this.form.payPassword != this.form.password) {
this.$refs.keyboard._handleClearKey() //清空
this.form.payPassword = ''
this.form.password = ''
uni.showToast({
title: '密码和确认密码不一致',
icon: 'none'
});
return false;
}
if (this.form.checkCode == null || this.form.checkCode == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
let res = await this.api.loginresetPwd({
pwd: this.form.password,
code: this.form.checkCode
})
if (res.code == 0) {
if (uni.cache.get('userInfo').isPwd != 0) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
} else {
uni.showToast({
title: '设置成功',
icon: 'none'
});
}
// 获取用户信息
this.loginwxuserInfo()
setTimeout(() => {
uni.navigateBack();
}, 1000);
} else {
this.$refs.keyboard._handleClearKey() //清空
this.form.payPassword = ''
this.form.password = ''
}
}
}
};
</script>
<style lang="scss">
.content {
height: 100%;
background: #FFFFFF;
.contenttext {
padding: 48rpx 0;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 40rpx;
color: #333333;
}
.contentbox {
margin-top: 48rpx;
padding: 0 56rpx;
.contentboxitem {
width: 88rpx;
height: 88rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #999999;
}
}
}
</style>

View File

@@ -17,7 +17,6 @@
</view>
</view>
<view class="my_item my_assets">
<view class="my_item_title">我的资产</view>
<view class="my_assets_list">
@@ -127,7 +126,6 @@
}
const clickTo = (item, index) => {
console.log(item, index)
let shopId = null;
switch (item.type) {
case 'my_order':