Commit ba255664 by YG8999

下单调用微信支付

parent 968d0f58
const CONFIG = { const CONFIG = {
// 开发环境配置 // 开发环境配置
development: { development: {
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径 assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径
baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址 baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址) hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址)
// baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址 // baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址
// hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址) // hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
...@@ -13,9 +13,9 @@ const CONFIG = { ...@@ -13,9 +13,9 @@ const CONFIG = {
}, },
// 生产环境配置 // 生产环境配置
production: { production: {
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径 assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径
baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址 baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址) hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
weixinAppId: '', // 微信公众号appid weixinAppId: '', // 微信公众号appid
codeHeadUrl:"", codeHeadUrl:"",
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</view> </view>
<view class="room-box"> <view class="room-box">
<view v-for="(val,k) in item.roolList" :key='k' class="room-item" :class="val.status==3?'bg-blue':val.status==2?'bg-red':'bg-gray'" @tap='onNavSearch(val)'> <view v-for="(val,k) in item.roolList" class="room-item" :class="val.status==3?'bg-blue':val.status==2?'bg-red':'bg-gray'">
<view class="room-name"> <view class="room-name">
<text>{{val.name}}</text> <text>{{val.name}}</text>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<text>{{val.roomName}}</text> <text>{{val.roomName}}</text>
</view> --> </view> -->
<view class="room-stauts margin-top"> <view class="room-stauts margin-top">
<text>{{ [0,1].includes(val.recordsStatus)?cleanStatusEnum[val.recordsStatus]: statusEnum[val.status]}}</text> <text>{{statusEnum[val.status]}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -65,9 +65,7 @@ ...@@ -65,9 +65,7 @@
<script> <script>
import {getListStore,getStarOrder} from "@/api/cleanRoom.js"; import {getListStore,getStarOrder} from "@/api/cleanRoom.js";
import config from "@/config/index.config" import config from "@/config/index.config"
import {
getDictItem
} from "@/utils/tools.js"
export default { export default {
data() { data() {
return { return {
...@@ -78,29 +76,13 @@ ...@@ -78,29 +76,13 @@
1:'使用中', 1:'使用中',
2:'待保洁', 2:'待保洁',
3:'保洁中' 3:'保洁中'
}, }
cleanStatusEnum:{}
}; };
}, },
onShow() { onLoad() {
this.onGetDicts()
},
methods:{
onGetDicts() {
let dicts = []
if (uni.getStorageSync('dicts')) {
dicts = JSON.parse(uni.getStorageSync('dicts'))
this.cleanStatusEnum = getDictItem(dicts, "clean_records_status");
this.onLoading()
} else {
dictList().then(res => {
dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.cleanStatusEnum = getDictItem(dicts, "clean_records_status");
this.onLoading() this.onLoading()
})
}
}, },
methods:{
onLoading(){ onLoading(){
getListStore().then(res=>{ getListStore().then(res=>{
console.log(res) console.log(res)
...@@ -114,7 +96,7 @@ ...@@ -114,7 +96,7 @@
console.log(res,"查询保洁中的订单") console.log(res,"查询保洁中的订单")
if(res.data.code === 200){ if(res.data.code === 200){
uni.navigateTo({ uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+res.data.data.id url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+res.data.data
}) })
}else{ }else{
uni.showToast({ uni.showToast({
...@@ -140,13 +122,6 @@ ...@@ -140,13 +122,6 @@
uni.navigateTo({ uni.navigateTo({
url:"/pages/cleanRecord/index" url:"/pages/cleanRecord/index"
}) })
},
onNavSearch(val){
if(val.recordsStatus == 0){
uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+val.recordsId
})
}
} }
} }
} }
......
...@@ -27,44 +27,21 @@ ...@@ -27,44 +27,21 @@
<view class="cu-bar bg-white margin-top"> <view class="cu-bar bg-white margin-top">
<view class="action"> <view class="action">
开始拍照上传 拍照上传
</view> </view>
<view class="action"> <view class="action">
{{orderInfo.startImage? orderInfo.startImage.length:'0'}}/4 {{imgList.length}}/4
</view> </view>
</view> </view>
<view v-if="orderInfo.startImage" class="cu-form-group"> <view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in orderInfo.startImage" :key="index" @tap="ViewImage('start',item)">
<image :src="item" mode="aspectFill"></image>
<view v-if="orderInfo.status === 0 " class="cu-tag bg-red" @tap.stop="DelImg('start',index)" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view v-if="orderInfo.status === 0 && imgList.length<4" class="solids" @tap="onChooseImage">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
<view v-if="orderInfo.status>=1" class="cu-bar bg-white margin-top">
<view class="action">
结束拍照上传
</view>
<view class="action">
{{orderInfo.endImage?orderInfo.endImage.length:'0'}}/4
</view>
</view>
<view v-if="orderInfo.status>=1" class="cu-form-group">
<view class="grid col-4 grid-square flex-sub"> <view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in orderInfo.endImage" :key="index" @tap="ViewImage('end',item)" > <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
<image :src="item" mode="aspectFill"></image> <image :src="imgList[index]" mode="aspectFill"></image>
<view v-if="orderInfo.status == 1" class="cu-tag bg-red" @tap.stop="DelImg('end',index)" :data-index="index"> <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
<text class='cuIcon-close'></text> <text class='cuIcon-close'></text>
</view> </view>
</view> </view>
<view v-if="orderInfo.status == 1 && imgList.length<4 " class="solids" @tap="onChooseImage"> <view class="solids" @tap="onChooseImage" v-if="imgList.length<4">
<text class='cuIcon-cameraadd'></text> <text class='cuIcon-cameraadd'></text>
</view> </view>
</view> </view>
...@@ -72,7 +49,7 @@ ...@@ -72,7 +49,7 @@
<view class="cu-form-group align-start"> <view class="cu-form-group align-start">
<view class="title">备注描述</view> <view class="title">备注描述</view>
<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" v-model="remark" placeholder="请输入描述"></textarea> <textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" placeholder="请输入描述"></textarea>
</view> </view>
</form> </form>
...@@ -80,7 +57,7 @@ ...@@ -80,7 +57,7 @@
<view v-if="orderInfo.status !='2' " class="confirm-box"> <view v-if="orderInfo.status !='2' " class="confirm-box">
<view class="confirm-btn"> <view class="confirm-btn">
<button class="cu-btn block bg-blue margin-tb-sm lg" type="" @tap="onOrderConfirm">提交并{{orderInfo.status==1?'完成':'开始'}}保洁</button> <button class="cu-btn block bg-blue margin-tb-sm lg" type="">提交并开始保洁</button>
</view> </view>
<view class="open-door-btn"> <view class="open-door-btn">
...@@ -103,14 +80,16 @@ ...@@ -103,14 +80,16 @@
imgList:[], imgList:[],
orderInfo:{}, orderInfo:{},
cleanStatusEnum:{}, cleanStatusEnum:{},
orderId:'', orderId:''
openDoor:false
}; };
}, },
onLoad(option) { onLoad(option) {
this.orderId = option.id; this.orderId = option.id;
this.onGetDicts() this.onGetDicts()
}, },
onShow() {
this.imgList = []
},
methods:{ methods:{
onGetDicts() { onGetDicts() {
let dicts = [] let dicts = []
...@@ -129,16 +108,10 @@ ...@@ -129,16 +108,10 @@
} }
}, },
onLoading(){ onLoading(){
this.imgList = []
getInfoById(this.orderId).then(res=>{ getInfoById(this.orderId).then(res=>{
console.log(res,90909090) console.log(res,90909090)
if(res.data.code === 200){ if(res.data.code === 200){
this.orderInfo = { this.orderInfo = res.data.data;
...res.data.data,
startImage:res.data.data.startImage? res.data.data.startImage.split(','):[],
endImage: res.data.data.endImage? res.data.data.endImage.split(','):[],
}
} }
}) })
}, },
...@@ -163,23 +136,21 @@ ...@@ -163,23 +136,21 @@
uni.hideLoading() uni.hideLoading()
if(result.data){ if(result.data){
let data = JSON.parse(result.data); let data = JSON.parse(result.data);
if(this.orderInfo.status>=1){
this.orderInfo.endImage.push(data.url) this.imgList.push(data.url)
}else{
this.orderInfo.startImage.push(data.url)
}
} }
}) })
} }
}); });
}, },
ViewImage(val,url) { ViewImage(e) {
uni.previewImage({ uni.previewImage({
urls: val=='start'? this.orderInfo.startImage: this.orderInfo.endImage, urls: this.imgList,
current: url current: e.currentTarget.dataset.url
}); });
}, },
DelImg(val,i) { DelImg(e) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要删除吗?', content: '确定要删除吗?',
...@@ -187,12 +158,7 @@ ...@@ -187,12 +158,7 @@
confirmText: '确定', confirmText: '确定',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
if(val == 'start'){ this.imgList.splice(e.currentTarget.dataset.index, 1)
this.orderInfo.startImage.splice(i, 1)
}else{
this.orderInfo.endImage.splice(i, 1)
}
} }
} }
}) })
...@@ -206,77 +172,12 @@ ...@@ -206,77 +172,12 @@
}).then(res=>{ }).then(res=>{
console.log() console.log()
if(res.data.code == 200){ if(res.data.code == 200){
this.openDoor = true;
uni.showToast({ uni.showToast({
icon:'success', icon:'success',
title:'开门成功' title:'开门成功'
}) })
} }
}) })
},
onOrderConfirm(){
// if(this.orderInfo.status === 0 && !this.openDoor){
// uni.showToast({
// icon:'none',
// title:'提交前请先开门'
// })
// }
if(this.orderInfo.status ==1){
if(!this.orderInfo.endImage.length){
uni.showToast({
icon:'none',
title:'请上传至少一张图片'
})
return
}
}else{
if(!this.orderInfo.startImage.length){
uni.showToast({
icon:'none',
title:'请上传至少一张图片'
})
return
}
}
if(this.orderInfo.status == '1'){
endClean({
id:this.orderInfo.id,
endImage: this.orderInfo.endImage.join(),
remark: this.remark
}).then(res=>{
if(res.data.code == 200){
uni.showToast({
icon:'success',
title:'提交成功'
})
this.onLoading()
}else{
uni.showToast({
icon:'none',
title:res.data.msg
})
}
})
}else{
startClean({
id:this.orderInfo.id,
startImage: this.orderInfo.startImage.join(),
remark: this.remark
}).then(res=>{
if(res.data.code == 200){
uni.showToast({
icon:'success',
title:'提交成功'
})
uni.navigateBack()
}else{
uni.showToast({
icon:'none',
title:res.data.msg
})
}
})
}
} }
} }
} }
...@@ -292,7 +193,6 @@ ...@@ -292,7 +193,6 @@
width: 94%; width: 94%;
border-radius: 24upx; border-radius: 24upx;
overflow: hidden; overflow: hidden;
padding-bottom: 120upx;
} }
} }
.confirm-box{ .confirm-box{
...@@ -303,7 +203,6 @@ ...@@ -303,7 +203,6 @@
padding: 24upx 0; padding: 24upx 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background-color: #ffffff;
z-index: 999; z-index: 999;
.confirm-btn{ .confirm-btn{
width: 76%; width: 76%;
......
...@@ -706,6 +706,26 @@ ...@@ -706,6 +706,26 @@
console.log(res, 909090) console.log(res, 909090)
uni.hideLoading() uni.hideLoading()
if (res.data.code == 200) { if (res.data.code == 200) {
// uni.showToast({
// icon: "success",
// title: "下单成功",
// success: () => {
// setTimeout(() => {
// uni.navigateTo({
// url: "/pages/orderResult/orderResult?orderNo=" +
// res.data.data.orderNo
// })
// }, 1000)
// }
// })
wx.requestPayment({
"timeStamp": res.data.data.jsConfig.timeStamp,
"nonceStr": res.data.data.jsConfig.nonceStr,
"package": res.data.data.jsConfig.packages,
"signType": res.data.data.jsConfig.signType,
"paySign": res.data.data.jsConfig.paySign,
"success":function(resp){
// 支付成功
uni.showToast({ uni.showToast({
icon: "success", icon: "success",
title: "下单成功", title: "下单成功",
...@@ -715,9 +735,21 @@ ...@@ -715,9 +735,21 @@
url: "/pages/orderResult/orderResult?orderNo=" + url: "/pages/orderResult/orderResult?orderNo=" +
res.data.data.orderNo res.data.data.orderNo
}) })
}, 1000) }, 1500)
} }
}) })
},
"fail":function(resp){
// 取消支付或支付失败
uni.showToast({
title: "取消支付或支付失败"
})
// 调用取消订单接口
},
"complete":function(resp){
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
} else { } else {
uni.showToast({ uni.showToast({
title: "下单失败" title: "下单失败"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment