|
@@ -79,6 +79,7 @@ export default {
|
|
|
title: "送餐地址",
|
|
|
money: 0,
|
|
|
addressList: [],
|
|
|
+ text:undefined
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
@@ -118,11 +119,22 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
fanhuiBtn() {
|
|
|
- this.$router.go(-2)
|
|
|
+ this.$router.go(-1)
|
|
|
},
|
|
|
change(id) {
|
|
|
this.form.id = id
|
|
|
},
|
|
|
+ checkBlankSpace(str){
|
|
|
+ this.text = undefined
|
|
|
+ while(str.lastIndexOf(" ")>=0){
|
|
|
+ str = str.replace(" ","");
|
|
|
+ }
|
|
|
+ if(str.length == 0){
|
|
|
+ Toast("输入不能全为空");
|
|
|
+ this.text = 1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ },
|
|
|
submit(){
|
|
|
//获取默认地址
|
|
|
let data = this.store.cart
|
|
@@ -135,44 +147,53 @@ export default {
|
|
|
select.totalPrice = (data[i].price * data[i].num).toFixed(2)
|
|
|
select.mCount = data[i].num
|
|
|
arr.push(select)
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
if(this.form.id == "" && !this.form.address){
|
|
|
Toast("送菜地址不能为空")
|
|
|
return
|
|
|
}
|
|
|
+ if(this.form.id == "自定义送餐地址:" && !this.form.address){
|
|
|
+ Toast("送菜地址不能为空")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.form.id == "自定义送餐地址:"){
|
|
|
+ this.checkBlankSpace(this.form.address)
|
|
|
+ if(this.text){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
axios.get("https://smartpark.caih.com/dxapi/dxtop/staff/one",{
|
|
|
- params:{
|
|
|
- id: localStorage.getItem("user_wt")
|
|
|
- }
|
|
|
- }).then(res2 =>{
|
|
|
- axios.post(`https://smartpark.caih.com/dxapi/dreOrder/`,
|
|
|
- {
|
|
|
- orderUserName:Cookies.get("nickName57"),
|
|
|
- address:this.form.id == "自定义送餐地址:" ? this.form.address : this.form.id,
|
|
|
- totalMoney:this.money.toFixed(2),
|
|
|
- mType:localStorage.getItem("canbie57"),
|
|
|
- phone:this.form.tel,
|
|
|
- remark:this.form.remarks,
|
|
|
- dreOrderDetails:arr,
|
|
|
- orderUserId:res2.data.data.sid
|
|
|
- }).then(res => {
|
|
|
- this.$store.dispatch("cart", [])
|
|
|
- this.$store.dispatch("canbie", undefined)
|
|
|
- localStorage.removeItem("canbie57");
|
|
|
+ params:{
|
|
|
+ id: localStorage.getItem("user_wt")
|
|
|
+ }
|
|
|
+ }).then(res2 =>{
|
|
|
+ axios.post(`https://smartpark.caih.com/dxapi/dreOrder/`,
|
|
|
+ {
|
|
|
+ orderUserName:Cookies.get("nickName57"),
|
|
|
+ address:this.form.id == "自定义送餐地址:" ? this.form.address : this.form.id,
|
|
|
+ totalMoney:this.money.toFixed(2),
|
|
|
+ mType:localStorage.getItem("canbie57"),
|
|
|
+ phone:this.form.tel,
|
|
|
+ remark:this.form.remarks,
|
|
|
+ dreOrderDetails:arr,
|
|
|
+ orderUserId:res2.data.data.sid
|
|
|
+ }).then(res => {
|
|
|
+ this.$store.dispatch("cart", [])
|
|
|
+ this.$store.dispatch("canbie", undefined)
|
|
|
+ localStorage.removeItem("canbie57");
|
|
|
|
|
|
- Dialog.confirm({
|
|
|
- title: '系统信息',
|
|
|
- message: '您的点餐已进入配餐流程,请耐心等候,谢谢!',
|
|
|
- }).then(() => {
|
|
|
- this.$router.go(-2)
|
|
|
- });
|
|
|
- setTimeout(()=>{
|
|
|
- document.getElementsByClassName("van-button__text")[1].innerHTML = "关闭"
|
|
|
- },1)
|
|
|
- })
|
|
|
- })
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '系统信息',
|
|
|
+ message: '您的点餐已进入配餐流程,请耐心等候,谢谢!',
|
|
|
+ }).then(() => {
|
|
|
+ this.$router.go(-2)
|
|
|
+ });
|
|
|
+ setTimeout(()=>{
|
|
|
+ document.getElementsByClassName("van-button__text")[1].innerHTML = "关闭"
|
|
|
+ },1)
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
},
|