Browse Source

fixed: bug修复;

fox
fox 4 days ago
parent
commit
a63498d396
9 changed files with 153 additions and 21 deletions
  1. +3
    -1
      api/fetch.js
  2. +17
    -2
      components/couponList/couponList.vue
  3. +2
    -1
      pages.json
  4. +35
    -5
      pages/index/center.vue
  5. +30
    -0
      pages_order/auth/wxUserInfo.vue
  6. +40
    -8
      pages_order/mine/cooperation.vue
  7. +3
    -3
      pages_order/order/createOrder.vue
  8. BIN
      pages_order/static/center/member-not-bg.png
  9. +23
    -1
      utils/utils.js

+ 3
- 1
api/fetch.js View File

@ -1,7 +1,7 @@
import api from './api.js'
const fetch = (key, data = {}, transform = true, loadingTitle) => {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
const callback = (res) => {
if (!transform) {
@ -10,6 +10,8 @@ const fetch = (key, data = {}, transform = true, loadingTitle) => {
}
if (res.code == 200) {
resolve(res.result)
} else {
reject(res)
}
}


+ 17
- 2
components/couponList/couponList.vue View File

@ -2,7 +2,7 @@
<scroll-view scroll-y="true" :style="{height: height}" @scrolltolower="moreCoupon()">
<!-- 优惠券列表 -->
<view class="list">
<view class="list-item" v-for="item in couponList" @click="select(item)" :key="item.id">
<view class="list-item" :class="[getDisabled(item) ? 'is-disabled' : '']" v-for="item in couponList" @click="select(item)" :key="item.id">
<!-- 已领取 -->
<template v-if="item.status == 0">
@ -36,6 +36,10 @@
},
height: {
default: 'calc(90vh - 180rpx)'
},
maxLimit: {
type: Number,
default: null,
}
},
data() {
@ -59,10 +63,17 @@
},
// #endif
methods: {
getDisabled(item) {
return this.maxLimit && (item.discountAmount > this.maxLimit)
},
select(item) {
if (this.getDisabled(item)) {
return
}
this.$emit('select', item)
},
//
getCouponList() {
let params = {
@ -118,6 +129,10 @@
height: 211rpx;
position: relative;
&.is-disabled {
opacity: 0.5;
}
&-bg {
width: 100%;
height: 100%;


+ 2
- 1
pages.json View File

@ -23,7 +23,8 @@
{
"path": "pages/index/center",
"style": {
"navigationBarTitleText": "我的"
"navigationBarTitleText": "我的",
"enablePullDownRefresh": true
}
},
{


+ 35
- 5
pages/index/center.vue View File

@ -13,7 +13,24 @@
<image class="user-avatar" :src="userInfo.headImage" mode="aspectFill"></image>
<view class="user-name">{{ userInfo.nickName }}</view>
</view>
<view class="member">
<template v-if="role">
<image class="member-bg" src="@/pages_order/static/center/member-bg.png" mode="widthFix" ></image>
<view class="flex member-overview" :class="[role ? 'is-member' : '']">
<image class="icon icon-crown" src="" mode="widthFix"></image>
<image v-if="role" class="icon icon-role" :src="vipInfo.massageVipCombo.imageVip" mode="widthFix"></image>
<text v-if="vipInfo.validTime" class="member-tips">{{ `将于${$dayjs(vipInfo.validTime).format('YYYY-MM-DD')}到期` }}</text>
</view>
</template>
<template v-else>
<image class="member-bg" src="@/pages_order/static/center/member-not-bg.png" mode="widthFix" ></image>
<button plain class="btn member-btn" @click="$utils.navigateTo('/pages_order/mine/memberCenter')">立即开通</button>
</template>
</view>
<view class="member" v-if="false">
<image class="member-bg" src="@/pages_order/static/center/member-bg.png" mode="widthFix" ></image>
<view class="flex member-overview" :class="[role ? 'is-member' : '']">
<template v-if="role">
@ -166,6 +183,18 @@
this.fetchCouponData()
}
},
onPullDownRefresh() {
if(uni.getStorageSync('token')){
this.$store.commit('getUserInfo')
this.$store.commit('getUserCenterInfo')
this.$store.commit('getRiceInfo')
this.fetchCouponData()
setTimeout(() => {
uni.stopPullDownRefresh();
}, 300)
}
},
methods: {
// #ifdef H5
//
@ -419,13 +448,14 @@
}
&-btn {
padding: 9rpx 17rpx;
display: inline-block;
position: absolute;
top: 26rpx;
right: 28rpx;
padding: 14rpx 20rpx;
color: #000000;
font-size: 22rpx;
background-image: linear-gradient(131deg, #F8EDE1, #B3997E);
box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
border-radius: 24rpx;
margin-right: 18rpx;
border: none;
}
&-tips {


+ 30
- 0
pages_order/auth/wxUserInfo.vue View File

@ -18,6 +18,20 @@
头像
</view>
<view class="content">
<!-- #ifdef H5 -->
<button class="btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @click="upPic">
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" class="avatar"
mode=""></image>
<view v-else class="avatar" style="background-color: #C7C7C7; border-radius: 50%;">
<uv-icon name="account-fill" color="#ffffff" size="70rpx"></uv-icon>
</view>
</button>
<!-- #endif -->
<!-- #ifdef MP -->
<button class="btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" class="avatar"
@ -28,6 +42,7 @@
</view>
</button>
<!-- #endif -->
</view>
</view>
<view class="form-item">
@ -103,6 +118,7 @@
onLoad() {
this.userInfoForm.nickName = this.userInfo.nickName || ''
this.userInfoForm.headImage = this.userInfo.headImage || ''
this.userInfoForm.phone = this.userInfo.phone || ''
},
computed: {},
methods: {
@ -112,6 +128,20 @@
this.userInfoForm.headImage = url
})
},
upPic() {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], //
success: res => {
let avatarUrl = res.tempFilePaths[0] // cover
this.$Oss.ossUpload(avatarUrl)
.then(url => {
this.userInfoForm.headImage = url
})
}
});
},
getPhone(e){
this.$api('bindPhone', {
phoneCode : e.detail.code


+ 40
- 8
pages_order/mine/cooperation.vue View File

@ -27,7 +27,9 @@
:labelStyle="{
color: '#000000',
fontSize: '28rpx',
}">
}"
errorType="toast"
>
<view class="form-item">
<uv-form-item label="店铺名称" prop="shop">
<view class="form-item-content">
@ -82,6 +84,7 @@
mapState
} from 'vuex'
import util from '@/utils/utils.js'
import Position from '@/utils/position.js'
import formInput from '../components/formInput.vue'
@ -128,7 +131,12 @@
'phone': {
type: 'string',
required: true,
message: '请输入您的手机号',
message: '请输入正确的手机号',
validator: (rule, value, callback) => {
//
// truefalse
return util.validatePhone(value)
},
},
'area': {
type: 'string',
@ -149,6 +157,9 @@
onLoad() {
this.initData()
},
onReady() {
this.$refs.form.setRules(this.rules)
},
onPullDownRefresh() {
this.updateStatus()
},
@ -224,22 +235,38 @@
},
async updateStatus() {
if (!this.id) {
uni.stopPullDownRefresh();
return
}
try {
const shopDetails = (await this.$fetch('queryShopById'))
const {
status,
status_dictText,
remark
} = await this.$fetch('queryShopById', {
id: this.id
})
} = shopDetails
this.status = status
this.statusDesc = status == '2' ? `${status_dictText}${remark}` : status_dictText
} catch (err) {
console.log('--err', err)
if (this.id) {
this.form = {
image: null,
shop: null,
name: null,
phone: null,
area: null,
latitude: null,
longitude: null,
address: null,
}
this.id = null
this.status = null
this.statusDesc = null
}
console.log('err', err)
}
uni.stopPullDownRefresh();
@ -271,7 +298,12 @@
address,
}
let api = this.id ? 'updateShop' : 'addShop'
let api = 'addShop'
if (this.id) {
api = 'updateShop'
params.id = this.id
}
await this.$fetch(api, params)
@ -283,7 +315,7 @@
setTimeout(uni.navigateBack, 1000, -1)
} catch (err) {
console.log('err', err)
}
},


+ 3
- 3
pages_order/order/createOrder.vue View File

@ -32,7 +32,7 @@
<view @click="openCoupon" class="card flex coupon">
<image class="icon" src="@/pages_order/static/createOrder/icon-coupon.png" mode="widthFix"></image>
<!-- todo: check is selected coupon -->
<view class="label">优惠券<text v-if="selectedCoupon[0]" class="desc">{{ `满减券:${coupon.vouchersId_dictText}` }}</text></view>
<view class="label">优惠券<text v-if="selectedCoupon[0]" class="desc">{{ `满减券:${coupon.discountAmount}` }}</text></view>
<view v-if="selectedCoupon[0]">
<uv-checkbox-group v-model="selectedCoupon" shape="circle" >
<uv-checkbox :name="1" size="39rpx" icon-size="39rpx" activeColor="#84A73F"></uv-checkbox>
@ -60,7 +60,7 @@
<!-- 优惠券选择-->
<uv-popup ref="couponPopup" :round="30">
<couponList ref="couponList" height="60vh" :status="0" @select="selectCoupon" />
<couponList ref="couponList" height="60vh" :status="0" :maxLimit="totalPrice" @select="selectCoupon" />
</uv-popup>
<configPopup ref="popup"></configPopup>
@ -102,7 +102,7 @@
price -= (this.coupon.money || 0)
}
return Number(price).toFixed(2)
return Number(Number(price).toFixed(2))
},
...mapState(['userInfo', 'payOrderProduct']),
},


BIN
pages_order/static/center/member-not-bg.png View File

Before After
Width: 742  |  Height: 241  |  Size: 85 KiB

+ 23
- 1
utils/utils.js View File

@ -226,6 +226,27 @@ export const toLogin = function(){
}
}()
export const validatePhone = (phone) => {
// let fixedLindReg = /(\d{3,4}-)?\d{7,8}$/g // 常见座机格式
let mobileReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/g // 中国大陆手机号
// if (fixedLindReg.test(phone)) {
// return true
// }
if (mobileReg.test(phone)) {
return true
}
uni.showToast({
title: '请填写正确手机号',
icon: "none"
})
return false
}
export default {
toArray,
generateUUID,
@ -240,5 +261,6 @@ export default {
redirectTo,
copyText,
stringFormatHtml,
toLogin
toLogin,
validatePhone,
}

Loading…
Cancel
Save