diff --git a/api/newFun.js b/api/newFun.js index 6169038..30d2462 100644 --- a/api/newFun.js +++ b/api/newFun.js @@ -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) => { diff --git a/pages.json b/pages.json index 3555750..af28bd7 100644 --- a/pages.json +++ b/pages.json @@ -755,7 +755,6 @@ "path": "recycling/confirm", "style": { "navigationBarTitleText": "确认服务订单", - "navigationStyle": "custom", "enablePullDownRefresh": false } }, diff --git a/pages/activity/intimate.vue b/pages/activity/intimate.vue index ad08163..660ae60 100644 --- a/pages/activity/intimate.vue +++ b/pages/activity/intimate.vue @@ -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"> @@ -65,7 +65,8 @@ isShow: false, tabIndex1: 1, tabIndex: -1, - filterIndex: 0, + 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; diff --git a/pages/news/article/classify.vue b/pages/news/article/classify.vue index 70135c8..f941869 100644 --- a/pages/news/article/classify.vue +++ b/pages/news/article/classify.vue @@ -41,12 +41,7 @@ }, methods: { //提交修改 - async toSubmit(){ -<<<<<<< HEAD - -======= - ->>>>>>> 4695f64d55504ed0b399d0d36c0a361b12d8aaee + async toSubmit(){ }, } diff --git a/pages/news/recycling/confirm.vue b/pages/news/recycling/confirm.vue index 04b47e3..0f8ceff 100644 --- a/pages/news/recycling/confirm.vue +++ b/pages/news/recycling/confirm.vue @@ -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> @@ -94,18 +96,27 @@ <view class="item" v-if="tabIndex == 3"> <view class="a">发件地址</view> <view class="b"> - <picker mode="region"> + <picker mode="region"> <view class="select">请选择所在人城市</view> </picker> </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> @@ -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, + 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,37 +258,160 @@ 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 + }) + } }, } } diff --git a/pages/serve/index.vue b/pages/serve/index.vue index 04a2a8b..edefe77 100644 --- a/pages/serve/index.vue +++ b/pages/serve/index.vue @@ -18,7 +18,7 @@ 我的服务 </view> <scroll-view scroll-x class="serveList"> - <view class="listItem" v-for="(a,i) in list" :key="i" @click="openPage(i)"> + <view class="listItem" v-for="(a,i) in list" :key="i" @click="openPage(i)"> <view class="itemImage"> <image :src="a.image_url" class="itemImage"></image> </view> @@ -67,7 +67,7 @@ list: [] } }, - onReady() { + mounted() { this.getList(); }, methods:{