余额支付
This commit is contained in:
11
api/mine/wallet.js
Normal file
11
api/mine/wallet.js
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 我的账户 /api/front/user/center/my/account
|
||||
export function getMyWalletAPI() {
|
||||
return request({
|
||||
url: '/api/front/user/center/my/account',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 卡券商品分页列表
|
||||
// 卡券商品分页列表 /api/front/card/product/list
|
||||
export function getCardProductListAPI(params) {
|
||||
return request({
|
||||
url: '/api/front/card/product/list',
|
||||
@@ -16,4 +16,31 @@ export function getCardProductInfoAPI(id){
|
||||
url:`/api/front/card/product/info/${id}`,
|
||||
method:'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 我的优惠券 /api/front/coupon/user/list
|
||||
export function getCouponListAPI(params) {
|
||||
return request({
|
||||
url: '/api/front/coupon/user/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 汽车系统-卡券商品订单支付 /api/front/pay/paycard
|
||||
export function paycardAPI(data){
|
||||
return request({
|
||||
url:'/api/front/pay/paycard',
|
||||
method:'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 创建订单 /api/front/card/product/order/create
|
||||
export function addOrderAPI(data){
|
||||
return request({
|
||||
url:'/api/front/card/product/order/create',
|
||||
method:'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -199,6 +199,12 @@
|
||||
"navigationBarTitleText": "门店列表",
|
||||
"enablePullDownRefresh" : false
|
||||
}
|
||||
}, {
|
||||
"path": "pages/serve/coupons/cou_card",
|
||||
"style": {
|
||||
"navigationBarTitleText": "优惠券",
|
||||
"enablePullDownRefresh" : false
|
||||
}
|
||||
}, {
|
||||
"path": "pages/serve/coupons/cou_order",
|
||||
"style": {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<view class="amount flex align-center justify-between">
|
||||
<view class="flex-column">
|
||||
<text class="f-38 c222">总余额(元)</text>
|
||||
<text class="f-52 c111 fw-b mt-1">420</text>
|
||||
<text class="f-52 c111 fw-b mt-1">{{ myWallet.nowMoney }}</text>
|
||||
</view>
|
||||
<view class="flex align-center">
|
||||
<u-button color="#333" :customStyle="{width: '136rpx', height: '64rpx', lineHeight: '64rpx'}"
|
||||
@@ -37,7 +37,7 @@
|
||||
</view>
|
||||
<view class="flex align-center justify-between mt-2 f-28 c666">
|
||||
<view class="">
|
||||
<text>支出:¥1000.00</text>
|
||||
<text>支出:¥{{myWallet.monetary}}</text>
|
||||
<text>收入:¥723.00</text>
|
||||
</view>
|
||||
<view class="">
|
||||
@@ -90,13 +90,25 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMyWalletAPI } from '@/api/mine/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
myWallet:{}
|
||||
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getMyWallet()
|
||||
},
|
||||
methods: {
|
||||
getMyWallet(){
|
||||
getMyWalletAPI().then(res=>{
|
||||
this.myWallet=res.data
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
topUpFn(type) {
|
||||
if (type == 2) {
|
||||
uni.navigateTo({
|
||||
|
||||
287
pages/serve/coupons/cou_card.vue
Normal file
287
pages/serve/coupons/cou_card.vue
Normal file
@@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<view class="cou_card">
|
||||
<view class="allPage">
|
||||
<!-- <z-paging ref="paging" v-model="dataList" @query="queryList()" :hide-empty-view='true'> -->
|
||||
<view class="pagView" v-if="dataList.length !==0">
|
||||
<view class="top_title"> 可用优惠券 </view>
|
||||
<view class="data-list f-a-i f-jcsb" v-for="(item,index) in dataList" :key="item.id" @click="selectButton(item)">
|
||||
<view class="f-a-i">
|
||||
<view class="data-list-price">
|
||||
<text class="data_price_l">¥</text><text class="data_price_r"> {{ item.money }} </text>
|
||||
</view>
|
||||
<view class="data-list-particulars">
|
||||
<view class="data-list-particulars-up"> {{ item.name }} </view>
|
||||
<view class="data-list-particulars-time">有效期:{{ item.endTime }} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="data-list-down">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<image v-if="act==item.id" :src="`${config.aliyunOssUrl}/static/images/app/serve/act.png`" mode=""></image>
|
||||
<image v-else :src="`${config.aliyunOssUrl}/static/images/app/serve/act_no.png`" mode=""></image>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP -->
|
||||
<image v-if="act==item.id" src="@/static/images/app/serve/act.png" mode=""></image>
|
||||
<image v-else src="@/static/images/app/serve/act_no.png" mode=""></image>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="noPagView" v-if="unDataList.length !==0">
|
||||
<view class="top_title1"> 不可用优惠券 </view>
|
||||
<view class="data-list1" v-for="(item,index) in unDataList" :key="item.id">
|
||||
<view class="f-a-i">
|
||||
<view class="data-list-price1">
|
||||
<text class="data_price_l1">¥</text><text class="data_price_r1"> {{ item.money }} </text>
|
||||
</view>
|
||||
<view class="data-list-particulars1">
|
||||
<view class="data-list-particulars-up1"> {{ item.name }} </view>
|
||||
<view class="data-list-particulars-time1">有效期:{{ item.endTime }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- </z-paging> -->
|
||||
<!-- <z-paging ref="unPaging" v-model="unDataList" @query='unQueryList()' :hide-empty-view='true'>
|
||||
<view class="noPagView" v-if="unDataList.length !==0">
|
||||
<view class="top_title1"> 不可用优惠券 </view>
|
||||
<view class="data-list1" v-for="(item,index) in unDataList" :key="item.id">
|
||||
<view class="f-a-i">
|
||||
<view class="data-list-price1">
|
||||
<text class="data_price_l1">¥</text><text class="data_price_r1"> {{ item.money }} </text>
|
||||
</view>
|
||||
<view class="data-list-particulars1">
|
||||
<view class="data-list-particulars-up1"> {{ item.name }} </view>
|
||||
<view class="data-list-particulars-time1">有效期:{{ item.endTime }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging> -->
|
||||
</view>
|
||||
<view class="btn" v-if="dataList.length !==0" @click="couCardSureBtn"> 确认 </view>
|
||||
<view class="empty" v-if="dataList.length ==0 && unDataList.length ==0">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<image :src="`${config.aliyunOssUrl}/static/images/app/mine/ticket_no.png`" mode=""></image>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP -->
|
||||
<image src="@/static/images/app/mine/ticket_no.png" mode=""></image>
|
||||
<!-- #endif -->
|
||||
<view class="empty_txt">暂无优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '@/config';
|
||||
import { getCouponListAPI } from '@/api/serve/coupons'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
act:'',
|
||||
dataList:[],
|
||||
unDataList:[],
|
||||
money:'',
|
||||
usableData:{
|
||||
type:'usable'
|
||||
},
|
||||
unusableData:{
|
||||
type:'unusable'
|
||||
},
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.getCouponList()
|
||||
},
|
||||
methods: {
|
||||
// 类型,usable-可用,unusable-不可用
|
||||
getCouponList(){
|
||||
getCouponListAPI(this.unusableData).then(res=>{
|
||||
this.unDataList=res.data.list
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
|
||||
getCouponListAPI(this.usableData).then(res=>{
|
||||
console.log(res,'可用');
|
||||
this.dataList=res.data.list
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
selectButton (item){
|
||||
// console.log(item,'123123123');
|
||||
this.act=item.id
|
||||
this.money=item
|
||||
},
|
||||
// 确认
|
||||
couCardSureBtn(){
|
||||
console.log(this.money,'金额');
|
||||
this.$store.dispatch('Cardmoney',this.money)
|
||||
uni.navigateBack({
|
||||
url:`/pages/serve/coupons/cou_order`
|
||||
})
|
||||
}
|
||||
|
||||
// 类型,usable-可用,unusable-不可用
|
||||
// queryList(pageNo,pageSize){
|
||||
// getCouponListAPI({
|
||||
// limit:pageSize,
|
||||
// page:pageNo,
|
||||
// type:'usable'
|
||||
// }).then(res=>{
|
||||
// console.log(res,'优惠券--可用');
|
||||
// this.$refs.paging.complete(res.data.list)
|
||||
// }).catch(err=>{
|
||||
// this.$refs.paging.complete(false)
|
||||
// })
|
||||
// },
|
||||
// unQueryList(pageNo,pageSize){
|
||||
// getCouponListAPI({
|
||||
// limit:pageSize,
|
||||
// page:pageNo,
|
||||
// type:'unusable'
|
||||
// }).then(res=>{
|
||||
// console.log(res,'优惠券--不不可用');
|
||||
// this.$refs.unPaging.complete(res.data.list)
|
||||
// }).catch(err=>{
|
||||
// this.$refs.unPaging.complete(false)
|
||||
// })
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.btn {
|
||||
position: fixed;
|
||||
bottom: 10rpx;
|
||||
left: 30rpx;
|
||||
margin-bottom: 40rpx;
|
||||
background: #13AFA8;
|
||||
box-shadow: inset 0rpx 2rpx 0rpx 0rpx rgba(0,0,0,0.03);
|
||||
border-radius: 60rpx;
|
||||
padding: 24rpx 315rpx;
|
||||
opacity: 1;
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty {
|
||||
text-align: center;
|
||||
margin-top: 295rpx;
|
||||
|
||||
image {
|
||||
width: 480rpx;
|
||||
height: 280rpx;
|
||||
}
|
||||
|
||||
.empty_txt {
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.allPage {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
|
||||
.pagView {
|
||||
padding: 32rpx 24rpx;
|
||||
}
|
||||
.noPagView {
|
||||
padding:0 24rpx 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.top_title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
page {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.data-list {
|
||||
background: #fff;
|
||||
margin: 24rpx 0;
|
||||
padding: 37rpx 45rpx 37rpx 16rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.data-list-down {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.data-list-price {
|
||||
border-right: 1rpx dashed #333333;
|
||||
padding:10rpx 16rpx;
|
||||
.data_price_l {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
.data_price_r {
|
||||
font-size: 48rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.data-list-particulars {
|
||||
margin-left: 32rpx;
|
||||
.data-list-particulars-up {
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.data-list-particulars-time {
|
||||
margin-top: 32rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.data-list1 {
|
||||
background: #fff;
|
||||
margin: 24rpx 0;
|
||||
padding: 37rpx 45rpx 37rpx 16rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.data-list-down1 {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.data-list-price1 {
|
||||
border-right: 1rpx dashed #999999;
|
||||
padding:10rpx 16rpx;
|
||||
.data_price_l1 {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
.data_price_r1 {
|
||||
font-size: 48rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.data-list-particulars1 {
|
||||
margin-left: 32rpx;
|
||||
.data-list-particulars-up1 {
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
.data-list-particulars-time1 {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -22,7 +22,7 @@
|
||||
<image :src="cardInfo.image" mode=""></image>
|
||||
</view>
|
||||
<!-- 秒杀 -->
|
||||
<view class="de_countdown" v-if="cardInfo.type==2">
|
||||
<view class="de_countdown" v-if="cardInfo.type==2 && (cardInfo.status==0 || cardInfo.status==1)">
|
||||
<view class="count_l"> 限时秒杀·抢完为止 </view>
|
||||
<view class="count_r">
|
||||
<view class="r_r"> {{countInfo.countTxt}} </view>
|
||||
@@ -54,8 +54,8 @@
|
||||
<view class="up_l" v-if="cardInfo.type==2">
|
||||
<view class="l_l"> 秒杀价 </view>
|
||||
<view class="l_r">
|
||||
<view class="l_r_big"> ¥49 </view>
|
||||
<view class="l_r_small"> .99 </view>
|
||||
<view class="l_r_big"> ¥{{cardInfo.price ? cardInfo.price : '--'}} </view>
|
||||
<!-- <view class="l_r_small"> .99 </view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="up_price" v-else> ¥{{cardInfo.price ? cardInfo.price : '--'}} </view>
|
||||
@@ -129,11 +129,11 @@
|
||||
<!-- 选择行展示 -->
|
||||
<view class="footBtn">
|
||||
<view v-if="cardInfo.type==2">
|
||||
<view class="eva_btn" v-if="cardInfo.status==1" @click="buyBtn"> 立即抢购 </view>
|
||||
<view class="eva_miaosha_btn" v-if="cardInfo.status==0"> 未开始 </view>
|
||||
<view class="eva_miaosha_btn" v-if="cardInfo.status==2"> 已结束 </view>
|
||||
<view class="eva_btn" v-if="cardInfo.status==1" @click="buyBtn(1)"> 立即抢购 </view>
|
||||
<view class="eva_miaosha_btn" v-if="cardInfo.status==0" @click="buyBtn(0)"> 未开始 </view>
|
||||
<view class="eva_miaosha_btn" v-if="cardInfo.status==2" @click="buyBtn(2)"> 已结束 </view>
|
||||
</view>
|
||||
<view v-else class="eva_btn" @click="buyBtn" > 立即购买 </view>
|
||||
<view v-else class="eva_btn" @click="buyBtn(3)" > 立即购买 </view>
|
||||
</view>
|
||||
<!-- 选择规格 -->
|
||||
<u-popup :show="showSpecs" mode="bottom" @close="closeSpecs" :closeable='true' :closeOnClickOverlay='false'>
|
||||
@@ -151,7 +151,7 @@
|
||||
</view>
|
||||
<view class="specs_down">
|
||||
<view class="down_num"> 数量 </view>
|
||||
<u-number-box :min="1" :max="999999" v-model="specsValue" @change="specsChange"></u-number-box>
|
||||
<u-number-box :min="1" :max="cardInfo.stock" v-model="numberValue" @change="specsChange"></u-number-box>
|
||||
</view>
|
||||
<view class="specs_btn" @click="specsBtn">选择</view>
|
||||
</view>
|
||||
@@ -168,20 +168,14 @@
|
||||
return {
|
||||
config,
|
||||
showSpecs:false,
|
||||
specsValue:null, // 数量
|
||||
specsValue:'', // 数量
|
||||
numberValue:1,
|
||||
timeData: {}, // 秒杀时间
|
||||
starValue: 4, // 评价星
|
||||
// carId:null, // 卡券id
|
||||
cardInfo:{},
|
||||
storeBackImage:'../../../static/images/app/serve/repair_refund.png',
|
||||
nowTime:'',
|
||||
// countInfo:{
|
||||
// remainingTime:'', // 距开始
|
||||
// endTime:'', // 距结束
|
||||
// countTime:'',
|
||||
// countTxt:'',
|
||||
// showCount:false,
|
||||
// }
|
||||
}
|
||||
},
|
||||
onLoad(query) {
|
||||
@@ -200,51 +194,69 @@
|
||||
let nowTime = Date.now(); // 2024-1-17
|
||||
let startTime = Date.parse(this.cardInfo.startTime);
|
||||
let stopTime = Date.parse(this.cardInfo.stopTime);
|
||||
// 计算距离开始还剩下的毫秒数
|
||||
// 距离开始还剩下毫秒数
|
||||
countInfo.remainingTime = startTime - nowTime;
|
||||
// 结束时间和现在时间比较
|
||||
// 距离结束
|
||||
countInfo.endTime = stopTime - nowTime
|
||||
|
||||
// 当 开始时间 > 现在时间
|
||||
// 当 开始 > 现在 (表示还未开始)
|
||||
if(startTime>nowTime){
|
||||
console.log('距离开始');
|
||||
countInfo.countTime=countInfo.remainingTime
|
||||
countInfo.showCount=true
|
||||
countInfo.btnType=1
|
||||
countInfo.countTxt='距开始'
|
||||
return countInfo
|
||||
}else if (startTime < nowTime && stopTime > nowTime ) {
|
||||
// 剩余时间小于0且结束时间大于现在时间,表示秒杀已经开始
|
||||
console.log('秒杀已经开始');
|
||||
countInfo.countTime=countInfo.endTime
|
||||
countInfo.showCount=true
|
||||
countInfo.btnType=2
|
||||
countInfo.countTxt='距结束'
|
||||
return countInfo
|
||||
}else if (startTime < nowTime && stopTime < nowTime) {
|
||||
// 开始时间<现在时间 结束时间<现在时间 (已经结束)
|
||||
console.log('已经结束111');
|
||||
countInfo.showCount=false
|
||||
countInfo.btnType=3
|
||||
}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
cardInfo:{
|
||||
handler(nV){
|
||||
console.log(nV,'监听cardInfo');
|
||||
},
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getCardProductInfo(){
|
||||
getCardProductInfoAPI(this.cardId).then(res=>{
|
||||
console.log(res,'卡券详情');
|
||||
// console.log(res,'卡券详情');
|
||||
this.cardInfo=res.data
|
||||
this.$store.dispatch('MerchantList', res.data.merchantList)
|
||||
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
buyBtn(){
|
||||
// 确认订单
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/cou_order`
|
||||
})
|
||||
buyBtn(num){
|
||||
if(num===0){
|
||||
// console.log('未开始');
|
||||
this.$toast('优惠活动即将开始,敬请等待')
|
||||
}else if (num===1){
|
||||
console.log('立即抢购');
|
||||
this.$store.dispatch('Goorderinfo', this.cardInfo)
|
||||
this.$store.dispatch('Cardmoney',null)
|
||||
// 确认订单
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/cou_order`
|
||||
})
|
||||
}else if (num===2){
|
||||
// console.log('已经结束');
|
||||
this.$toast('十分遗憾,优惠活动已经结束,请您关注下一轮活动')
|
||||
}else if (num===3){
|
||||
console.log('立即购买');
|
||||
this.$store.dispatch('Goorderinfo', this.cardInfo)
|
||||
this.$store.dispatch('Cardmoney',{})
|
||||
// 确认订单
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/cou_order`
|
||||
})
|
||||
}
|
||||
},
|
||||
toStorePages(){
|
||||
// console.log(this.cardInfo.merchantList,'123');
|
||||
@@ -268,16 +280,21 @@
|
||||
// 规格弹层
|
||||
openSpecs(){
|
||||
this.showSpecs=true
|
||||
this.specsValue=this.numberValue
|
||||
this.$set(this.cardInfo,'specsValue',this.specsValue)
|
||||
},
|
||||
specsChange(e){
|
||||
console.log(e,'数量');
|
||||
console.log(e,'数量变化');
|
||||
this.numberValue=e.value
|
||||
},
|
||||
closeSpecs(){
|
||||
this.showSpecs=false
|
||||
},
|
||||
specsBtn(){
|
||||
this.showSpecs=false
|
||||
this.specsValue=this.numberValue
|
||||
console.log(this.specsValue,'111111111111111111');
|
||||
this.$set(this.cardInfo,'specsValue',this.specsValue)
|
||||
},
|
||||
|
||||
// 秒杀时间
|
||||
@@ -288,7 +305,6 @@
|
||||
// 倒计时结束触发
|
||||
onFinish(){
|
||||
console.log('倒计时结束');
|
||||
this.countInfo.showCount=false
|
||||
},
|
||||
// nowTime
|
||||
getNowTime(){
|
||||
|
||||
@@ -3,26 +3,26 @@
|
||||
<view class="or_upall">
|
||||
<view class="or_info">
|
||||
<view class="info_l">
|
||||
<image class="l_img" src="@/static/images/app/serve/repair_refund.png" mode=""></image>
|
||||
<image class="l_img" :src="goorderinfo.image" mode=""></image>
|
||||
<view class="l_txt">
|
||||
<view class="txt_up"> 买车优惠券 </view>
|
||||
<view class="txt_con">
|
||||
<view class="txt_up"> {{ goorderinfo.name ? goorderinfo.name :'--' }} </view>
|
||||
<!-- <view class="txt_con">
|
||||
<text class="con" v-for="(item , index) in 3" :key="index"> 暗夜黑 </text>
|
||||
</view>
|
||||
<view class="txt_price"> ¥49.99 </view>
|
||||
</view> -->
|
||||
<view class="txt_price"> ¥{{ goorderinfo.price ? goorderinfo.price :'--' }} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info_r"> X 1 </view>
|
||||
<view class="info_r"> X {{ goorderinfo.specsValue ? goorderinfo.specsValue :'--' }} </view>
|
||||
</view>
|
||||
<view class="or_choose">
|
||||
<view class="onerow">
|
||||
<view class="row_l"> 商品金额 </view>
|
||||
<view class="row_r"> ¥49.99 </view>
|
||||
<view class="row_r"> ¥{{ goorderinfo.price ? goorderinfo.price :'--' }} </view>
|
||||
</view>
|
||||
<view class="tworow">
|
||||
<!-- <view class="tworow">
|
||||
<view class="row_l"> 门店 </view>
|
||||
<view class="row_r"> 杭州市余杭区莫干山路1665号 </view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="tworow">
|
||||
<view class="row_l"> 订单备注 </view>
|
||||
<view class="row_r"> <u-input v-model="orderInfo.desc" placeholder="选填" inputAlign='right' border="none"></u-input> </view>
|
||||
@@ -32,20 +32,22 @@
|
||||
<view class="or_coupon" @click="useCouponsBtn">
|
||||
<view class="coupon_l"> 使用优惠券 </view>
|
||||
<view class="coupon_r">
|
||||
<view class="r_bgc"> 2张可用 </view>
|
||||
<view class="r_bgc" v-if="usableNum && !cardmoney"> {{usableNum}}张可用 </view>
|
||||
<view class="r_bgc1" v-if="cardmoney"> -¥{{cardmoney.money?cardmoney.money:'--'}} </view>
|
||||
<view class="r_bgc2" v-if="!usableNum && !cardmoney"> 无 </view>
|
||||
<u-icon name="arrow-right" color="#999999" size="12"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="or_pay">
|
||||
<view class="pay_txt"> 共1件 合计:</view>
|
||||
<view class="pay_price"> ¥25.99 </view>
|
||||
<view class="pay_txt"> 共{{ goorderinfo.specsValue ? goorderinfo.specsValue :'--' }}件 合计:</view>
|
||||
<view class="pay_price"> ¥{{ (goorderinfo.specsValue?goorderinfo.specsValue:0) * (goorderinfo.price?goorderinfo.price:0)-(cardmoney.money?cardmoney.money:0) }} </view>
|
||||
<view class="pay_btn" @click="payBtn"> 去结算 </view>
|
||||
</view>
|
||||
<!-- 支付方式 -->
|
||||
<u-popup :show="topUpTypeShow" @close="topUpTypeClose" round="16" closeOnClickOverlay>
|
||||
<view class="top-up-popup">
|
||||
<view class="top-up-popup-allprice"> 合计:¥49.99 </view>
|
||||
<view class="top-up-popup-allprice"> 合计:¥{{ orderInfo.payPrice }} </view>
|
||||
<view class="top-up-popup-title">选择支付方式</view>
|
||||
<view>
|
||||
<view class="top-up-popup-type f-jcsb f-a-i" @click="actTypeFn('ye')">
|
||||
@@ -125,27 +127,82 @@
|
||||
|
||||
<script>
|
||||
import config from '@/config';
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getCouponListAPI , addOrderAPI , paycardAPI } from '@/api/serve/coupons'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
addOrderData:{
|
||||
cardProductId: null,
|
||||
userCouponId: 0,
|
||||
num: null
|
||||
},
|
||||
orderInfo: {
|
||||
desc: ''
|
||||
desc: '', // 备注
|
||||
from: "", // 支付平台
|
||||
orderNo: "", // 订单编号
|
||||
payChannel: "yue", // 支付渠道:public-公众号,mini-小程序,h5-网页支付,yue-余额,wechatIos-微信Ios,wechatAndroid-微信Android,alipay-支付包,alipayApp-支付宝App, video=视频号
|
||||
payType: "yue", // 支付方式:weixin,alipay,yue
|
||||
scene: 0 , // 下单时小程序的场景值
|
||||
},
|
||||
//当前类型
|
||||
topUpType: 'ye',
|
||||
money: null,
|
||||
topUpTypeShow: false,
|
||||
config
|
||||
couponData:{
|
||||
limit:20,
|
||||
page:1,
|
||||
type:'usable'
|
||||
},
|
||||
usableNum:null, // 可用优惠券
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
...mapGetters(['goorderinfo','cardmoney'])
|
||||
},
|
||||
onShow() {
|
||||
this.getCouponList()
|
||||
},
|
||||
methods: {
|
||||
getCouponList(){
|
||||
getCouponListAPI(this.couponData).then(res=>{
|
||||
this.usableNum=res.data.total
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
// 使用优惠券
|
||||
useCouponsBtn(){
|
||||
console.log('使用优惠券');
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/cou_card`
|
||||
})
|
||||
},
|
||||
// 去结算
|
||||
payBtn(){
|
||||
this.topUpTypeShow=true
|
||||
this.addOrderData.num=this.goorderinfo.specsValue
|
||||
this.addOrderData.cardProductId=this.goorderinfo.id
|
||||
this.addOrderData.userCouponId=this.cardmoney.id
|
||||
uni.showModal({
|
||||
title: "是否确认去结算 ",
|
||||
cancelText: "稍后再去",
|
||||
confirmText: "现在就去",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
addOrderAPI(this.addOrderData).then(res=>{
|
||||
console.log(res,'结算--创建订单');
|
||||
this.orderInfo.orderNo=res.data.orderNo
|
||||
this.orderInfo.payPrice=res.data.payPrice
|
||||
this.orderInfo.orderType=res.data.orderType
|
||||
this.topUpTypeShow=true
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log("用户点击取消");
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
topUpTypeClose() {
|
||||
this.topUpTypeShow = false
|
||||
@@ -153,13 +210,28 @@
|
||||
},
|
||||
payPopupBtn(){
|
||||
this.topUpTypeShow = false
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/payresult`
|
||||
console.log(this.orderInfo,'结算提交信息');
|
||||
paycardAPI(this.orderInfo).then(res=>{
|
||||
console.log(res,'支付返回数据');
|
||||
uni.navigateTo({
|
||||
url:`/pages/serve/coupons/payresult`
|
||||
})
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
//充值类型
|
||||
actTypeFn(type) {
|
||||
this.topUpType = type
|
||||
// 支付方式:weixin,alipay,yue
|
||||
if(type=='ye'){
|
||||
this.orderInfo.payType='yue'
|
||||
this.orderInfo.payChannel='yue'
|
||||
}if(type=='wx'){
|
||||
this.orderInfo.payType='weixin'
|
||||
}if(type=='zfb'){
|
||||
this.orderInfo.payType='alipay'
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
@@ -269,6 +341,20 @@
|
||||
background: #333333;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.r_bgc1 {
|
||||
padding: 5rpx 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #111111;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.r_bgc2 {
|
||||
padding: 5rpx 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
name:''
|
||||
},
|
||||
keyword:'', // 搜索
|
||||
cardType:null, // 卡券类型
|
||||
cardType:'', // 卡券类型
|
||||
cardProductList:[] // 卡券列表
|
||||
}
|
||||
},
|
||||
@@ -90,7 +90,7 @@
|
||||
console.log(item,'tabs点击');
|
||||
// item.name => 名字 item.value => 1,2,3
|
||||
if(item.value==1){
|
||||
this.cardType=null
|
||||
this.cardType=''
|
||||
}else{
|
||||
this.cardType=item.value
|
||||
}
|
||||
|
||||
@@ -32,5 +32,7 @@ const getters = {
|
||||
cardId:state=>state.tools.cardId,
|
||||
storeIds:state=>state.tools.storeIds,
|
||||
storeId:state=>state.tools.storeId,
|
||||
goorderinfo:state=>state.tools.goorderinfo,
|
||||
cardmoney:state=>state.tools.cardmoney,
|
||||
}
|
||||
export default getters
|
||||
|
||||
@@ -18,6 +18,8 @@ const tools = {
|
||||
cardId:null, // 卡券id
|
||||
storeIds: uni.getStorageSync('vuex_storeIds') || [], // 卡券页的门店
|
||||
storeId:null, // 卡券页的门店
|
||||
goorderinfo:{}, // 去确认订单信息
|
||||
cardmoney:{}, // 优惠券信息
|
||||
},
|
||||
|
||||
mutations: {
|
||||
@@ -84,6 +86,12 @@ const tools = {
|
||||
SET_STOREID: (state, storeId) => {
|
||||
state.storeId = storeId
|
||||
},
|
||||
SET_GOORDERINFO: (state, goorderinfo) => {
|
||||
state.goorderinfo = goorderinfo
|
||||
},
|
||||
SET_CARDMONEY: (state, cardmoney) => {
|
||||
state.cardmoney = cardmoney
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
@@ -93,7 +101,7 @@ const tools = {
|
||||
},
|
||||
StoreIds({ commit }, id) {
|
||||
console.log('vuex-storeIds', id);
|
||||
commit('SET_STOREIDS', id)
|
||||
commit('SET_GOORDERINFOS', id)
|
||||
},
|
||||
OrderIds({ commit }, id) {
|
||||
console.log('OrderIds', id);
|
||||
@@ -145,7 +153,15 @@ const tools = {
|
||||
},
|
||||
StoreId({ commit }, storeId) {
|
||||
console.log('vuex-storeId', storeId);
|
||||
commit('SET_STOREID', storeId)
|
||||
commit('SET_GOORDERINFO', storeId)
|
||||
},
|
||||
Goorderinfo({ commit }, goorderinfo) {
|
||||
console.log('vuex-goorderinfo', goorderinfo);
|
||||
commit('SET_GOORDERINFO', goorderinfo)
|
||||
},
|
||||
Cardmoney({ commit }, cardmoney) {
|
||||
console.log('vuex-cardmoney', cardmoney);
|
||||
commit('SET_CARDMONEY', cardmoney)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user