Commit ba255664 by YG8999

下单调用微信支付

parent 968d0f58
const CONFIG = {
// 开发环境配置
development: {
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址)
assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径
baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址)
// baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址
// hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址
......@@ -13,9 +13,9 @@ const CONFIG = {
},
// 生产环境配置
production: {
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址)
assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径
baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
hostUrl: 'https://coujiao.pseer.com/prod-api', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址
weixinAppId: '', // 微信公众号appid
codeHeadUrl:"",
......
......@@ -41,7 +41,7 @@
</view>
<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">
<text>{{val.name}}</text>
......@@ -50,7 +50,7 @@
<text>{{val.roomName}}</text>
</view> -->
<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>
......@@ -65,9 +65,7 @@
<script>
import {getListStore,getStarOrder} from "@/api/cleanRoom.js";
import config from "@/config/index.config"
import {
getDictItem
} from "@/utils/tools.js"
export default {
data() {
return {
......@@ -78,29 +76,13 @@
1:'使用中',
2:'待保洁',
3:'保洁中'
},
cleanStatusEnum:{}
}
};
},
onShow() {
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");
onLoad() {
this.onLoading()
})
}
},
methods:{
onLoading(){
getListStore().then(res=>{
console.log(res)
......@@ -114,7 +96,7 @@
console.log(res,"查询保洁中的订单")
if(res.data.code === 200){
uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+res.data.data.id
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+res.data.data
})
}else{
uni.showToast({
......@@ -140,13 +122,6 @@
uni.navigateTo({
url:"/pages/cleanRecord/index"
})
},
onNavSearch(val){
if(val.recordsStatus == 0){
uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+val.recordsId
})
}
}
}
}
......
......@@ -27,44 +27,21 @@
<view class="cu-bar bg-white margin-top">
<view class="action">
开始拍照上传
拍照上传
</view>
<view class="action">
{{orderInfo.startImage? orderInfo.startImage.length:'0'}}/4
{{imgList.length}}/4
</view>
</view>
<view v-if="orderInfo.startImage" 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="cu-form-group">
<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)" >
<image :src="item" mode="aspectFill"></image>
<view v-if="orderInfo.status == 1" class="cu-tag bg-red" @tap.stop="DelImg('end',index)" :data-index="index">
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
<image :src="imgList[index]" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
<text class='cuIcon-close'></text>
</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>
</view>
</view>
......@@ -72,7 +49,7 @@
<view class="cu-form-group align-start">
<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>
</form>
......@@ -80,7 +57,7 @@
<view v-if="orderInfo.status !='2' " class="confirm-box">
<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 class="open-door-btn">
......@@ -103,14 +80,16 @@
imgList:[],
orderInfo:{},
cleanStatusEnum:{},
orderId:'',
openDoor:false
orderId:''
};
},
onLoad(option) {
this.orderId = option.id;
this.onGetDicts()
},
onShow() {
this.imgList = []
},
methods:{
onGetDicts() {
let dicts = []
......@@ -129,16 +108,10 @@
}
},
onLoading(){
this.imgList = []
getInfoById(this.orderId).then(res=>{
console.log(res,90909090)
if(res.data.code === 200){
this.orderInfo = {
...res.data.data,
startImage:res.data.data.startImage? res.data.data.startImage.split(','):[],
endImage: res.data.data.endImage? res.data.data.endImage.split(','):[],
}
this.orderInfo = res.data.data;
}
})
},
......@@ -163,23 +136,21 @@
uni.hideLoading()
if(result.data){
let data = JSON.parse(result.data);
if(this.orderInfo.status>=1){
this.orderInfo.endImage.push(data.url)
}else{
this.orderInfo.startImage.push(data.url)
}
this.imgList.push(data.url)
}
})
}
});
},
ViewImage(val,url) {
ViewImage(e) {
uni.previewImage({
urls: val=='start'? this.orderInfo.startImage: this.orderInfo.endImage,
current: url
urls: this.imgList,
current: e.currentTarget.dataset.url
});
},
DelImg(val,i) {
DelImg(e) {
uni.showModal({
title: '提示',
content: '确定要删除吗?',
......@@ -187,12 +158,7 @@
confirmText: '确定',
success: res => {
if (res.confirm) {
if(val == 'start'){
this.orderInfo.startImage.splice(i, 1)
}else{
this.orderInfo.endImage.splice(i, 1)
}
this.imgList.splice(e.currentTarget.dataset.index, 1)
}
}
})
......@@ -206,77 +172,12 @@
}).then(res=>{
console.log()
if(res.data.code == 200){
this.openDoor = true;
uni.showToast({
icon:'success',
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 @@
width: 94%;
border-radius: 24upx;
overflow: hidden;
padding-bottom: 120upx;
}
}
.confirm-box{
......@@ -303,7 +203,6 @@
padding: 24upx 0;
display: flex;
flex-direction: row;
background-color: #ffffff;
z-index: 999;
.confirm-btn{
width: 76%;
......
......@@ -706,6 +706,26 @@
console.log(res, 909090)
uni.hideLoading()
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({
icon: "success",
title: "下单成功",
......@@ -715,9 +735,21 @@
url: "/pages/orderResult/orderResult?orderNo=" +
res.data.data.orderNo
})
}, 1000)
}, 1500)
}
})
},
"fail":function(resp){
// 取消支付或支付失败
uni.showToast({
title: "取消支付或支付失败"
})
// 调用取消订单接口
},
"complete":function(resp){
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
} else {
uni.showToast({
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