Browse Source

Merge pull request 'feat: 接口对接;' (#4) from fox into master

Reviewed-on: http://175.178.51.79:3000/Augcl/massage-front/pulls/4
master
Fox 3 weeks ago
parent
commit
637be6ca65
13 changed files with 149 additions and 158 deletions
  1. +0
    -8
      api/model/index.js
  2. +6
    -0
      api/model/login.js
  3. +23
    -13
      api/model/order.js
  4. +44
    -53
      components/order/orderCard.vue
  5. +5
    -8
      components/product/productCard.vue
  6. +5
    -10
      pages/index/center.vue
  7. +1
    -0
      pages/index/index.vue
  8. +5
    -13
      pages_order/components/verifyRecord/voucherCard.vue
  9. +7
    -12
      pages_order/mine/memberCenter.vue
  10. +23
    -26
      pages_order/mine/verifyRecord.vue
  11. +2
    -1
      pages_order/order/createOrder.vue
  12. +6
    -8
      pages_order/product/productDetail.vue
  13. +22
    -6
      store/store.js

+ 0
- 8
api/model/index.js View File

@ -109,14 +109,6 @@ const api = {
limit: 1000,
showLoading: true,
},
// 取消订单
cancelOrder: {
url: '/order/cancelOrder',
method: 'POST',
auth: true,
limit: 1000,
showLoading: true,
},
// 获取首页广告列表
getRiceProductList: {
url: '/index_common/getRiceAdList',


+ 6
- 0
api/model/login.js View File

@ -30,6 +30,12 @@ const api = {
method: 'GET',
auth: true,
},
// 获取个人中心基础数据信息
getUserCenterData: {
url: '/userInfo/getUserCenterData',
method: 'GET',
auth: true,
},
}
export default api

+ 23
- 13
api/model/order.js View File

@ -48,16 +48,26 @@ const api = {
method: 'GET',
auth: true,
},
// /**
// * 取消订单
// */
// cancelOrder: {
// url: '/order/cancelOrder',
// method: 'POST',
// limit: 500,
// auth: true,
// showLoading: true,
// },
/**
* 取消订单
*/
cancelOrder: {
url: '/order/cancelOrder',
method: 'POST',
auth: true,
limit: 1000,
showLoading: true,
},
/**
* 删除订单
*/
deleteOrder: {
url: '/order/deleteOrder',
method: 'POST',
auth: true,
limit: 1000,
showLoading: true,
},
/**
* 申请退款
@ -70,7 +80,7 @@ const api = {
showLoading: true,
},
fetchVoucher: {
fetchOverOrder: {
url: '/order/overOrderList',
method: 'POST',
limit : 500,
@ -78,8 +88,8 @@ const api = {
showLoading : true,
},
fetchStore: {
url: '/order/overOrderList',
fetchOverVoucher: {
url: '/order/useVouchersList',
method: 'POST',
limit : 500,
auth : true,


+ 44
- 53
components/order/orderCard.vue View File

@ -16,19 +16,24 @@
<view class="price">
总价格<text class="unit">¥</text><text class="count">{{ data.amount }}</text>
</view>
<view class="btns">
<!-- 待付款 -->
<template v-if="data.status == 0">
<button plain class="btn btn-plain" @click="onCancel">取消订单</button>
<button plain class="btn" @click="onPay">立即付款</button>
</template>
<!-- 待核销 -->
<template v-if="data.status == 1">
<button plain class="btn" @click="onVerify">去核销</button>
</template>
</view>
</view>
</view>
<view class="btns">
<template v-if="!readonly">
<template v-if="data.status != 1">
<button plain class="btn btn-plain" @click="onDelete">删除订单</button>
</template>
<!-- 待付款 -->
<template v-if="data.status == 0">
<button plain class="btn btn-plain" @click="onCancel">取消订单</button>
<button plain class="btn" @click="onPay">立即付款</button>
</template>
<!-- 待核销 -->
<template v-if="data.status == 1">
<button plain class="btn" @click="onVerify">去核销</button>
</template>
</template>
</view>
</view>
</template>
@ -44,6 +49,10 @@
return {}
}
},
readonly: {
type: Boolean,
default: false,
}
},
data() {
return {
@ -62,6 +71,23 @@
this.$utils.navigateTo(`/pages_order/order/orderDetail?id=${this.data.id}`)
}
},
onDelete() {
uni.showModal({
title: '确认删除订单吗?',
success : e => {
if(e.confirm){
this.$api('deleteOrder', {
orderId : this.data.id,
}, res => {
this.$emit('done')
uni.showToast({
title: '删除成功',
});
})
}
}
})
},
onCancel() {
// todo
uni.showModal({
@ -83,45 +109,9 @@
])
this.$utils.navigateTo(`/pages_order/order/createOrder?id=${this.data.id}`)
return
// todo
this.$api('payOrder', {
orderId : this.data.id,
// todo: payType -> (payType)0- 1-
}, res => {
if(res.code == 200){
uni.requestPaymentWxPay(res)
.then(res => {
uni.showToast({
title: '支付成功',
icon: 'none'
})
this.$emit('done')
}).catch(n => {
this.$emit('done')
})
}
})
},
onVerify() {
// uni.showModal({
// title: '',
// success : e => {
// if(e.confirm){
// this.$api('overOrder', {
// orderId : this.data.id,
// }, res => {
// this.$emit('done')
// this.$utils.navigateTo(`/pages_order/order/verifyOrder?id=${this.data.id}`)
// })
// }
// }
// })
// todo
this.$utils.navigateTo(`/pages_order/order/verifyOrder?id=${this.data.id}`)
}
},
@ -161,7 +151,7 @@
width: 167rpx;
height: 167rpx;
margin-right: 15rpx;
margin-bottom: 29rpx;
// margin-bottom: 29rpx;
}
}
@ -199,11 +189,12 @@
font-size: 18rpx;
}
}
}
.btns {
text-align: right;
font-size: 0;
}
.btns {
text-align: right;
font-size: 0;
min-height: 29rpx;
}
.btn {


+ 5
- 8
components/product/productCard.vue View File

@ -15,13 +15,9 @@
<text>{{ data.price }}</text>
</view>
<view class="flex tag" v-if="role === 'member-personal'">
<image class="icon" src="@/static/image/home/icon-member-personal.png"></image>
<text>个人会员价</text>
</view>
<view class="flex tag" v-else-if="role === 'member-business'">
<image class="icon" src="@/static/image/home/icon-member-business.png"></image>
<text>企业会员价</text>
<view class="flex tag" v-if="role">
<image class="icon" :src="vipInfo.massageVipCombo.imagePrice"></image>
<text>{{ vipInfo.massageVipCombo.title }}</text>
</view>
</view>
@ -38,7 +34,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
export default {
props: {
@ -67,6 +63,7 @@
},
computed: {
...mapGetters(['role']),
...mapState(['vipInfo']),
isRecommend() {
return this.data.isHot === '1'
}


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

@ -18,14 +18,8 @@
<template v-if="role">
<!-- todo: 缺切图 "皇冠" -->
<image class="icon icon-crown" src="" mode="widthFix"></image>
<template v-if="role === 'member-personal'">
<image class="icon icon-role" src="@/static/image/center/icon-member-personal.png" mode="widthFix"></image>
</template>
<template v-else-if="role === 'member-business'">
<image class="icon icon-role" src="@/static/image/center/icon-member-business.png" mode="widthFix"></image>
</template>
<!-- todo: 换回接口字段 -->
<text class="member-tips">{{ `将于${'2026-12-12'} 到期` }}</text>
<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>
</template>
<template v-else>
<view class="flex">
@ -73,7 +67,7 @@
<!-- 账户信息 - 登录后显示 -->
<view class="card flex account">
<view class="flex flex-column">
<view class="account-value">{{ riceInfo.balance || 0 }}<text class="account-unit"></text></view>
<view class="account-value">{{ userInfo.price || 0 }}<text class="account-unit"></text></view>
<view class="account-label">我的余额</view>
</view>
<view class="flex flex-column">
@ -174,7 +168,7 @@
},
computed: {
...mapGetters(['role']),
...mapState(['userInfo', 'riceInfo']),
...mapState(['userInfo', 'vipInfo', 'riceInfo']),
isMerchants() {
return this.userInfo.isMerchants === '1'
},
@ -189,6 +183,7 @@
onShow() {
if(this.isLogin){
this.$store.commit('getUserInfo')
this.$store.commit('getUserCenterInfo')
this.$store.commit('getRiceInfo')
}
},


+ 1
- 0
pages/index/index.vue View File

@ -88,6 +88,7 @@
if(uni.getStorageSync('token')){
this.$store.commit('getUserInfo')
this.$store.commit('getUserCenterInfo')
}
},
onPullDownRefresh() {


+ 5
- 13
pages_order/components/verifyRecord/voucherCard.vue View File

@ -1,35 +1,27 @@
<template>
<view class="card flex voucher">
<image class="voucher-img" :src="data.massageItem.image"></image>
<image class="voucher-img" :src="data.member.headImage"></image>
<view class="voucher-info">
<view class="voucher-name">{{ data }}</view>
<view class="voucher-desc">{{ `核销时间:${data.createTime}` }}</view>
<view class="voucher-name">{{ data.member.nickName }}</view>
<view class="voucher-desc">{{ `核销时间:${data.useTime}` }}</view>
</view>
<view class="voucher-count">
<text>代金券</text>
<text class="voucher-value">{{ `${data.count}` }}</text>
<text class="voucher-value">{{ `${data.discountAmount}` }}</text>
</view>
</view>
</template>
<script>
const TEST_DATA = {
id: '001',
imgUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280',
userName: '用户136xxxxxxxxx',
createTime: '2025/03/05 14:45:36',
count: '100',
}
export default {
props: {
data: {
type: Object,
default() {
return TEST_DATA
return {}
}
},
},


+ 7
- 12
pages_order/mine/memberCenter.vue View File

@ -14,19 +14,11 @@
<view class="user-info">
<view class="flex user-name">
<text>{{ userInfo.nickName }}</text>
<template v-if="role === 'member-personal'">
<image class="icon icon-role" src="@/static/image/center/icon-member-personal.png"
mode="widthFix"></image>
</template>
<template v-else-if="role === 'member-business'">
<image class="icon icon-role" src="@/static/image/center/icon-member-business.png"
mode="widthFix"></image>
</template>
<image v-if="role" class="icon icon-role" :src="vipInfo.massageVipCombo.imageVip" mode="widthFix"></image>
</view>
<view class="user-desc">
<template v-if="role">
<!-- todo: 换回接口字段 -->
<text>{{ `将于${'2026-12-12'} 到期` }}</text>
<text>{{ `将于${$dayjs(vipInfo.validTime).format('YYYY-MM-DD')}到期` }}</text>
</template>
<template v-else>
<text>暂未开通会员</text>
@ -107,7 +99,7 @@
},
computed: {
...mapGetters(['role']),
...mapState(['userInfo']),
...mapState(['userInfo', 'vipInfo']),
selectedChargeObj() {
return this.chargeOptions.find(item => item.id === this.selectedChargeId)
},
@ -215,6 +207,7 @@
width: 147rpx;
height: 147rpx;
margin-right: 8rpx;
border-radius: 50%;
}
&-info {
@ -299,6 +292,7 @@
&-selection {
justify-content: space-between;
font-size: 0;
flex-wrap: wrap;
}
&-option {
@ -310,6 +304,7 @@
border-radius: 16rpx;
box-shadow: 0rpx 3rpx 6rpx 0rpx #eef3e3;
color: #999999;
margin-bottom: 20rpx;
&-value {
font-size: 61rpx;
@ -328,7 +323,7 @@
}
&-rights {
margin-top: 67rpx;
margin-top: 47rpx;
&-header {
.title {


+ 23
- 26
pages_order/mine/verifyRecord.vue View File

@ -34,7 +34,7 @@
<view class="left">
<uv-datetime-picker
ref="datetimePicker"
v-model="selectedTime"
v-model="queryParams.useTime"
mode="year-month"
confirmColor="#84A73F"
@confirm="onTimeChange"
@ -46,25 +46,18 @@
</view>
<view class="right">
<text>{{ `${displaySelectedMonth}总核销:` }}</text>
<!-- todo: 对接接口字段 -->
<text class="highlight">{{ 0 }}</text>
<text class="highlight">{{ total }}</text>
</view>
</view>
<template v-if="current == 0" >
<view class="list order">
<!-- <orderCard class="list-item"
<orderCard class="list-item"
v-for="item in list"
:key="item.id"
:data="data"
></orderCard> -->
<voucherCard class="list-item"
v-for="item in list"
:key="item.id"
:data="data"
></voucherCard>
:data="item"
:readonly="true"
></orderCard>
</view>
</template>
<template v-else-if="current == 1" >
@ -72,25 +65,23 @@
<voucherCard class="list-item"
v-for="item in list"
:key="item.id"
:data="data"
:data="item"
></voucherCard>
<voucherCard class="list-item"></voucherCard>
<voucherCard class="list-item"></voucherCard>
</view>
</template>
</view>
</template>
<script>
import dayjs from 'dayjs'
import mixinsList from '@/mixins/list.js'
import orderCard from '@/components/order/orderCard.vue'
import voucherCard from '../components/verifyRecord/voucherCard.vue'
const TAB_AND_API_FIELDS_MAPPING = {
// todo:
0: 'fetchVoucher',
1: 'fetchStore',
0: 'fetchOverOrder',
1: 'fetchOverVoucher',
}
@ -108,31 +99,37 @@
name: "核销代金券"
}],
current: 0,
selectedTime: new Date(),
queryParams: {
pageNo: 1,
pageSize: 10,
useTime: dayjs().format('YYYY-MM'),
},
};
},
computed: {
mixinsListApi() {
// todo
return TAB_AND_API_FIELDS_MAPPING[this.current]
},
displaySelectedTime() {
return this.$dayjs(this.selectedTime).format("YYYY年M月")
return this.$dayjs(this.queryParams.useTime).format("YYYY年M月")
},
displaySelectedMonth() {
return this.$dayjs(this.selectedTime).format("M月")
return this.$dayjs(this.queryParams.useTime).format("M月")
},
},
methods: {
onTabChange(e) {
this.current = e.index
this.list = []
this.total = 0
this.getData()
},
openTimePicker() {
this.$refs.datetimePicker.open();
},
onTimeChange(e) {
// todo
console.log('--onTimeChange', e)
this.queryParams.useTime = this.$dayjs(e.value).format('YYYY-MM')
this.getData()
},
},
}


+ 2
- 1
pages_order/order/createOrder.vue View File

@ -21,7 +21,7 @@
<view class="flex payment-item">
<image class="icon" src="../static/createOrder/icon-account.png" mode="widthFix"></image>
<!-- todo: check -->
<text class="label">账户余额<text class="desc">{{ `(余额:¥${riceInfo.balance || 0}` }}</text></text>
<text class="label">账户余额<text class="desc">{{ `(余额:¥${userInfo.price || 0}` }}</text></text>
<uv-radio :name="1" activeColor="#84A73F" size="39rpx" icon-size="39rpx"/>
</view>
</uv-radio-group>
@ -108,6 +108,7 @@
},
onLoad({ id }) {
this.$store.commit('getUserInfo')
this.$store.commit('getUserCenterInfo')
this.orderId = id
},
onShow() {


+ 6
- 8
pages_order/product/productDetail.vue View File

@ -13,14 +13,11 @@
<text>{{ productDetail.price }}</text>
</view>
<view class="flex tag" v-if="role === 'member-personal'">
<image class="icon" src="@/static/image/home/icon-member-personal.png"></image>
<text>个人会员价</text>
</view>
<view class="flex tag" v-else-if="role === 'member-business'">
<image class="icon" src="@/static/image/home/icon-member-business.png"></image>
<text>企业会员价</text>
<view class="flex tag" v-if="role">
<image class="icon" :src="vipInfo.massageVipCombo.imagePrice"></image>
<text>{{ vipInfo.massageVipCombo.title }}</text>
</view>
</view>
<view>
<text>{{ `已售出:${productDetail.sales}` }}</text>
@ -66,7 +63,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
import cardTitle from '@/components/base/cardTitle.vue'
@ -85,6 +82,7 @@
},
computed: {
...mapGetters(['role']),
...mapState(['vipInfo']),
// todo: check
bannerList() {
const { image } = this.productDetail


+ 22
- 6
store/store.js View File

@ -5,10 +5,10 @@ Vue.use(Vuex); //vue的插件机制
import api from '@/api/api.js'
const ROLE_AND_DESC_FIELDS_MAPPING = {
0: '',
1: 'member-personal', //个人会员
2: 'member-business', //企业会员
const ROLE_TYPE_AND_DESC_FIELDS_MAPPING = {
default: 'member-personal',
0: 'member-personal', //个人会员
1: 'member-business', //企业会员
}
//Vuex.Store 构造器选项
@ -16,13 +16,22 @@ const store = new Vuex.Store({
state: {
configList: {}, //配置列表
userInfo: {}, //用户信息
vipInfo: {},
riceInfo: {}, //用户相关信息
payOrderProduct: [], //支付订单中的商品
},
getters: {
role(state) {
return ROLE_AND_DESC_FIELDS_MAPPING[state.userInfo?.role]
}
const { validTime, massageVipCombo } = state.vipInfo || {}
if (!validTime || new Date().getTime() > new Date(validTime).getTime()) {
return ''
}
const { type } = massageVipCombo || {}
return ROLE_TYPE_AND_DESC_FIELDS_MAPPING[type] || ROLE_TYPE_AND_DESC_FIELDS_MAPPING.default
},
},
mutations: {
// 初始化配置
@ -119,6 +128,13 @@ const store = new Vuex.Store({
}
})
},
getUserCenterInfo(state) {
api('getUserCenterData', res => {
if (res.code == 200) {
Vue.set(state, 'vipInfo', res.result?.vipInfo || {})
}
})
},
getRiceInfo(state) {
// todo


Loading…
Cancel
Save