待支付订单支付

This commit is contained in:
2021-11-30 16:54:05 +08:00
parent 00677377ca
commit bb9f67d3f8
26 changed files with 879 additions and 598 deletions
+42 -15
View File
@@ -105,14 +105,14 @@
<ul class="spec brick-spec">
<li class="random">
<span class="border-circle" :class="[is_assign && 'active']" @click="onCustomeBrike">{{data.rule_btn}}</span>
<van-stepper v-model="buy_quantity" step="1" />
<van-stepper v-model="buy_quantity" step="1" v-if="is_assign" />
</li>
<li v-for="(spec, index) in data.spec" :key="index">
<span
class="border-circle"
:class="[Number(spec.money) === priceUnit && !is_assign && 'active']"
@click="onPriceUnit(spec)"
>认捐{{spec.donate_number}}块砖 {{spec.money}}元</span>
>{{spec.spec_name}} {{spec.donate_number * Number(data.price)}}元</span>
</li>
</ul>
<div class="auto-donate">
@@ -126,7 +126,7 @@
<div class="donate">
<span class="label">行善时间</span>
<span class="time-cycle">
<van-stepper v-model="number" step="1" />
<van-stepper v-model="monthQuantity" step="1" />
<span class="unit">个月</span>
</span>
</div>
@@ -134,7 +134,7 @@
<div class="next-group-wrapper">
<safe-area>
<div class='next-group'>
<span class="total">合计:¥{{priceTotal}}</span>
<span class="total">合计:<em>¥{{priceTotal}}</em></span>
<button class="next" @click="onToPay">下一步</button>
</div>
</safe-area>
@@ -179,7 +179,7 @@ export default {
showSpec: false,
priceUnit: 0,
priceUnitId: '',
number: 1,
monthQuantity: 1,
is_assign: false, // 是否为自动认捐砖块数
buy_quantity: 1, // 自定义认捐砖块数
goodsDynamicList: [], // 商品动态列表
@@ -195,14 +195,17 @@ export default {
},
computed: {
priceTotal(){
if(this.is_auto){
return (parseInt(this.priceUnit * 100, 10) * this.number * 30) / 100
const { priceUnit, is_assign, is_auto, buy_quantity, monthQuantity } = this;
if(is_assign){
return (priceUnit * 100 * buy_quantity) / 100;
}
return (parseInt(this.priceUnit * 100, 10) * this.number) / 100;
if(is_auto){
return (priceUnit * 100 * monthQuantity * 30) / 100
}
return (priceUnit * 100 ) / 100;
}
},
mounted(){
console.log('query', this.query)
if(this.query.goods_type === '1'){
return this.getGoodsDetail('friendly');
}
@@ -212,6 +215,22 @@ export default {
},
methods: {
getSelectedSpec() {
if(this.query.goods_type === '2'){
// 随喜
if(this.is_assign){
return {
specId: '',
specName: this.data.rule_btn
}
}
const spec = this.data.spec.find(item => item.id === this.priceUnitId);
return {
specId: spec.id,
specName: spec.spec_name,
}
}
},
// 获取商品详情
/*
type = friendly: 获取日行一善商品
@@ -226,6 +245,7 @@ export default {
}
await this.getDynamicDataByGoodsId(goods_id);
this.data = response;
this.priceUnit = this.data.spec[0].donate_number * Number(this.data.price)
},
async getDynamicDataByGoodsId(goods_id){
const res = await getDynamicData(1, goods_id);
@@ -245,6 +265,7 @@ export default {
onPriceUnit({id, money}){
this.priceUnit = Number(money);
this.priceUnitId = id;
this.buy_quantity = 1;
if(this.query.goods_type === '2'){
this.is_assign = false;
}
@@ -257,9 +278,9 @@ export default {
...this.$route.query,
is_auto: this.is_auto ? 1 : 0,
spec_id: this.priceUnitId,
friendly_time: this.number,
friendly_time: this.monthQuantity,
title: this.title,
subTitle: this.data.name,
subTitle: this.data.spec.find(item => item.id === this.priceUnitId).spec_name,
amount: this.priceTotal,
is_customized: 0,
from: 'friendly_day', // 标识为日行一善
@@ -273,10 +294,11 @@ export default {
...this.$route.query,
is_auto: this.is_auto ? 1 : 0,
is_assign: this.is_assign ? 1 : 0,
spec_id: this.priceUnitId,
friendly_time: this.number,
title: this.title,
subTitle: this.data.name,
spec_id: this.getSelectedSpec().specId,
friendly_time: this.monthQuantity,
quantity: this.buy_quantity,
title: this.data.name,
subTitle: this.getSelectedSpec().specName,
amount: this.priceTotal,
is_customized: 0,
buy_quantity: this.buy_quantity,
@@ -425,6 +447,11 @@ export default {
.total{
font-size: .4rem;
em{
color: $primary-color;
font-size: .4rem;
font-weight: bold;
}
}
.next{
font-size: .4rem;
+3 -1
View File
@@ -141,9 +141,11 @@ export default {
border: none;
}
.input[type=textarea]{
min-height: 3rem;
min-height: 2rem;
width: calc(100% - .5rem);
padding-right: .5rem;
line-height: 1.4;
text-align: justify;
}
.icon-arrow-right{
position: absolute;
@@ -41,7 +41,7 @@
</template>
<script>
import { getDreamList } from '@/api';
import { getDreamList, getMeritName } from '@/api';
export default {
data(){
@@ -83,7 +83,10 @@ export default {
this.onConfirmMeritName();
},
async getName() {
const data = await getMeritName();
this.names = data;
},
//获取心愿列表
async getDreamList(){
const list = await getDreamList();
@@ -103,13 +106,11 @@ export default {
}
.add-name{
display: flex;
.input{
flex: 1;
height: .8rem;
line-height: .8rem;
padding-left: .3rem;
font-size: .35rem;
border: 1px solid #ddd;
border-radius: .11rem;
font-size: .4rem;
@@ -2,7 +2,6 @@
<span>
<ul class="spec-group">
<li class="border-circle" :class="[value === 'is_customized' && 'active']" @click="onAnyAmount">
<span>随喜参与法会</span>
<span>{{data.rule_btn}}</span>
</li>
<li class="border-circle" v-for="spec in data.spec" :key="spec.id" :class="[ value === spec.id && 'active']" @click="onSelectSpec(spec)">
+32 -26
View File
@@ -43,9 +43,9 @@
<div class="head">
<span>参与流程: </span>
<ul class="step-inline">
<li :class="[ current === 0 && 'current']" @click="current = 0">选择类型</li>
<li :class="[ current === 1 && 'current']" @click="current = 1">填写信息</li>
<li :class="[ current === 2 && 'current']" >参与成功</li>
<li :class="[ current === 0 && 'current']">选择类型</li>
<li :class="[ current === 1 && 'current']">填写信息</li>
<li :class="[ current === 2 && 'current']">参与成功</li>
</ul>
</div>
<transition>
@@ -55,7 +55,7 @@
</template>
</transition>
<div class="next-group">
<span class="total">合计:¥{{priceTotal}}</span>
<span class="total">合计:<em>¥{{priceTotal}}</em></span>
<button class="next" @click="onNextStep">下一步</button>
</div>
</div>
@@ -139,7 +139,7 @@ export default {
// 接收随喜金额
onReceiveAnyAmount(anyObj){
this.anyPrice = anyObj.money;
this.onNextStep();
this.onToFillMeritName();
},
// dreamInfo: 心愿信息
onDreamInfoChange(dreamInfo){
@@ -158,34 +158,35 @@ export default {
return;
}
this.current += 1;
if(this.current === 1 && this.spec_id === 'is_customized'){
if( this.spec_id === 'is_customized'){
this.showAnyAmount = true;
return ;
}
const selectedSpec = this.getSelectedSpec();
this.current += 1;
if(this.current > 0){
this.$router.push({
name: 'fill-name',
query: {
...this.query,
is_auto: this.is_auto ? 1 : 0,
spec_id: selectedSpec.id,
friendly_time: this.number,
quantity: this.quantity,
title: this.data.name,
subTitle: selectedSpec.spec_name,
amount: this.priceTotal,
// merit_name_id: ,
is_customized: 0,
from: 'common_goods', // 标识为通用商品
}
})
this.onToFillMeritName();
}
},
onToFillMeritName(){
const selectedSpec = this.getSelectedSpec();
this.$router.push({
name: 'fill-name',
query: {
...this.query,
is_auto: this.is_auto ? 1 : 0,
spec_id: selectedSpec.id,
friendly_time: this.number,
quantity: this.quantity,
title: this.data.name,
subTitle: selectedSpec.spec_name,
amount: this.priceTotal,
is_customized: this.spec_id === 'is_customized' ? 1 : 0,
from: 'common_goods', // 标识为通用商品
}
})
},
async getGoodsDetail(type){
const { goods_id, temple_id } = this.$route.query;
const response = await getGoodsDetail(type, goods_id, temple_id);
@@ -370,6 +371,11 @@ export default {
border-top: 1px solid #ededed;
.total{
font-size: .4rem;
em{
color: $primary-color;
font-size: .4rem;
font-weight: bold;
}
}
.next{
font-size: .4rem;
+22 -6
View File
@@ -28,20 +28,20 @@
</div>
</div>
<div class="divider"></div>
<div class="panel">
<div class="panel" v-if="data.common_data.length">
<div class="panel-head">
<span class="title">功德无量</span>
<arrow-more @click="$router.push({ name: 'merit-list', query: { temple_id: query.temple_id } })"></arrow-more>
</div>
<div class="panel-body">
<van-swipe class="merit-group" :width="140" :loop="false" :show-indicators="false">
<van-swipe-item v-for="goods in data.common_data" :key="goods.id">
<div class="merit" @click="onToGoods(goods)">
<div class="merit-scroll-container">
<div class="merit-scroll-wrapper">
<div class="merit" v-for="goods in data.common_data" :key="goods.id" @click="onToGoods(goods)">
<img :src="goods.cover_url" alt="" />
<p class="title">{{ goods.alias }}</p>
</div>
</van-swipe-item>
</van-swipe>
</div>
</div>
</div>
</div>
<div class="divider"></div>
@@ -67,17 +67,25 @@
import { getTempleIndex } from '@/api';
export default {
components: {
},
data() {
return {
query: this.$route.query,
value: '',
data: null,
mescrollDown: {},
mescrollUp: {},
mescroll: null,
};
},
mounted() {
this.getTempleIndex();
},
methods: {
mescrollInit(mescroll){
this.mescroll = mescroll;
},
onToGoods(goods){
this.$router.push({
name: 'goods-detail',
@@ -180,6 +188,14 @@ export default {
}
}
}
.merit-scroll-container{
margin: 0 .4rem;
height: 3.39rem;
overflow-x: auto;
.merit-scroll-wrapper{
white-space: nowrap;
}
}
.merit-group{
padding-bottom: .4rem;
}
+34 -8
View File
@@ -16,11 +16,11 @@
<b class="sub-title">{{info.unit_name}}</b>
</span>
<div class="list">
<span :class="[n.id === type_id && 'current']" v-for="n in nav" :key="n.id">{{n.title}}</span>
<span :class="[n.id === type_id && 'current']" v-for="(n, index) in nav" :key="n.id" @click="onListBy(n, index)">{{n.title}}</span>
</div>
</div>
<div class="body">
<swiper class="swiper-container" :options="SwiperOption" ref="swiper" @change="onSwiperChange">
<swiper class="swiper-container" :options="SwiperOption" ref="swiper" @swiper="onSwiper" @slideChange="onSlideChange">
<swiper-slide v-for="swipe in nav" :key="swipe.id">
<scroll-view
:height="containerHeight - 20"
@@ -45,8 +45,14 @@
<script>
import { getMeritBox } from "@/api";
import { swiper, swiperSlide } from 'vue-awesome-swiper';
export default {
components: {
swiper,
swiperSlide
},
data(){
return {
query: this.$route.query,
@@ -76,26 +82,46 @@ export default {
}
}
},
computed: {
swiper(){
return this.$refs.swiper.swiper;
}
},
mounted(){
this.width = window.innerWidth;
console.log(this.$refs.swiper)
this.containerHeight = this.$refs.swiper.$el.offsetHeight;
this.getMeritBox();
this.$nextTick(() => {
})
},
methods: {
onSwiperChange(e){
console.log(e)
},
onSwiper(swiper){
console.log('on swiper', swiper)
},
onSlideChange(){
const { activeIndex } = this.swiper;
const { id } = this.nav[activeIndex];
this.type_id = id;
this.getMeritBox()
},
async getMeritBox(){
const current = this.nav.find(item => item.id === this.type_id);
const res = await getMeritBox(this.query.temple_id || '1', current.id, current.page, current.size);
this.info = res.merit_box_info;
// this.list = res.merit_box_order.list;
this.total = res.merit_box_order.total;
current.list = res.merit_box_order.list
this.total = res.merit_box_order.total
const query = this.$utils.setSearchParamsFromObj({ ...this.$route.query, temple_id: this.info.temple_id });
if(!this.$route.query.temple_id){
history.pushState('', '', location.href + query)
}
},
onListBy(n, index){
this.type_id = n.id;
this.swiper.slideTo(index, 300, false)
this.getMeritBox();
},
loadMore(){
console.log('加载更多')
const current = this.nav.find(item => item.id === this.type_id);
+5 -3
View File
@@ -32,7 +32,8 @@
</div>
<div class="pay-button-container">
<van-button block type="primary" round class="pay-button" @click="onCreatePayOrder">确认支付</van-button>
<van-button v-if="query.order_id" block type="primary" round class="pay-button" @click="onContinuePayOrder">确认支付</van-button>
<van-button v-else block type="primary" round class="pay-button" @click="onCreatePayOrder">确认支付</van-button>
</div>
</div>
</div>
@@ -52,12 +53,14 @@ export default {
}
},
methods: {
onContinuePayOrder(){
this.onPayment({ id: this.query.order_id })
},
async onCreatePayOrder(){
// 创建日行一善支付订单
if(this.query.goods_type == '1'){
const request = {
...this.query,
}
const order = await createFriendlyDayOrder(request)
this.onPayment(order)
@@ -99,7 +102,6 @@ export default {
},
async onPayment(order){
console.log(order)
const result = await createPay(order.id);
const payResult = await requestPayment(result)
await this.$router.push({
+21 -2
View File
@@ -94,6 +94,8 @@
</div>
</div>
<button class="temple-station-in" @click="onTempleStation">寺院入驻</button>
</div>
<div class="panel-menu-btn" @click="showUserMenu = true">
@@ -101,6 +103,7 @@
<span class="menu-text">菜单</span>
</div>
<van-popup v-model="showUserMenu" position="left" style="width: 80%; height: 100%">
<div class="user-menu" v-if="user">
<div class="user">
@@ -158,7 +161,6 @@ export default {
},
async getUserData(){
const res = await getUserData();
console.log(res);
this.user = res;
},
onToGoods(goods) {
@@ -175,6 +177,9 @@ export default {
this.data = res;
this.data.icon_data = this.sliceNav(res.icon_data);
},
onTempleStation(){
this.$router.push({ name: 'user-temple-station'})
},
sliceNav(navData) {
const nav = [];
const slice = 8;
@@ -183,6 +188,7 @@ export default {
const b = navData.slice(i * slice, i * slice + slice);
nav.push(b);
}
return nav;
},
onMoreDynamic() {
@@ -196,6 +202,20 @@ export default {
.van-nav-bar__title {
color: white;
}
.temple-home-page{
.temple-station-in{
font-size: .4rem;
background: $primary-color;
color: white;
border: 1px solid $primary-color;
padding: .3rem .6rem;
border-radius: 1rem;
margin-left: auto;
margin-right: auto;
margin-top: 1rem;
display: block;
}
}
.van-popup {
.put-away {
@@ -474,7 +494,6 @@ export default {
.merit-group {
display: flex;
width: 11.36rem;
margin-bottom: .91rem;
}
}
}
+8 -8
View File
@@ -12,14 +12,14 @@
<span class="iconfont icon-dingwei"></span>
<span>重新定位</span>
</div>
<div class="show-mode" v-if="mode === 'list'" @click="onModeSwitch('map')">
<span>地图模式</span>
<span class="iconfont icon-ditu"></span>
</div>
<div class="show-mode" v-if="mode === 'map'" @click="onModeSwitch('list')">
<span>列表模式</span>
<span class="iconfont icon-liebiao"></span>
</div>
<!-- <div class="show-mode" v-if="mode === 'list'" @click="onModeSwitch('map')">-->
<!-- <span>地图模式</span>-->
<!-- <span class="iconfont icon-ditu"></span>-->
<!-- </div>-->
<!-- <div class="show-mode" v-if="mode === 'map'" @click="onModeSwitch('list')">-->
<!-- <span>列表模式</span>-->
<!-- <span class="iconfont icon-liebiao"></span>-->
<!-- </div>-->
</div>
</div>
<div >
+16 -7
View File
@@ -11,7 +11,7 @@
</div>
</template>
<template v-if="!authing">
<van-notice-bar ext="真实法师社区,法师身份认证审核通过后才能使用" />
<van-notice-bar text="真实法师社区,法师身份认证审核通过后才能使用" />
<van-form @submit="onSubmit">
<van-field
v-model="form.nickname"
@@ -66,7 +66,7 @@
placeholder="向他人展示自己的文字说明"
:rules="[{ required: true }]"
maxlength="500"
:rows="8"
:rows="4"
show-word-limit
/>
<div style="margin: 16px;">
@@ -120,9 +120,16 @@ export default {
this.getParams();
},
methods: {
async onSubmit(e){
console.log(e);
const [province_id, city_id, county_id] = this.form.city_id;
async onSubmit(){
const { form } = this;
const [province_id, city_id, county_id] = form.city_id;
const { avatar_url, cert_url } = form;
if(!avatar_url.length){
return this.$toast.fail('请上传头像照片');
}
if(!cert_url.length){
return this.$toast.fail('请上传戒牒照片')
}
const params = {
...this.form,
avatar_url: this.form.avatar_url[0].url,
@@ -134,7 +141,7 @@ export default {
await certifyMonk(params)
this.$toast.success('认证信息提交成功')
await this.$delay(2000)
this.$router.replace({ name: 'user-temple-station-review'})
await this.$router.replace({ name: 'user-temple-station-review'})
},
getParams(){
@@ -187,4 +194,6 @@ export default {
}
}
}
</style>
</style>
<!-- IE11 -->