Commit 122defed authored by home's avatar home

zxf

parents 82850f13 c53e78f2
<template>
<!-- 外卖订单卡片 -->
<view class="orderItemss" @tap="toxq" hover-class="uni-list-cell-hover">
<view
class="orderItemss"
@tap="operation"
data-action="orderDetails"
:data-orderid='dataorder.order_id'
hover-class="uni-list-cell-hover"
>
<view class="shopinfo flex ali-c">
<image class="imgs" :src="staticUrl+dataorder.photo" mode=""></image>
<view class="titlebox flex1">
......@@ -26,9 +31,6 @@
</view>
<view class="btnbox flex flex1 jus-e">
<!-- <view class="btns" @tap.stop="toxq" >查看详情</view>
<view class="btns" v-if="dataorder.status==1" @tap.stop="immediatelyOrderfun" >立即接单</view>
<view class="btns" v-if="dataorder.status==1" @tap.stop="refuseOrderfun" >拒绝接单</view> @tap.stop="operation" -->
<block v-for="(action,index) in dataorder.order_operation" :key="index">
<view :class="action.class_name" :data-orderid='dataorder.order_id' @tap.stop="operation" :data-action='action.way' :data-is_ld='dataorder.buytype'>{{action.name}}</view>
</block>
......@@ -36,107 +38,86 @@
</view>
</view>
</template>
<script>
import {immediatelyOrder,refuseOrder,consentEleRefund,refuseEleRefund} from "@/utils/api/api.js";
export default {
name:"orderItemss",
props:["dataorder","tabindex","index"],
props:["dataorder","tabindex","index","status"],
data() {
return {
};
},
mounted() {
console.log('啊啊啊啊')
},
updated (){
console.log('玩了')
},
watch:{
dataorder(){
console.log('变了')
}
},
computed: {
staticUrl () {//静态资源地址
return this.$store.state.staticUrl;
}
},
},
methods:{
/**
* 订单操作
*
*/
operation (event) {
let that = this;
let action = event.currentTarget.dataset.action;
let order_id = event.currentTarget.dataset.orderid;
let shop_id = event.currentTarget.dataset.shop_id;
switch (action) {
case 'immediatelyOrder': //立即接单 OK
that.immediatelyOrderfun(order_id, action);
console.info("立即接单");
break;
case 'refuseOrder': //拒接此单 OK
console.info("拒接此单");
that.refuseOrderfun(order_id, action);
break;
case 'checkLogistics': //查看物流
that.logistics(order_id, action);
// this.$api.msg("开发中,敬请期待~");
console.info("查看物流");
break;
case 'orderDetails': //订单详情
console.info("订单详情");
that.toxq(order_id,order_id);
break;
case 'consentEleRefund'://同意退款
this.consentEleRefund(order_id);
break;
case 'refuseEleRefund'://拒绝退款
this.refuseEleRefund(order_id);
break;
default:
//其他的 退款啥的 处理ok了
console.info("1111",action);
break;
}
},
// 同意退款
async consentEleRefund(order_id){
let res = await consentEleRefund({
order_id:this.dataorder.order_id,
});
if(res.code==0){
this.$api.msg(res.msg);
this.$emit("reload",{});//重新加载
}else{
this.$api.msg(res.msg);
}
},
// 商家接单派送
// businessReceiveOrder(order_id,shop_id){
// console.log(e);
// uni.request({
// url:`https://runer.jxdsy.cn/api/horsemans/horseAutoTakeOrder?order_id=${order_id}&shop_id=${shop_id}`,
// success: (res) => {
// console.log(res);
// },
// fail: (res) => {
// console.log(res);
// }
// })
// },
// 拒绝退款
async refuseEleRefund(order_id){
let res = await refuseEleRefund({
order_id:this.dataorder.order_id,
});
if(res.code==0){
this.$api.msg(res.msg);
this.$emit("reload",{});//重新加载
}else{
this.$api.msg(res.msg);
}
},
// 详情
toxq(){
/**
* 订单操作
*
*/
operation (event) {
let action = event.currentTarget.dataset.action;
let order_id = event.currentTarget.dataset.orderid;
let index=this.index;
uni.setStorageSync('obj',{order_id,index});
console.log(order_id,'aaa')
switch (action) {
case 'immediatelyOrder': //立即接单 OK
this.immediatelyOrderfun(order_id, action,index);
break;
case 'refuseOrder': //拒接此单 OK
this.refuseOrderfun(order_id, action,index);
break;
case 'orderDetails': //订单详情
this.toxq(order_id,order_id);
break;
case 'consentEleRefund'://同意退款
this.consentEleRefund(order_id,action,index);
break;
case 'refuseEleRefund'://拒绝退款
this.refuseEleRefund(order_id,action,index);
break;
default:
//其他的 退款啥的 处理ok了
console.info("1111",action);
break;
}
},
async consentEleRefund(order_id, action,index){ // 同意退款
let res = await consentEleRefund({
order_id:this.dataorder.order_id,
});
this.$api.msg(res.msg);
if(res.code==0){
this.$emit("reload",{index});
}
},
// 拒绝退款
async refuseEleRefund(order_id, action,index){
let res = await refuseEleRefund({
order_id:this.dataorder.order_id,
});
this.$api.msg(res.msg);
if(res.code==0){
this.$emit("reload",{index});
}
},
toxq(){ //进入详情
uni.navigateTo({
url: '/pages/order/detail/detail?id='+ this.dataorder.order_id
});
......@@ -144,35 +125,26 @@
//删除订单
deleteOrderFun(){
this.dataorder.index = this.index;
this.$emit('deleteOrderFun',this.dataorder);
},
//立即接单 方法 外卖的
async immediatelyOrderfun(){
async immediatelyOrderfun(order_id, action,index){
let res = await immediatelyOrder({
order_id:this.dataorder.order_id,
})
console.log(res)
this.$api.msg(res.msg);
if(res.code==0){
console.log(res,'aaaaaaa')
this.$api.msg(res.msg);
this.$emit("reload",{});//重新加载
}else{
this.$api.msg(res.msg);
this.$emit("reload",{index});
}
},
//商家拒绝接单的方法
async refuseOrderfun(){
async refuseOrderfun(order_id, action,index){
let res = await refuseOrder({
order_id:this.dataorder.order_id,
});
});
this.$api.msg(res.msg);
if(res.code==0){
this.$api.msg(res.msg);
this.$emit("reload",{});//重新加载
}else{
this.$api.msg(res.msg);
this.$emit("reload",{index});
}
}
}
......
......@@ -3,8 +3,8 @@
//"appid" : "__UNI__FC9419E",
"appid" : "__UNI__1EA80F1", //这个是 web
"description" : "商家",
"versionName" : "1.0.84",
"versionCode" : 184,
"versionName" : "1.0.86",
"versionCode" : 186,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......@@ -147,7 +147,8 @@
"landscape7" : "C:/Users/Administrator/Desktop/da/6b51802bba0a32ac69392831b1fc324.png",
"portrait-1194h@2x" : "C:/Users/Administrator/Desktop/da/6b51802bba0a32ac69392831b1fc324.png"
}
}
},
"iosStyle" : "common"
}
},
"compilerVersion" : 2
......
<template>
<!-- 添加外卖商品 -->
<view class="productpages">
<view class="flexv ali-c" style="padding: 30upx 0 0 0;">
<!-- <view class="flexv ali-c" style="padding: 30upx 0 0 0;">
<image class="mb-20 img" @tap="saoma" src="/static/icon/saoma.png"></image>
<view>扫码入库</view>
</view>
</view> -->
<view class="noecellbox">
<view class="title" >产品名称 <text style="color: red;">(必填)</text></view>
......@@ -52,6 +52,7 @@
</view>
<view class="noecellbox">
<view class="title">商品库存</view>
<view class="inputbox flex">
......@@ -59,7 +60,7 @@
</view>
</view>
<view class="noecellbox" v-if="codeDisabled" >
<view class="noecellbox" v-if="codeDisabled" >
<view class="title">条形编码</view>
<view class="inputbox flex">
<input class="input flex1" type="text" :disabled='codeDisabled' @tap="onCodeFocus" :value="form.code" placeholder-class="plclass" placeholder="请填写条形编码" />
......
......@@ -283,6 +283,7 @@
},
methods: {
saoma(e){
uni.scanCode({
success:res => {
uni.request({
......@@ -318,7 +319,7 @@
}
})
}
});
});
},
jump(){
uni.navigateTo({
......
......@@ -106,7 +106,7 @@
onLoad(opdata) {
this.order_id = opdata.id;
this.message = opdata.mess;
this.eleOrderDetails()
this.eleOrderDetails();
},
computed: {
staticUrl(){
......@@ -137,10 +137,12 @@
let res = await immediatelyOrder({
order_id:this.detail.order_id,
});
this.$api.msg(res.msg);
if(res.code==0){
this.$api.msg(res.msg);
}else{
this.$api.msg(res.msg);
uni.$emit("isDelorder",{action: 'immediatelyOrder'});
setTimeout(()=>{
uni.navigateBack({}); //返回上一页
},500)
}
},
//商家拒绝接单的方法
......@@ -148,10 +150,12 @@
let res = await refuseOrder({
order_id:this.detail.order_id,
});
this.$api.msg(res.msg);
if(res.code==0){
this.$api.msg(res.msg);
}else{
this.$api.msg(res.msg);
uni.$emit("isDelorder",{action: 'refuseOrder'});
setTimeout(()=>{
uni.navigateBack({}); //返回上一页
},500)
}
}
}
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
</view>
<view class="orderlist">
<orderItemss @reload="reload" v-for="(item,index) in orderlist" :dataorder="item" :key="index" ></orderItemss>
<orderItemss @reload="reload" v-for="(item,index) in orderlist" :index='index' :status="status" :dataorder="item" :key="index" ></orderItemss>
</view>
<pageScrollTo v-if="isshowtop" ></pageScrollTo>
......@@ -43,40 +43,51 @@
isshowall:true,
status:"",//状态
isshowtop:false,
is_loading_done: false,
action:'',
isClick:true,//是否能点击
};
},
onLoad(options){
this.tabCurrentIndex = 0;//先写死
//获取全部的状态列表
//方法请求
this.page=0;
this.orderlist=[];
this.isshowall=true;
this.eleOrderStatusfun();
},
onShow() {
//处理返回刷新
// let isload = uni.getStorageSync("isload");
// if(isload==1){
// uni.setStorageSync("isload",0);
// this.page=0;
// this.orderlist=[];
// this.isshowall=true;
// this.eleOrderListfun();//获取订单列表
// }
this.action='';
uni.$on("isDelorder", res => {
let index=uni.getStorageSync('obj').index;
let orderlist=this.orderlist;
this.action=res.action;
if(res.action=="immediatelyOrder"||res.action=="refuseOrder"){ //接单 拒绝接单
if(this.status!='all'){ //只有不是在全部订单下才删除这一项
orderlist.splice(index,1); //删除某项
this.$set(this,'orderlist',orderlist);
}else{
this.listDeal();
}
}
uni.$off('isDelorder'); //取消监听
})
if(this.action==''){
this.listDeal();
}
},
//下拉刷新
onPullDownRefresh(){
this.is_loading_done = false;
this.page=0;
this.orderlist=[];
this.isshowall=true;
this.eleOrderListfun();
// uni.stopPullDownRefresh();//结束下拉刷新
},
onPageScroll(e){
uni.setStorageSync('scrollTop',e.scrollTop);
//处理返回顶部
if(e.scrollTop>300){
this.isshowtop = true;
......@@ -85,24 +96,62 @@
}
},
onReachBottom() {
if(this.isshowall){
this.eleOrderListfun();
if (this.is_loading_done == false) { //还没加载完毕则继续加载
uni.showLoading({
title: '加载中',
mask: false
})
this.eleOrderListfun();
} else {
uni.showLoading({
title: '已全部加载完毕',
mask: false
})
setTimeout(function () {
uni.hideLoading()
}, 1000);
}
},
onUnload(){ //页面卸载的时候
uni.setStorageSync('obj',{order_id:'',index:-1});
uni.$off('isDelorder'); //取消监听
uni.setStorageSync('scrollTop',0);
},
methods: {
//抢单成功后 重新加载列表方法
reload(){
console.info("11");
this.page=0;
this.orderlist=[];
this.isshowall=true;
this.eleOrderListfun();
listDeal(){
let order_id=uni.getStorageSync('obj').order_id;
let index=uni.getStorageSync('obj').index;
uni.showLoading({title:"请稍后..."});
eleOrderList({
page:Math.ceil((index+1)/10),
status:this.status,
is_dianping:"",//点评
sale_status:""//售后状态
}).then(res => {
console.log(res,order_id,'这里了')
uni.hideLoading();
for(let item of res.data){
console.log(item,'这里了')
if(item.order_id==order_id){
this.$set(this.orderlist,index,item);
break;
}
}
})
},
reload(e){//抢单成功后
let index=e.index;
if(this.status=='all'){
this.listDeal();
}else{
let orderlist=this.orderlist;
orderlist.splice(index,1); //删除某项
this.$set(this,'orderlist',orderlist);
}
},
//获取订单状态
async eleOrderStatusfun(){
let res = await eleOrderStatus({
});
let res = await eleOrderStatus({});
if(res.code==0){
this.navListTow = res.data;
this.status = "all";
......@@ -113,27 +162,33 @@
},
//获取订单列表
async eleOrderListfun(){
this.isClick=false;//不能点击tab了
this.page++;
uni.showLoading({title: '加载中...'});
let res = await eleOrderList({
page:this.page,
status:this.status,
is_dianping:"",//点评
sale_status:"",//售后状态
});
uni.stopPullDownRefresh();//结束下拉刷新
uni.hideLoading();//结束加载
this.isClick=true;//能点击tab了
uni.stopPullDownRefresh();//结束下拉刷新
if(res.code==0){
if(res.data){
if(res.data.length!=0){
this.orderlist = [...this.orderlist,...res.data];
}else{
this.$api.msg("没有更多了");
}
}else{
this.$api.msg("没有更多了");
}
if (res.data == null || res.data.length == 0) {
this.is_loading_done = true;
} else {
this.orderlist = [...this.orderlist,...res.data];
}
}else{
this.$api.msg(res.msg);
}
uni.pageScrollTo({
scrollTop: uni.getStorageSync('scrollTop'),
duration: 0
});
},
//发货功能
todelivery(){
......@@ -151,21 +206,21 @@
url: '/pages/order/detail/detail'
});
},
//swiper 切换
changeTab(e){
this.tabCurrentIndex = e.target.current;
},
//顶部tab点击 切换数据
tabClick(index,item){
this.tabCurrentIndex = index;
this.page = 0;
this.orderlist = [];
this.isshowall = true;
this.status = item.status;
this.eleOrderListfun();
if(this.isClick){
this.tabCurrentIndex = index;
this.page = 0;
this.orderlist = [];
this.isshowall = true;
this.is_loading_done= false,
this.status = item.status;
this.eleOrderListfun();
}
},
//删除订单
deleteOrder(index){
......
......@@ -4,8 +4,10 @@ module.exports = {
//是否为开发调试环境 true为本地环境 false 为正式环境
// isdebug:false,//正式
isdebug:true,//测试
......
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