Enzo 4 years ago
parent
commit
77e7029991
  1. 18
      components/lf-payPassword/lf-payPassword.vue
  2. 7
      pages.json
  3. 4
      pages/recharge/balance/balance.vue
  4. 6
      pages/shop/search.vue
  5. 158
      pages/shop/searchList.vue
  6. 7
      pages/user/agreement/agreement.vue
  7. 168
      pages/user/my/newPhone.vue
  8. 91
      pages/user/my/setPassword.vue
  9. 54
      pages/user/my/verificationPhone.vue
  10. 48
      pages/user/my/vipinfo.vue

18
components/lf-payPassword/lf-payPassword.vue

@ -1,11 +1,11 @@
<template>
<view class="page">
<view class="content">
<view class="title">请设置6位支付密码</view>
<view class="title">{{ title }}</view>
<view class="password">
<lf-jp-coded :width="686" @inputVal="inputVal"></lf-jp-coded>
</view>
<view class="lf-flex lf-m-t-45 lf-row-center">
<view class="lf-flex lf-m-t-45 lf-row-center" v-if="showCountdown">
<view class="lf-font-24 lf-m-r-10" style="color:#FF9D9D">
剩余支付时间
</view>
@ -33,9 +33,19 @@
lfJpCoded,
countdownTimer
},
props: {
title: {
type: String,
default: '请输入支付密码'
},
showCountdown: {
type: Boolean,
default: false
}
},
data(){
return {
code: '',
code: '', //
time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 14:10:00').getTime()
}
},
@ -44,7 +54,7 @@
},
methods: {
dateFinish(){
console.log("倒计时结束");
this.$emit('dateFinish');
},
inputVal(event){
this.code = event;

7
pages.json

@ -238,6 +238,13 @@
"navigationStyle": "custom"
}
},
{
"path" : "pages/user/my/newPhone",
"style" : {
"navigationBarTitleText": "设置新手机号",
"navigationStyle": "custom"
}
},
{
"path" : "pages/user/my/setPassword",
"style" : {

4
pages/recharge/balance/balance.vue

@ -28,12 +28,12 @@
<view class="lf-row-between">
<view class="lf-font-36 lf-color-black lf-font-bold"
:class="{'lf-color-price': item.value < 0}"
style="width: 70%;">{{ item.value }}
style="width: 70%;">{{ item.balance }}
</view>
<view class="lf-font-24 lf-color-555">{{ item.note }}</view>
</view>
<view class="lf-row-between lf-m-t-20">
<view class="lf-font-24 lf-color-555">¥{{ item.current_balance }}</view>
<view class="lf-font-24 lf-color-555">¥{{ item.current }}</view>
<view class="lf-font-24 lf-color-777">{{ item.created_at }}</view>
</view>
</view>

6
pages/shop/search.vue

@ -10,8 +10,8 @@
</u-search>
</view>
<view class="content">
<!-- 大家都在搜 -->
<block v-if="hot_list.length">
<!-- 大家都在搜 TODO 暂时不需要做 -->
<!-- <block v-if="hot_list.length">
<view>
<text class="title">大家都在搜</text>
</view>
@ -22,7 +22,7 @@
:key="index">{{ item }}
</view>
</view>
</block>
</block> -->
<!-- 我搜过的 -->
<block v-if="history_list.length">
<view class="lf-row-between">

158
pages/shop/searchList.vue

@ -2,25 +2,34 @@
<view>
<lf-nav title="搜索" :showIcon="true" @changeHeight="e => nav_height = e"></lf-nav>
<view class="head">
<u-search placeholder="请输入商品名或商户名" action-text="取消" v-model="value" @custom="customClick"></u-search>
<u-search placeholder="请输入商品名或商户名"
action-text="取消"
v-model="value"
@custom="customClick"
@search="search">
</u-search>
</view>
<view>
<u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="false" :current="tab_current" @change="tabChange"></u-tabs>
</view>
<swiper :current="tab_current" @change="swiperChange" :style="{height: autoHeight}">
<swiper-item v-for="(tab_item, tab_index) in tab_list" :key="tab_index">
<scroll-view :scroll-y="true" :style="{height: autoHeight}">
<scroll-view :scroll-y="true" :style="{height: autoHeight}" @scrolltolower="scrolltolower">
<view class="scroll-content" v-if="tab_index == 0">
<lf-waterfall :list="goods_list"></lf-waterfall>
<lf-waterfall :list="goods_list" ref="searchWaterfall"></lf-waterfall>
<lf-nocontent src="/static/images/empty.png" v-if="goods_list.length <= 0"></lf-nocontent>
</view>
<view class="scroll-content" v-else>
<view class="shop-box" v-for="(item, index) in 3" :key="index">
<image class="shop-img"></image>
<view class="shop-box"
v-for="(item, index) in brand_list" :key="index"
@click="$url('/pages/shop/shopdetail?id='+ item.id)">
<image class="shop-img" :src="item.logo"></image>
<view class="shop-info">
<view class="lf-line-1">luckin coffee 瑞幸咖啡</view>
<view>餐饮·美食</view>
<view class="lf-line-1">{{ item.name }}</view>
<view>{{ item.category }}</view>
</view>
</view>
<lf-nocontent src="/static/images/empty.png" v-if="brand_list.length <= 0"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
@ -39,54 +48,16 @@
value: '',
tab_current: 0,
tab_list: [{
name: '商品(8)'
name: '商品'
},{
name: '商户(1)'
name: '商户'
}],
scrollH: 0,
nav_height: 0,
goods_list: [
{
id: 10,
original_price: "4111.00",
picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
price: "2412.00",
product_id: 1008,
sale: 0,
title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
},
{
id: 10,
original_price: "4111.00",
picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
price: "2412.00",
product_id: 1008,
sale: 0,
title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
},
{
id: 10,
original_price: "4111.00",
picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
price: "2412.00",
product_id: 1008,
sale: 0,
title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
},
{
id: 10,
original_price: "4111.00",
picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
price: "2412.00",
product_id: 1008,
sale: 0,
title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
}
]
goods_list: [],
brand_list: [],
page: 1,
isPage: true
}
},
computed: {
@ -98,16 +69,101 @@
let info = uni.getSystemInfoSync();
this.scrollH = info.screenHeight;
this.value = options.value || '';
if(options.value){
this.getSearchList(options.value);
}
},
methods: {
//
customClick(){
this.$toBack();
},
//
search(value){
if(!value || !value.trim()) return this.$msg('搜索内容不能为空');
//
this.page = 1;
this.isPage = true;
this.$refs.searchWaterfall[0].clear();
//
let pages = getCurrentPages();
let beforePage = pages[pages.length - 2]; //
if(beforePage){
beforePage.$vm.updateHistory(value).then(() => {
beforePage.$vm.setHistorySearch();
})
this.getSearchList(value);
}else{
this.$msg('页面路径出错,当前搜索值将不被记录搜索历史').then(() => {
this.getSearchList(value);
})
}
},
//
getSearchList(value){
uni.showLoading({
title: '正在搜索中'
})
this.$http.get({
api: 'api/store/list',
data: {
keyword: value,
page: this.page
}
}).then(res => {
if(res.data.code == 200){
let goods = res.data.data.goods;
let brand = res.data.data.brand;
let isPage = this.$isRight(goods.next_page_url);
this.isPage = isPage;
let list = goods.data.map(item => {
return {
id: item.id,
original_price: item.min_market_price,
picture: item.img,
pictures: [item.img],
price: item.min_price,
sale: item.sale_count,
title: item.name
}
})
if(this.page == 1){
this.goods_list = list;
}else{
this.goods_list.push(...list);
}
this.brand_list = brand;
this.tab_list[1].name = `商户(${brand.length})`;
this.tab_list[0].name = `商品(${this.goods_list.length})`;
}else{
this.$msg(res.data.message || '服务器错误,请稍后再试');
}
uni.hideLoading();
}).catch(err => uni.hideLoading());
},
// tab
tabChange(event){
this.tab_current = event;
},
// swiper
swiperChange(event){
this.tab_current = event.detail.current;
},
// scroll
scrolltolower(){
//
if(this.tab_current == 0){
if(this.isPage){
this.page++;
this.getSearchList(this.value);
}else{
this.$msg('没有更多啦~');
}
}else{
this.$msg('没有更多啦~');
}
}
}
}

7
pages/user/agreement/agreement.vue

@ -2,11 +2,11 @@
<view class="agreement_index">
<lf-nav title="关于我们" :showIcon="true"></lf-nav>
<image src="https://picsum.photos/seed/picsum/200/300" class="logo"></image>
<view class="item" @tap="chageAgreement('privite')">
<view class="item" @tap="chageAgreement('privite')" v-if="agreement.privacy_agreement">
<view class="txt">隐私协议</view>
<view class="rigth lf-iconfont icon-xiangyou lf-font-24"></view>
</view>
<view class="item" @tap="chageAgreement('serve')">
<view class="item" @tap="chageAgreement('serve')" v-if="agreement.service_agreement">
<view class="txt">服务协议</view>
<view class="rigth lf-iconfont icon-xiangyou lf-font-24"></view>
</view>
@ -44,7 +44,8 @@
return{
showAgreement:false,
message:'隐私协议',
contents:''
contents:'',
agreement: {}
}
},

168
pages/user/my/newPhone.vue

@ -0,0 +1,168 @@
<template>
<view>
<lf-nav title="设置新手机号" :showIcon="true"></lf-nav>
<view class="content">
<view class="list">
<view class="lf-flex">
<view class="lf-font-28 lf-color-black" style="width: 140rpx;">新手机号</view>
<input class="input" placeholder="请输入新手机号" v-model="phone" maxlength="11" />
</view>
<view class="clear" v-if="phone.length" @click="phone = ''">
<text class="lf-iconfont icon-status-error"></text>
</view>
</view>
<view class="list">
<view class="lf-flex">
<view class="lf-font-28 lf-color-black" style="width: 140rpx;">验证码</view>
<input class="input input-code" placeholder="请输入验证码" maxlength="8" v-model="code" />
</view>
<view class="code" :class="{'active-bg': is_code}" @click="getCode">
<text>{{ is_code ? num +'秒后重新获取' : '获取验证码' }}</text>
</view>
</view>
</view>
<button class="next-btn" hover-class="lf-opacity" @click="submit">立即更换</button>
</view>
</template>
<script>
export default {
data(){
return {
phone: '',
code: '',
is_code: false,
timer: null,
num: 10,
token: ''
}
},
onLoad(){
var token = this.$cookieStorage.get('user_token');
this.token = token;
},
onUnload(){
if(this.timer){
clearInterval(this.timer);
this.timer = null;
}
},
methods: {
getCode(){
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(this.is_code) return;
this.is_code = true;
if(this.timer){
clearInterval(this.timer);
this.timer = null;
}
this.getVerifyCode();
this.timer = setInterval(() => {
this.num--;
if(this.num <= 0){
clearInterval(this.timer);
this.timer = null;
this.num = 10;
this.is_code = false;
}
}, 1000);
},
getVerifyCode(){
this.$http.post({
api: 'api/sms/verify-code',
data: {
mobile: this.phone
},
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: this.token
}
}).then(res => {
console.log("-------", res);
if(res.data.code == 200){
this.$msg(res.data.message, {icon: 'success'});
}
})
},
submit(){
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(!this.code) return this.$msg('请输入验证码');
this.$http.post({
api: 'api/users/update/mobile',
data: {
code: this.code,
mobile: this.phone
},
header: {
Authorization: this.token
}
}).then(res => {
this.$msg('更改手机号成功', {icon: 'success'}).then(() => {
uni.navigateBack({delta: 2}); //
})
})
}
}
}
</script>
<style lang="scss" scoped="scoped">
.content{
padding: 0 32rpx;
}
.next-btn{
width: 550rpx;
height: 100rpx;
background: #15716E;
border-radius: 50rpx;
position: fixed;
bottom: 10vh;
left: calc(50% - 275rpx);
line-height: 100rpx;
color: #FFFFFF;
}
.list{
height: 106rpx;
width: 100%;
border-bottom: 1rpx solid #e5e5e5;
display: flex;
justify-content: space-between;
align-items: center;
&:nth-child(2n){
margin-top: 30rpx;
}
.input{
width: 380rpx;
height: 80rpx;
font-size: 32rpx;
margin-left: 50rpx;
}
.input-code{
width: 290rpx;
}
.clear{
padding: 20rpx;
}
.code{
min-width: 180rpx;
max-width: 220rpx;
height: 64rpx;
padding: 0 4rpx;
font-size: 24rpx;
color: #15716E;
display: flex;
justify-content: center;
align-items: center;
border-radius: 32rpx;
border: 2rpx solid #15716E;
}
.active-bg{
background: #efefef;
}
}
</style>

91
pages/user/my/setPassword.vue

@ -1,6 +1,6 @@
<template>
<view>
<lf-nav title="设置密码" :showIcon="true"></lf-nav>
<lf-nav :title="title" :showIcon="true"></lf-nav>
<view class="content">
<view class="list">
<view class="lf-flex">
@ -20,7 +20,8 @@
</view>
</view>
<button class="next-btn" hover-class="lf-opacity" @click="next">下一步</button>
<lf-pay-password v-if="show_pay" @comfirm="payComfirm"></lf-pay-password>
<lf-pay-password v-if="show_pay" @comfirm="payComfirm" title="请设置6位支付密码"></lf-pay-password>
<lf-pay-password v-else-if="show_again_pay" @comfirm="againPayComfirm" title="请再次输入密码"></lf-pay-password>
</view>
</template>
@ -37,11 +38,16 @@
is_code: false,
timer: null,
num: 10,
show_pay: false
show_pay: false,
show_again_pay: false,
token: '',
title: '验证手机号',
password: ''
}
},
onLoad(){
var token = this.$cookieStorage.get('user_token');
this.token = token;
},
onUnload(){
if(this.timer){
@ -51,14 +57,16 @@
},
methods: {
getCode(){
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(this.is_code) return;
this.is_code = true;
if(this.timer){
clearInterval(this.timer);
this.timer = null;
}
console.log("测试重复点击", Math.random())
// TODO
this.getVerifyCode();
this.timer = setInterval(() => {
this.num--;
if(this.num <= 0){
@ -69,12 +77,79 @@
}
}, 1000);
},
getVerifyCode(){
this.$http.post({
api: 'api/sms/verify-code',
data: {
mobile: this.phone
},
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: this.token
}
}).then(res => {
this.$msg(res.data.message, {icon: 'success'});
})
},
//
next(){
this.show_pay = true;
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(!this.code) return this.$msg('请输入验证码');
this.$http.post({
api: 'api/user/check_old_mobile',
data: {
code: this.code,
mobile: this.phone
},
header: {
Authorization: this.token
}
}).then(res => {
if(res.data.code == 200){
this.title = '设置密码';
this.show_pay = true;
}else{
this.$msg(res.data.message);
}
})
},
//
payComfirm(event){
console.log("支付密码为:", event);
this.show_pay = false;
this.show_again_pay = true;
this.password = event;
},
//
againPayComfirm(event){
if(this.password == event){
this.$http.post({
api: 'api/user/update_pay_pwd',
data: {
code: this.code,
pay_pwd: event
},
header: {
Authorization: this.token
}
}).then(res => {
if(res.data.code == 200){
this.$msg('设置成功', {icon: 'success'}).then(() => {
this.$toBack();
})
}else{
this.$msg(res.data.data);
}
})
}else{
this.$msg('两次密码不同', {icon: 'error'});
this.phone = '';
this.code = '';
this.show_again_pay = false;
this.title = '验证手机号';
}
}
}
}

54
pages/user/my/verificationPhone.vue

@ -5,10 +5,10 @@
<view class="list">
<view class="lf-flex">
<view class="lf-font-28 lf-color-black" style="width: 140rpx;">旧手机号</view>
<input class="input" placeholder="请输入手机号" v-model="phone" maxlength="11" />
<input class="input" placeholder="请输入手机号" v-model="phone" maxlength="11" />
</view>
<view class="clear" v-if="phone.length" @click="phone = ''">
<text class="lf-iconfont icon--"></text>
<text class="lf-iconfont icon-status-error"></text>
</view>
</view>
<view class="list">
@ -33,11 +33,13 @@
code: '',
is_code: false,
timer: null,
num: 10
num: 10,
token: ''
}
},
onLoad(){
var token = this.$cookieStorage.get('user_token');
this.token = token;
},
onUnload(){
if(this.timer){
@ -47,14 +49,16 @@
},
methods: {
getCode(){
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(this.is_code) return;
this.is_code = true;
if(this.timer){
clearInterval(this.timer);
this.timer = null;
}
console.log("测试重复点击", Math.random())
// TODO
this.getVerifyCode();
this.timer = setInterval(() => {
this.num--;
if(this.num <= 0){
@ -65,9 +69,43 @@
}
}, 1000);
},
getVerifyCode(){
this.$http.post({
api: 'api/sms/verify-code',
data: {
mobile: this.phone
},
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: this.token
}
}).then(res => {
this.$msg(res.data.message, {icon: 'success'});
})
},
next(){
// this.$url('/pages/user/my/setPassword', {type: 'redirect'});
this.$url('/pages/user/my/setPassword');
let phone = this.phone;
if(!phone) return this.$msg('请输入手机号');
if(!this.$check(phone, 'mobile')) return this.$msg('请输入正确的手机号');
if(!this.code) return this.$msg('请输入验证码');
this.$http.post({
api: 'api/user/check_old_mobile',
data: {
code: this.code,
mobile: this.phone
},
header: {
Authorization: this.token
}
}).then(res => {
console.log("11111res", res)
if(res.data.code == 200){
this.$url('/pages/user/my/newPhone');
}else{
this.$msg(res.data.message);
}
})
}
}
}

48
pages/user/my/vipinfo.vue

@ -140,7 +140,17 @@
info.name = detail.name;
info.sex = detail.sex;
info.birthday = detail.birthday;
// todo ...
info.native_place = detail.country;
if(detail.province && detail.city && detail.area){
let address = [detail.province, detail.city, detail.area];
info.address = address;
}
info.address_detail = detail.postal_address;
info.home_address = detail.home_address;
// todo ... id_number
this.info = info;
})
},
@ -151,24 +161,46 @@
this.info.address = event.detail.value;
},
submit(){
console.log(this.info);
let par = {};
if(this.info.name){
par.name = this.info.name; //
}
if(this.info.native_place){
par.country = this.info.native_place; //
}
if(this.info.address.length){
let address = this.info.address;
par.province = address[0]; //
par.city = address[1]; //
par.area = address[2]; //
}
if(this.info.address_detail){
par.postal_address = this.info.address_detail; //
}
if(this.info.home_address){
par.home_address = this.info.home_address; //
}
if(this.info.education){
par.education = this.info.education; //
}
if(Object.keys(par).length <= 0){
return this.$msg('您未填写资料哦', {icon: 'error'})
}
uni.showLoading({
title: '正在保存中'
});
// TODO
this.$http.post({
api: 'api/users/update/info',
data: {
name: this.info.name,
// education: this.info.education
},
data: par,
header: {
Authorization: this.token,
Accept: 'application/json'
}
}).then(res => {
uni.hideLoading();
this.$msg('保存成功', {icon: 'success'});
if(res.data.code == 200){
this.$msg('保存成功', {icon: 'success'});
}
}).catch(err => {
uni.hideLoading();
this.$msg('保存失败', {icon: 'error'});

Loading…
Cancel
Save