服务下单

dev
syt 1 year ago
parent 54be47c389
commit 0101b266e4
  1. 14
      api/newFun.js
  2. 1
      pages.json
  3. 5
      pages/activity/intimate.vue
  4. 5
      pages/news/article/classify.vue
  5. 199
      pages/news/recycling/confirm.vue
  6. 2
      pages/serve/index.vue

@ -1,5 +1,19 @@
import request from '@/utils/request'
// 服务 创建服务订单 服务订单支付信息
export const serverOrderInfo = (param) => {
return request.post('server/orderInfo', param)
}
// 服务 创建服务订单 余额支付
export const serverOrderPay = (param) => {
return request.post('server/orderPay', param)
}
// 服务 创建服务订单
export const serverCreateOrder = (param) => {
return request.post('server/createOrder', param)
}
// 服务 服务列表 查询优惠券
export const serverCheckOrder = (param) => {

@ -755,7 +755,6 @@
"path": "recycling/confirm",
"style": {
"navigationBarTitleText": "确认服务订单",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},

@ -34,7 +34,7 @@
{{a.server_name}}
</view>
<view class="price">
<view class="n"><text>{{a.server_price}}</text>到手价</view>
<view class="n"><text>{{a.server_price}}</text></view>
<view class="o">{{a.line_price}}</view>
</view>
<view class="desc">
@ -66,6 +66,7 @@
tabIndex1: 1,
tabIndex: -1,
filterIndex: 0,
storeInfo: {},
keyword: "",
list: [],
list1: [],
@ -142,7 +143,7 @@
<style lang="scss" scoped>
.intimate{
background: url(@/static/news/refund-bg1.png) center top no-repeat;
background: url(@/static/news/refund-bg1.png) center 1 no-repeat;
background-size: 100% auto;
&-hd{
width: 686rpx;

@ -42,11 +42,6 @@
methods: {
//
async toSubmit(){
<<<<<<< HEAD
=======
>>>>>>> 4695f64d55504ed0b399d0d36c0a361b12d8aaee
},
}

@ -56,14 +56,16 @@
<view class="item">
<view class="a">服务时间</view>
<view class="b" @click="openPage(1)">
<view class="select">{{server_time?server_time:'请选择预约到店时间'}}</view>
<view class="select" :class="server_time?'select-on':''">{{server_time?server_time:'请选择预约到店时间'}}</view>
<u-icon style="margin-left: 10rpx;" name="arrow-right"></u-icon>
</view>
</view>
<view class="item">
<view class="a">优惠券</view>
<view class="b" @click="openPage(2)">
<view class="select" :class="couponIndex >= 0?'select-on':''">{{couponIndex >= 0? couponList[couponIndex].name:'暂无优惠券'}}</view>
<view class="select" :class="couponIndex >= 0?'select-on':''">
{{couponIndex >= 0? couponList[couponIndex].name:(couponList.length > 0?'请选择优惠券':'暂无优惠券')}}
</view>
<u-icon style="margin-left: 10rpx;" name="arrow-right"></u-icon>
</view>
</view>
@ -100,13 +102,22 @@
</view>
</view>
<view class="item" v-if="type == 1">
<view class="a">发件地址</view>
<view class="a">所在城市</view>
<view class="b">
<picker :value="region" @change="changeRegion" mode="region">
<view class="select">请选择所在人城市</view>
<picker @change="changeRegion" mode="region">
<view class="select" :class="region.length>0?'select-on':''">
{{
region.length > 0?region[0]+region[1]+region[2]:'请选择所在人城市'
}}</view>
</picker>
</view>
</view>
<view class="item" v-if="type == 1">
<view class="a">详细地址</view>
<view class="b">
<input class="box" v-model="address" type="text" placeholder="例:12幢1单元102室" />
</view>
</view>
<view class="item" v-if="tabIndex == 3">
<view class="a">门牌号</view>
<view class="b">
@ -133,9 +144,9 @@
<view class="remark" style="margin-top: 20rpx;">
<view class="name">备注 </view>
<view class="xu">
<view class="li">可提前来</view>
<view class="li">来之前打电话</view>
<view class="li">请尽快联系我</view>
<view class="li" @click="openPage(5,'可提前来')">可提前来</view>
<view class="li" @click="openPage(5,'来之前打电话')">来之前打电话</view>
<view class="li" @click="openPage(5,'请尽快联系我')">请尽快联系我</view>
</view>
<view class="content">
<u-input v-model="remake" height="260" type="textarea" placeholder="请输入您的留言,最多可留言100字" :border="true" />
@ -146,8 +157,10 @@
<view class="recycling-fd">
<view class="a" v-if="type==2">免支付预购</view>
<view class="c" v-else style="color: #FE483B;font-size: 30rpx;">{{pay_price}}</view>
<view class="b" @click="openPage(2)">提交订单</view>
<view class="b" @click="openPage(3)">提交订单</view>
</view>
<!-- 微信支付方式 -->
<u-action-sheet :list="list2" v-model="show2" @click="clickPay" @close="closeAction"></u-action-sheet>
<!-- 选择优惠券 -->
<u-popup v-model="isShow" mode="bottom" border-radius="12" mask-close-able="false" closeable>
<view class="recycling-classify">
@ -155,7 +168,7 @@
<view class="recycling-classify-bd">
<scroll-view scroll-y class="m">
<view class="item" @click="tabMItem('-9999')"><view :class="couponIndex == -9999?'item-on':''">不使用</view></view>
<view class="item" v-for="(a,i) in couponList" @click="tabMItem(i)"><view :class="couponIndex == i?'item-on':''">{{a.name}}</view></view>
<view class="item" v-for="(a,i) in couponList" :key="i" @click="tabMItem(a,i)"><view :class="couponIndex == i?'item-on':''">{{a.name}}</view></view>
</scroll-view>
</view>
</view>
@ -177,11 +190,16 @@
minute: true,
second: true
},
userInfo: {},
orderInfo: {},
list2: [],
pay_price: 0,
show2: true,
isShow: false,
show: false,
info: {},
type: 1,
isClick: true,
radioValue: "男士",
couponIndex: -9999,
tabIndex: 1,
@ -199,7 +217,8 @@
server_time: "",
region: [],
couponList: [],
server_id: ""
server_id: "",
order_id: ""
}
},
onLoad(o) {
@ -210,8 +229,23 @@
}
},
methods: {
tabMItem(i) {
clickPay(i){
if(this.list2[i].method == "balance"){
console.log(this.orderInfo.pay_price <= this.userInfo.balance)
console.log(this.orderInfo.pay_price , this.userInfo.balance)
if(Number(this.orderInfo.pay_price) <= Number(this.userInfo.balance)){
this.toPay()
}else{
uni.showToast({
icon: "none",
title: "余额不足,请选择其他支付方式"
})
}
}
},
tabMItem(a,i) {
this.couponIndex = i
this.coupon_id = a.coupon_id
this.isShow = false;
this.getServerCheckOrder(1)
},
@ -224,38 +258,161 @@
if(status == 200){
this.info = data.info
this.couponList= data.coupon_list;
if(data.coupon_list && data.coupon_list.length > 0){
if(!type){
this.couponIndex = 0
}
}else{
this.couponIndex = -9999
}
this.coupon_id= data.coupon_id
this.coupon_money= data.coupon_money
this.pay_price= data.pay_price
}
},
closeAction() {
uni.redirectTo({
url: "/pages/news/recycling/order"
})
},
confirm(e){
this.server_time = e.year+"-"+e.month+'-'+e.day+" "+e.hour+"-"+e.minute+'-'+e.second
},
changeRegion(e) {
this.region = e
console.log(e)
this.region = e.detail.value
},
tabItem(i) {
this.tabIndex = i
},
openPage(i){
openPage(i,a){
if(i == 1){
this.show = true
}else if(i == 2) {
this.isShow = true
}else if(i == 3) {
if(this.orderInfo.pay_price){
this.show2 = true
return ;
}
if(!this.server_time){
uni.showToast({
icon: "none",
title: "服务时间不能为空"
})
return ;
}
if(!this.username){
uni.showToast({
icon: "none",
title: "联系人不能为空"
})
return ;
}
if(!this.mobile){
uni.showToast({
icon: "none",
title: "联系号码不能为空"
})
return ;
}
if(this.region.length == 0){
uni.showToast({
icon: "none",
title: "请选择所在城市"
})
return ;
}
if(!this.address){
uni.showToast({
icon: "none",
title: "详细地址不能为空"
})
return ;
}
if(this.isClick == false){
return;
}
this.isClick = false;
this.toServerCreateOrder();
}else if(i == 5){
this.remake = a
}else {
uni.redirectTo({
url: "/pages/news/recycling/order"
})
}
},
//
async toPay() {
const {status, message} = await newFunApi.serverOrderPay({
order_id: this.order_id,
method: 'balance',
client: "MP-WEIXIN",
})
if(status == 200) {
uni.showToast({
title: "支付成功"
})
setTimeout(()=>{
uni.redirectTo({
url: "/pages/news/recycling/order"
})
},1000)
}else{
uni.showToast({
icon: "none",
title: message
})
}
},
//
async toServerCreateOrder() {
let {status, data, message } = await newFunApi.serverCreateOrder({
server_id: this.server_id,
client: 'MP-WEIXIN',
server_address: this.region[0]+this.region[1]+this.region[2]+this.address,
server_time: this.server_time,
coupon_id: this.coupon_id,
remake: this.remake,
username: this.username,
mobile: this.mobile,
})
if(status == 200){
this.isClick = true
this.order_id = data.order_id
this.toServerOrder(data.order_id)
}else{
this.isClick = true
uni.showToast({
icon: "none",
title: message
})
}
},
//
async toServerOrder(order_id) {
let {status, data, message } = await newFunApi.serverOrderInfo({
client: 'MP-WEIXIN',
order_id
})
if(status == 200){
this.isClick = true
this.userInfo = data.personal
this.orderInfo = data.order
if(data.paymentMethods && data.paymentMethods.length > 0){
data.paymentMethods.map(a=>{
if(a.method=='wechat'){
a.text = "微信支付"
}else if(a.method=='balance'){
a.text = "余额支付"+"(余额:"+data.personal.balance+"元)"
}
})
}
this.list2 = data.paymentMethods;
this.show2 = true;
}else{
this.isClick = true
uni.showToast({
icon: "none",
title: message
})
}
},
}
}
</script>

@ -67,7 +67,7 @@
list: []
}
},
onReady() {
mounted() {
this.getList();
},
methods:{

Loading…
Cancel
Save