Commit 744429dd authored by home's avatar home

zxf

parent 23906c67
<template>
<!-- 外卖订单卡片 -->
<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">
<view class="title flex ali-c jus-b">
<text class="bt">{{dataorder.shop_name}}</text>
<view class="zt" >{{dataorder.order_status}}</view>
</view>
<view class="time">{{dataorder.create_time}}</view>
</view>
</view>
<view class="beizhu flex jus-b ali-c" style="border-bottom: 1px solid #f1f1f1;">
<text class="price">{{dataorder.username_tel}}</text>
</view>
<!-- 上面的是 -->
<!-- reorder -->
<view class="mingxi oneline" v-for="(item,index) in dataorder.products" :key="index">{{item.productname}} x {{item.num}}</view>
<view class="beizhu flex jus-b ali-c">
<text class="beizhutext oneline flex1" v-if="dataorder.remark">备注:{{dataorder.remark||''}}</text>
<text class="beizhutext oneline flex1" v-if="dataorder.message">退款原因:{{dataorder.message||''}}</text>
<text class="price">合计:¥{{dataorder.total}}</text>
</view>
<view class="orderItemss_foot jus-b">
<view class="titmeboxs ali-c" >
<text style="color: #FF6900;" ></text>
</view>
<view class="btnbox flex flex1 jus-e">
<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>
</view>
</view>
</view>
</template>
<script>
import {immediatelyOrder,refuseOrder,consentEleRefund,refuseEleRefund} from "@/utils/api/api.js";
export default {
name:"orderItemss",
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 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
});
},
//删除订单
deleteOrderFun(){
this.dataorder.index = this.index;
this.$emit('deleteOrderFun',this.dataorder);
},
//立即接单 方法 外卖的
async immediatelyOrderfun(order_id, action,index){
let res = await immediatelyOrder({
order_id:this.dataorder.order_id,
})
this.$api.msg(res.msg);
if(res.code==0){
this.$emit("reload",{index});
}
},
//商家拒绝接单的方法
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.$emit("reload",{index});
}
}
}
}
</script>
<style lang="scss">
.uni-list-cell-hover{
background: #fbfbfb;
opacity: .7;
}
//单个订单
.orderItemss{
background: #FFFFFF;
padding: 30upx 20upx;
border-radius:14upx;
margin-bottom: 20upx;
.shopinfo{
.imgs{
width: 71upx;
height: 71upx;
margin-right: 25upx;
}
.titlebox{
.title{
font-family:PingFang SC;
font-weight:bold;
.bt{
font-size:28upx;
color:rgba(51,51,51,1);
}
.zt{
font-size:30upx;
color:rgba(255,105,0,1);
}
}
.time{
font-size:24upx;
color:rgba(51,51,51,1);
margin-top: 5upx;
}
}
}
.mingxi{
margin-top: 10upx;
margin-bottom: 10upx;
font-size:30upx;
color:rgba(51,51,51,1);
border-bottom: 1px solid rgb(241, 241, 241);
}
.beizhu{
margin-top: 20upx;
// border-top: 1px solid #EFF0F4;
height: 80upx;
line-height: 80upx;
.beizhutext{
font-size:28upx;
color:rgba(51,51,51,1);
}
.price{
font-size:30upx;
color:rgba(51,51,51,1);
}
}
//底部
.orderItemss_foot{
border-top: 1px solid #EFF0F4;
padding-top: 24upx;
.titmeboxs{
color:#333333;
font-size: 30upx;
.shuzi{
color:#FF6900;
}
}
.msgtuikuan{
font-size:32upx;
color:rgba(255,102,0,1);
}
.btnbox{
}
.btns{
width:152upx;
height:62upx;
line-height: 62upx;
text-align: center;
border:1px solid rgba(204,204,204,1);
border-radius:4upx;
font-size:26upx;
color:rgba(51,51,51,1);
margin-left: 20upx;
}
.btns1{
border-radius:4upx;
margin-left: 20upx;
width:152upx;
height:62upx;
line-height: 62upx;
text-align: center;
background:rgba(255,102,0,1);
color:#FFFFFF;
border:0;
}
}
}
</style>
......@@ -446,7 +446,15 @@
"enablePullDownRefresh": false
}
}
},
{
"path" : "pages/buyingVegetables/buyingVegetables",
"style" :
{
"navigationBarTitleText": "提货订单",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
......
<template>
<!-- 订单列表页面 -->
<view class="content">
<view class="navbar">
<scroll-view :scroll-x="true" style="width: 100vw;" :scroll-left="scrleft" :scroll-with-animation="true">
<view class="ali-c">
<view v-for="(item, index) in navListTow" :key="index" class="nav-item" :class="{current: tabCurrentIndex === index}"
@click="tabClick(index,item)">
{{item.status_name}}
</view>
</view>
</scroll-view>
</view>
<view class="orderlist">
<vegetablesOrderItem @reload="reload" v-for="(item,index) in orderlist" :index='index' :status="status" :dataorder="item"
:key="index"></vegetablesOrderItem>
</view>
<pageScrollTo v-if="isshowtop"></pageScrollTo>
</view>
</template>
<script>
import {
eleOrderStatus,
eleOrderList
} from "@/utils/api/api.js";
import vegetablesOrderItem from "@/components/vegetablesOrderItem/vegetablesOrderItem.vue";
import empty from "@/components/empty";
import pageScrollTo from "@/components/pageScrollTo/pageScrollTo.vue"
export default {
components: {
vegetablesOrderItem,
empty,
pageScrollTo
},
data() {
return {
tabCurrentIndex: 0,
navListTow: [],
page: 0,
orderlist: [],
isshowall: true,
status: "", //状态
isshowtop: false,
is_loading_done: false,
action: '',
isClick: true, //是否能点击
scrleft: 0,
};
},
onLoad(options) {
this.tabCurrentIndex = 0; //先写死
//获取全部的状态列表
//方法请求
this.page = 0;
this.orderlist = [];
this.isshowall = true;
this.eleOrderStatusfun();
},
onShow() {
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();
},
onPageScroll(e) {
uni.setStorageSync('scrollTop', e.scrollTop);
//处理返回顶部
if (e.scrollTop > 300) {
this.isshowtop = true;
} else {
this.isshowtop = false;
}
},
onReachBottom() {
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: {
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({});
if (res.code == 0) {
// this.navListTow = res.data;
this.navListTow = [{
status: "all",
status_id: "all",
status_name: "全部"
}, {
status: "1",
status_id: "1",
status_name: "未提货"
}, {
status: "1",
status_id: "1",
status_name: "已提货"
}]
// this.eleOrderListfun();//获取订单列表
} else {
this.$api.msg(res.msg);
}
},
//获取订单列表
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.hideLoading(); //结束加载
this.isClick = true; //能点击tab了
uni.stopPullDownRefresh(); //结束下拉刷新
if (res.code == 0) {
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() {
uni.navigateTo({
url: "/pages/order/delivery/delivery?id=1",
})
},
//核销功能
tocheckx() {
//处理 传参 请求 提示核销成功
this.$api.msg("核销成功(测试提示)");
},
jump_detail() {
uni.navigateTo({
url: '/pages/order/detail/detail'
});
},
//swiper 切换
changeTab(e) {
this.tabCurrentIndex = e.target.current;
},
//顶部tab点击 切换数据
tabClick(index, item) {
if (this.isClick) {
this.tabCurrentIndex = index;
this.page = 0;
this.orderlist = [];
this.isshowall = true;
this.is_loading_done = false,
this.status = item.status;
this.scrleft = index * 45;
// this.eleOrderListfun();
}
},
//删除订单
deleteOrder(index) {
uni.showLoading({
title: '请稍后'
})
setTimeout(() => {
this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
uni.hideLoading();
}, 600)
},
//取消订单
cancelOrder(item) {
uni.showLoading({
title: '请稍后'
})
setTimeout(() => {
let {
stateTip,
stateTipColor
} = this.orderStateExp(9);
item = Object.assign(item, {
state: 9,
stateTip,
stateTipColor
})
//取消订单后删除待付款中该项
let list = this.navList[1].orderList;
let index = list.findIndex(val => val.id === item.id);
index !== -1 && list.splice(index, 1);
uni.hideLoading();
}, 600)
},
//订单状态文字和颜色
orderStateExp(state) {
let stateTip = '',
stateTipColor = '#fa436a';
switch (+state) {
case 1:
stateTip = '待付款';
break;
case 2:
stateTip = '待发货';
break;
case 9:
stateTip = '订单已关闭';
stateTipColor = '#909399';
break;
//更多自定义
}
return {
stateTip,
stateTipColor
};
}
},
}
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.fl-fx {
position: fixed;
width: 100%;
z-index: 999;
}
.swiper-box {
height: calc(100% - 40px);
}
.list-scroll-content {
height: 100%;
}
.navbar {
width: 100vw;
display: flex;
line-height: 80upx;
padding: 0 10upx;
background: #fff;
box-shadow: 0 1px 10upx rgba(0, 0, 0, .06);
position: relative;
z-index: 10;
.nav-item {
min-width: 160upx;
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30upx;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 88upx;
height: 0;
border-bottom: 2px solid $base-color;
}
}
}
}
.orderlist {
padding: 40upx 24upx 0 24upx;
box-sizing: border-box;
}
</style>
......@@ -186,7 +186,7 @@
</navigator>
</view>
<view class="jiu_max" v-if="shop_type == 'goods'">
<view class="jiu_max" v-if="shop_type == 'goods'">
<!-- 商城订单 -->
<navigator url="/pages/order/shopOrder">
<view class="jiu_min">
......@@ -301,7 +301,7 @@
<view class="jiu_max " @click="download" v-if="shop_type == 'ele'&&is_bld">
<view>
<view class="jiu_min">
<view class="jiu_min">
<view>
<image class="img" src="/static/icon/download.png" mode=""></image>
</view>
......@@ -322,6 +322,7 @@
</view>
</navigator>
</view>
<!-- -->
</view>
<view class="BH"></view>
......@@ -333,7 +334,8 @@
<script>
import {
getskipShop,
activity_nucleus
activity_nucleus,
ele_carry
} from "@/utils/api/merchant.js";
import uniBadge from "@/components/uni/uni-badge/uni-badge.vue"
import uniIcon from "@/components/uni/uni-icon/uni-icon.vue"
......@@ -389,8 +391,8 @@
});
}
if(uni.getSystemInfoSync().platform != 'ios'){
if (uni.getSystemInfoSync().platform != 'ios') {
getApp().hgServiceFun();
}
//#endif
......@@ -408,14 +410,14 @@
if (res.code == 0) {
this.is_bld = res.data.is_bld
// this.is_bld = 1
}
})
this.storeIndexfun();
if(uni.getStorageSync('dwstatus')==''){
getApp().getnewsRemind().then(res=>{
if(res){
if (uni.getStorageSync('dwstatus') == '') {
getApp().getnewsRemind().then(res => {
if (res) {
if (this.$store.state.Timer == '') {
let Timer = setInterval(() => {
getApp().getnewsRemind(2);
......@@ -424,14 +426,14 @@
}
}
})
}else{
if( uni.getStorageSync('dwstatus')==3 || uni.getStorageSync('dwstatus')==0){
} else {
if (uni.getStorageSync('dwstatus') == 3 || uni.getStorageSync('dwstatus') == 0) {
//this.$api.msg('不是第一次')
getApp().getIosLocation(2);
}else {
} else {
//this.$api.msg('第一次')
getApp().getnewsRemind().then(res=>{
if(res){
getApp().getnewsRemind().then(res => {
if (res) {
if (this.$store.state.Timer == '') {
let Timer = setInterval(() => {
getApp().getnewsRemind(2);
......@@ -440,12 +442,9 @@
}
}
})
}
}
},
methods: {
saoma(e) {
......@@ -453,25 +452,34 @@
success: res => {
if (res.scanType == 'QR_CODE') { //二维码
let param = this.GetRequest(res.result);
param.shop_id = this.shop_id
activity_nucleus(param).then(res => {
if (res.code == 0) {
uni.showModal({
title:'提示',
content:res.msg,
showCancel:false,
confirmText:'确定',
success() {
}
})
}else{
this.$api.msg(res.msg);
}
})
return;
} else{
// param.shop_id = 81
if (param.type == 10) { // 菜市场买菜核销
console.log(param);
ele_carry(param).then(res=>{
if(res.code == 0){
uni.showToast({
title:"核销成功",
icon:"none",
duration:3000
})
}else{
this.$api.msg(res.msg);
}
})
} else if (param.type == 9) { //零元领核销
activity_nucleus(param).then(res => {
if (res.code == 0) {
uni.showToast({
title:"核销成功",
icon:"none",
duration:3000
})
} else {
this.$api.msg(res.msg);
}
})
}
} else {
//https://www.mxnzp.com/api/barcode/create
//barcode=6902538005141
//&app_id=ihrnqdrpunchxsfr
......@@ -498,7 +506,7 @@
uni.navigateTo({
url: '/pages/addEditEleProduct/addEditEleProduct?results=' + JSON.stringify(results)
})
}else{
} else {
results.isScanCode = false;
results.code = res.result;
uni.navigateTo({
......
......@@ -103,4 +103,13 @@ export function activity_user(data){
*/
export function activity_update(data){
return request.post("ele/activity_update", data, { noAuth: true});
}
/**
* 修改活动
* @param {} data
*/
export function ele_carry(data){
return request.post("ele/ele_carry", data, { noAuth: true});
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ module.exports = {
isdebug:false,//正式
//isdebug:true,//测试
// isdebug:true,//测试
// xqdebug:false,//正式权限
xqdebug:true,//发布审核权限 也是测试环境的 主要用于ios
......
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