配送端

master
gongfuxiang 2023-08-23 20:14:53 +08:00
parent f5744014cd
commit d39e377eb3
11 changed files with 909 additions and 31 deletions

100
App.vue
View File

@ -71,7 +71,7 @@
//
request_url: 'http://shopxo.com/',
// publicpublichttps://d1.shopxo.vip/public/
static_url: 'http://shopxo.com/',
static_url: 'https://new.shopxo.vip/',
// default
system_type: 'default',
//
@ -241,15 +241,16 @@
/**
* 获取用户信息,信息不存在则唤醒授权
* object 回调操作对象
* method 回调操作对象的函数
* method 回调操作对象的函数
* params 回调操请求参数
* return 有用户数据直接返回, 则回调调用者
*/
get_user_info(object, method) {
get_user_info(object, method, params) {
var user = this.get_user_cache_info();
if (user == null) {
// #ifdef MP
//
this.user_login(object, method);
this.user_login(object, method, params);
// #endif
// #ifdef H5 || APP
@ -320,33 +321,34 @@
/**
* 用户登录
* object 回调操作对象
* method 回调操作对象的函数
* method 回调操作对象的函数
* params 回调请求参数
* auth_data 授权数据
*/
user_auth_login(object, method, auth_data) {
user_auth_login(object, method, params, auth_data) {
var self = this;
// #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO || MP-KUAISHOU
uni.checkSession({
success: function() {
var login_data = self.get_login_cache_info();
if (login_data == null) {
self.user_login(object, method);
self.user_login(object, method, params);
} else {
self.get_user_login_info(object, method, login_data, auth_data);
self.get_user_login_info(object, method, params, login_data, auth_data);
}
},
fail: function() {
uni.removeStorageSync(self.data.cache_user_login_key);
self.user_login(object, method);
self.user_login(object, method, params);
}
});
// #endif
// #ifdef MP-ALIPAY
var login_data = self.get_login_cache_info();
if (login_data == null) {
self.user_login(object, method);
self.user_login(object, method, params);
} else {
self.get_user_login_info(object, method, login_data, auth_data);
self.get_user_login_info(object, method, params, login_data, auth_data);
}
// #endif
},
@ -354,13 +356,13 @@
/**
* 用户登录
* object 回调操作对象
* method 回调操作对象的函数
* auth_data 授权数据
* method 回调操作对象的函数
* params 回调操请求参数
*/
user_login(object, method) {
user_login(object, method, params) {
var login_data = uni.getStorageSync(this.data.cache_user_login_key) || null;
if (login_data == null) {
this.user_login_handle(object, method, true);
this.user_login_handle(object, method, params, true);
} else {
this.login_to_auth();
}
@ -369,11 +371,11 @@
/**
* 用户登录处理
* object 回调操作对象
* method 回调操作对象的函数
* auth_data 授权数据
* method 回调操作对象的函数
* params 回调操请求参数
* is_to_auth 是否进入授权
*/
user_login_handle(object, method, is_to_auth = true) {
user_login_handle(object, method, params, is_to_auth = true) {
var self = this;
uni.showLoading({
title: "授权中..."
@ -400,7 +402,7 @@
if ((data.is_user_exist || 0) == 1 || client_type == 'weixin') {
uni.setStorageSync(self.data.cache_user_info_key, data);
if (typeof object === 'object' && (method || null) != null) {
object[method]();
object[method](params);
}
} else {
uni.setStorageSync(self.data.cache_user_login_key, data);
@ -408,7 +410,7 @@
var pages = getCurrentPages();
if(pages[pages.length-1]['route'] == 'pages/login/login') {
if (typeof object === 'object' && (method || null) != null) {
object[method]();
object[method](params);
}
} else {
self.login_to_auth();
@ -456,11 +458,12 @@
/**
* 获取用户授权信息
* object 回调操作对象
* method 回调操作对象的函数
* method 回调操作对象的函数
* params 回调请求参数
* login_data 登录信息
* auth_data 授权数据
*/
get_user_login_info(object, method, login_data, auth_data) {
get_user_login_info(object, method, params, login_data, auth_data) {
//
var data = {
auth_data: JSON.stringify(auth_data),
@ -483,7 +486,7 @@
if (res.data.code == 0) {
uni.setStorageSync(self.data.cache_user_info_key, res.data.data);
if (typeof object === 'object' && (method || null) != null) {
object[method]();
object[method](params);
}
} else {
self.showToast(res.data.msg);
@ -798,12 +801,13 @@
/**
* 登录校验
* object 回调操作对象
* method 回调操作对象的函数
* method 回调操作对象的函数
* params 回调请求参数
*/
is_login_check(res, object, method) {
is_login_check(res, object, method, params) {
if (res.code == -400) {
uni.clearStorage();
this.get_user_info(object, method);
this.get_user_info(object, method, params);
return false;
}
return true;
@ -1743,6 +1747,50 @@
object[method](0);
}
// #endif
},
// 0 1
start_location_update(type = 0, object, method) {
//
uni.stopLocationUpdate();
//
uni.offLocationChange();
// api
if(type == 0) {
//
uni.startLocationUpdate({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({status: 0, msg: res.errMsg});
}
}
});
} else {
//
uni.startLocationUpdateBackground({
success: (res) => {
this.start_location_update_change(object, method);
},
fail: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({status: 0, msg: res.errMsg});
}
}
});
}
},
//
start_location_update_change(object, method) {
uni.onLocationChange((res) => {
if (typeof object === 'object' && (method || null) != null) {
object[method]({status: 1, lat: res.longitude, lng: res.latitude, data: res});
}
});
}
},

View File

@ -174,6 +174,9 @@ button:before {
}
.dis-inline-block {
display: inline-block !important;
}
.va-t {
vertical-align: top;
}
.va-m {
vertical-align: middle;
@ -356,6 +359,9 @@ button:before {
}
.br-blue {
border: solid 1px #2196F3 !important;
}
.br-base {
border: solid 1px #666 !important;
}
.br-0 {
border: 0 !important;

View File

@ -49,7 +49,7 @@
},
"quickapp" : {},
"mp-weixin" : {
"requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress" ],
"requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress", "onLocationChange", "startLocationUpdate", "startLocationUpdateBackground" ],
"appid" : "wxda7779770f53e901",
"setting" : {
"urlCheck" : false,

View File

@ -989,6 +989,25 @@
}
}
]
},
{
"root": "pages/plugins/delivery",
"pages": [
{
"path": "order/order",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "配送订单"
}
},
{
"path": "order-detail/order-detail",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "订单详情"
}
}
]
}
],
"globalStyle": {

View File

@ -580,7 +580,7 @@
// auth_data
user_auth_code(auth_data) {
if ((auth_data || null) != null) {
app.globalData.user_auth_login(this, 'user_auth_back_event', auth_data);
app.globalData.user_auth_login(this, 'user_auth_back_event', null, auth_data);
} else {
app.globalData.showToast("授权失败");
}

View File

@ -0,0 +1,37 @@
/*
*
*/
.goods-base {
min-height: 160rpx;
margin-left: 180rpx;
}
.goods .goods-item:last-child {
border-bottom: 0;
}
.goods-image {
width: 160rpx;
height: 160rpx;
}
/*
*
*/
.address-base,
.address-detail {
padding: 10rpx 0;
}
.address-detail .icon {
width: 30rpx;
height: 35rpx !important;
}
.address-detail .text {
width: calc(100% - 40rpx);
}
.address-detail .text {
line-height: 36rpx;
}
.address-alias,
.address-map-submit {
padding: 0 15rpx;
line-height: 40rpx;
}

View File

@ -0,0 +1,218 @@
<template>
<view>
<view v-if="detail != null">
<view class="padding-horizontal-main padding-top-main">
<!-- 地址 -->
<view v-if="(detail.address_data || null) != null" class="goods bg-white padding-main border-radius-main spacing-mb">
<view class="address-base oh">
<text v-if="(detail.address_data.alias || null) != null" class="address-alias round br-main cr-main bg-white margin-right-sm">{{detail.address_data.alias}}</text>
<text data-event="copy" :data-value="detail.address_data.name" @tap="text_event">{{detail.address_data.name}}</text>
<text class="fr" data-event="tel" :data-value="detail.address_data.tel" @tap="text_event">{{detail.address_data.tel}}</text>
</view>
<view class="address-detail oh margin-bottom-main">
<image class="icon fl" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
<view class="text fr">
<text data-event="copy" :data-value="detail.address_data.address_info" @tap="text_event">{{detail.address_data.address_info}}</text>
<text v-if="(detail.address_data.lng || 0) != 0 && (detail.address_data.lat || 0) != 0" class="address-map-submit cr-base br round bg-white margin-left-sm text-size-xs" @tap="address_map_event"></text>
</view>
</view>
<view class="address-divider spacing-mb"></view>
</view>
<!-- 基础信息 -->
<view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">基础信息</view>
<view class="panel-content oh">
<view v-for="(item, index) in detail_list" :key="index" class="item br-b-dashed oh padding-vertical-main">
<view class="title fl padding-right-main cr-gray">{{item.name}}</view>
<block v-if="(item.event || null) == null">
<view class="content fl br-l padding-left-main">{{item.value}}</view>
</block>
<block v-else>
<view data-event="copy" :data-value="item.value" @tap="text_event" class="content fl br-l padding-left-main">{{item.value}}</view>
</block>
</view>
</view>
</view>
<!-- 商品列表 -->
<view v-if="detail.goods_data.length > 0" class="goods bg-white padding-main border-radius-main spacing-mb">
<view class="br-b padding-bottom-main fw-b text-size">商品信息</view>
<view v-for="(item, index) in detail.goods_data" :key="index" class="goods-item br-b-dashed oh padding-main">
<navigator :url="item.goods_url" hover-class="none">
<image class="goods-image fl radius" :src="item.images" mode="aspectFill"></image>
<view class="goods-base pr">
<view class="multi-text">{{item.title}}</view>
<view v-if="item.spec != null" class="margin-top-sm">
<block v-for="(sv, si) in item.spec" :key="si">
<text v-if="si > 0" class="cr-grey padding-left-xs padding-right-xs">;</text>
<text class="cr-gray">{{sv.value}}</text>
</block>
</view>
<view class="margin-top-sm">
<text class="fw-b">{{detail.currency_data.currency_symbol}}{{item.price}}</text>
<text class="margin-left-sm">x{{item.buy_number}}</text>
</view>
<view v-if="detail.is_can_launch_aftersale == 1 && (item.orderaftersale_btn_text || null) != null" class="orderaftersale-btn-text cr-blue pa bg-white" @tap.stop="orderaftersale_event" :data-oid="detail.id" :data-did="item.id">{{item.orderaftersale_btn_text}}</view>
</view>
</navigator>
</view>
<view class="padding-top-main tr cr-base text-size">
<text><text class="fw-b">{{detail.buy_number_count}}</text> 合计 <text class="sales-price margin-right-xs">{{detail.currency_data.currency_symbol}}{{detail.total_price}}</text></text>
</view>
</view>
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
</view>
</template>
<script>
const app = getApp();
import componentNoData from "../../../../components/no-data/no-data";
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
var common_static_url = app.globalData.get_static_url('common');
export default {
data() {
return {
common_static_url: common_static_url,
params: null,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_bottom_line_status: false,
detail: null,
detail_list: []
};
},
components: {
componentNoData,
componentBottomLine
},
props: {},
onLoad(params) {
//params['id'] = 1;
this.setData({
params: params
});
this.init();
},
onShow() {
//
app.globalData.page_share_handle();
},
//
onPullDownRefresh() {
this.init();
},
methods: {
init() {
uni.showLoading({
title: '加载中...'
});
this.setData({
data_list_loding_status: 1
});
uni.request({
url: app.globalData.get_request_url("detail", "order", "delivery"),
method: 'POST',
data: {
id: this.params.id
},
dataType: 'json',
success: res => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
detail: data.data,
detail_list: [
{ name: "订单号", value: data.data.main_order_no || '', event: 'copy' },
{ name: "订单金额", value: data.data.total_price + ' 元' || '' },
{ name: "退款金额", value: data.data.refund_price + ' 元' || '' },
{ name: "订单状态", value: data.data.main_status_name || '' },
{ name: "商品数量", value: data.data.buy_number_count || '' },
{ name: "配送状态", value: data.data.status_name || '' },
{ name: "配送时间", value: data.data.start_delivery_time || '' },
{ name: "完成时间", value: data.data.success_delivery_time || '' },
{ name: "异常时间", value: data.data.abnormal_delivery_time || '' },
{ name: "异常原因", value: data.data.reason || '' },
{ name: "派单时间", value: data.data.add_time || '' },
{ name: "更新时间", value: data.data.upd_time || '' },
{ name: "订单时间", value: data.data.order_add_time || '' },
],
data_list_loding_status: 3,
data_bottom_line_status: true,
data_list_loding_msg: ''
});
} else {
this.setData({
data_list_loding_status: 2,
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg
});
if (app.globalData.is_login_check(res.data, this, 'init')) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_bottom_line_status: false,
data_list_loding_msg: '服务器请求出错'
});
app.globalData.showToast('服务器请求出错');
}
});
},
//
avatar_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value != null) {
uni.previewImage({
current: value,
urls: [value]
});
} else {
app.globalData.showToast('头像地址有误');
}
},
//
text_event(e) {
app.globalData.text_event_handle(e);
},
//
address_map_event(e) {
if ((this.detail.address_data || null) == null) {
app.globalData.showToast("地址有误");
return false;
}
//
var data = this.detail.address_data;
var name = data.alias || data.name || '';
app.globalData.open_location(data.lng, data.lat, name, data.address_info);
}
}
};
</script>
<style>
@import './order-detail.css';
</style>

View File

@ -0,0 +1,36 @@
/*
*
*/
.header {
height: 180rpx;
}
.nav-base .item {
width: 20%;
}
.nav-base .item .badge-icon {
top: -18rpx;
left: calc(50% + 52rpx);
z-index: 1;
}
.nav-search input {
width: calc(100% - 180rpx);
}
/**
*
*/
.scroll-box {
height: calc(100vh - 180rpx);
}
.data-list .address-info {
width: calc(100% - 158rpx);
word-wrap: break-word;
word-break: break-all;
}
.data-list .address-info .icon-item {
right: 0;
top: 0;
line-height: 54rpx;
height: 54rpx;
width: 54rpx;
}

View File

@ -0,0 +1,512 @@
<template>
<view>
<view v-if="nav_type_list.length > 0" class="header bg-white">
<!-- 导航 -->
<view class="nav-base">
<block v-for="(item, index) in nav_type_list" :key="index">
<view :class="'item fl tc cr-gray pr ' + (nav_type_index == index ? 'cr-main' : '')" :data-index="index" @tap="nav_event">
<text>{{item.name}}</text>
<view class="badge-icon pa">
<component-badge :propNumber="item.count || 0"></component-badge>
</view>
</view>
</block>
</view>
<!-- 关键字搜索 -->
<view class="padding-horizontal-main padding-bottom-main margin-top-xs">
<view class="padding-left-main nav-search round br-main oh">
<input class="text-size-sm padding-left-sm padding-top-sm padding-bottom-xs dis-inline-block va-m" placeholder-class="cr-grey" placeholder="输入订单号/收件人/收件电话" @input="search_input_keywords_event" />
<button type="default" size="mini" class="br-main cr-white bg-main fr radius-0" @tap="search_submit_event"></button>
</view>
</view>
</view>
<!-- 列表 -->
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
<block v-if="data_list.length > 0">
<view class="data-list padding-horizontal-main padding-top-main">
<view v-for="(item, index) in data_list" :key="index" class="item padding-main border-radius-main oh bg-white spacing-mb">
<view class="base oh br-b padding-bottom-main">
<text class="cr-base">{{item.add_time_concise || item.add_time}}</text>
<text :class="'fr '+((item.status == 4 ? 'cr-red' : (item.status == 3 ? 'cr-green' : (item.status == 2 ? 'cr-main' : 'cr-grey'))))">{{item.status_name}}</text>
</view>
<view class="content margin-top">
<view class="single-text margin-top-sm">
<text class="cr-gray">单号</text>
<text class="cr-base" data-event="copy" :data-value="item.main_order_no" @tap="text_event">{{item.main_order_no}}</text>
</view>
<view v-if="(item.address_data || null) != null">
<view class="single-text margin-top-sm">
<text class="cr-gray">姓名</text>
<text class="cr-base" data-event="copy" :data-value="item.address_data.name" @tap="text_event">{{item.address_data.name}}</text>
</view>
<view class="single-text margin-top-sm">
<text class="cr-gray">电话</text>
<text class="cr-base" data-event="copy" :data-value="item.address_data.tel" @tap="text_event">{{item.address_data.tel}}</text>
</view>
<view class="margin-top-sm pr">
<text class="cr-gray va-t">地址</text>
<view class="dis-inline-block address-info">
<text class="cr-base" data-event="copy" :data-value="item.address_data.address_info" @tap="text_event">{{item.address_data.address_info}}</text>
<view v-if="(item.address_data.lng || 0) != 0 && (item.address_data.lat || 0) != 0" class="icon-item bg-base circle dis-inline-block tc cp pa" :data-index="index" @tap.stop="address_map_event">
<uni-icons type="paperplane-filled" size="32rpx" color="#666"></uni-icons>
</view>
</view>
</view>
</view>
<view v-else class="single-text margin-top-sm">
<text class="cr-gray">地址</text>
<text class="cr-grey-white">没有地址信息</text>
</view>
<view class="margin-top-lg padding-top-sm br-t-dashed">
<text>{{item.describe}}</text>
<text v-if="(item.distance || null) != null" class="fr cr-grey">{{item.distance}}</text>
</view>
</view>
<view class="item-operation tr br-t padding-top-main margin-top-main">
<button v-if="item.status == 1" class="round bg-white br-blue cr-blue" type="default" size="mini" hover-class="none" :data-index="index" @tap="start_delivery_event"></button>
<button v-if="item.status == 4" class="round bg-white br-main cr-main" type="default" size="mini" hover-class="none" :data-index="index" @tap="start_delivery_event"></button>
<block v-if="item.status == 2">
<button class="round bg-white br-green cr-green" type="default" size="mini" hover-class="none" :data-index="index" @tap="success_delivery_event"></button>
<button class="round bg-white br-red cr-red" type="default" size="mini" hover-class="none" :data-index="index" @tap="popup_abnormal_content_event"></button>
</block>
<button class="round bg-white br-base cr-base" type="default" size="mini" hover-class="none" :data-value="'/pages/plugins/delivery/order-detail/order-detail?id='+item.id" @tap="url_event"></button>
</view>
</view>
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
</block>
<block v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
</block>
</scroll-view>
<!-- 异常订单原因填写 -->
<component-popup :propShow="popup_abnormal_content_status" propPosition="bottom" @onclose="popup_abnormal_content_close_event">
<view class="padding-horizontal-main padding-top-main bg-white">
<view class="close oh">
<view class="fr" @tap.stop="popup_abnormal_content_close_event">
<icon type="clear" size="46rpx"></icon>
</view>
</view>
<form @submit="form_delivery_submit_event" class="form-container">
<view class="form-container">
<view class="form-gorup">
<view class="form-gorup-title">异常原因</view>
<view class="br padding-main radius margin-top">
<textarea name="msg" placeholder-class="cr-grey" class="cr-base margin-0" placeholder="异常原因最多200个字符" maxlength="200" :auto-height="true"></textarea>
</view>
</view>
<view class="form-gorup form-gorup-submit">
<button class="bg-main br-main cr-white round text-size" type="default" form-type="submit" hover-class="none">提交</button>
</view>
</view>
</form>
</view>
</component-popup>
</view>
</template>
<script>
const app = getApp();
import componentNoData from "../../../../components/no-data/no-data";
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
import componentBadge from "../../../../components/badge/badge";
import componentPopup from "../../../../components/popup/popup";
export default {
data() {
return {
data_list: [],
data_total: 0,
data_page_total: 0,
data_page: 1,
data_list_loding_status: 1,
data_bottom_line_status: false,
data_is_loading: 0,
params: null,
nav_type_list: [],
nav_type_index: 0,
latitude: 0,
longitude: 0,
search_input_keywords_value: '',
popup_abnormal_content_status: false,
popup_abnormal_data_index: null
};
},
components: {
componentNoData,
componentBottomLine,
componentBadge,
componentPopup
},
props: {},
onLoad(params) {
this.setData({
params: params
});
this.init();
//
app.globalData.page_share_handle();
},
onShow() {
//
this.start_location_update();
},
//
onPullDownRefresh() {
this.setData({
data_page: 1
});
this.get_data_list(1);
},
methods: {
//
init() {
var user = app.globalData.get_user_info(this, 'init');
if (user != false) {
//
if (app.globalData.user_is_need_login(user)) {
uni.redirectTo({
url: "/pages/login/login?event_callback=init"
});
return false;
} else {
//
app.globalData.get_location_check('scope.userLocation', this, 'location_back_handle');
}
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false
});
}
},
//
start_location_update(e = null) {
if(e == null) {
app.globalData.start_location_update(0, this, 'start_location_update');
} else {
if((e.status || 0) == 1) {
//
this.setData({
latitude: e.lat,
longitude: e.lng
});
//
uni.request({
url: app.globalData.get_request_url("locationreport", "user", "delivery"),
method: 'POST',
data: {
lat: e.lat,
lng: e.lng
},
dataType: 'json'
});
} else {
console.log('error', e);
}
}
},
//
location_back_handle(status = 0) {
var self = this;
if(status == 1) {
uni.getLocation({
type: 'wgs84',
success: function (res) {
self.setData({
longitude: res.longitude,
latitude: res.latitude,
});
//
self.get_data_list();
}
});
} else {
if(app.globalData.data.is_distribution_map_force_location == 1) {
uni.navigateTo({
url: '/pages/common/open-setting-location/open-setting-location?is_check_success_back=1'
});
} else {
//
self.get_data_list();
}
}
},
//
get_data_list(is_mandatory) {
//
if ((is_mandatory || 0) == 0) {
if (this.data_bottom_line_status == true) {
uni.stopPullDownRefresh();
return false;
}
}
//
if(this.data_is_loading == 1) {
return false;
}
this.setData({
data_is_loading: 1,
data_list_loding_status: 1
});
// loding
uni.showLoading({
title: '加载中...'
});
//
var type = (this.nav_type_list[this.nav_type_index] || null) == null ? -1 : this.nav_type_list[this.nav_type_index]['value'];
//
uni.request({
url: app.globalData.get_request_url("index", "order", "delivery"),
method: 'POST',
data: {
page: this.data_page,
type: type,
keywords: this.search_input_keywords_value || '',
lat: this.latitude,
lng: this.longitude
},
dataType: 'json',
success: res => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
if (this.data_page <= 1) {
var temp_data_list = data.data || [];
} else {
var temp_data_list = this.data_list || [];
var temp_data = data.data;
for (var i in temp_data) {
temp_data_list.push(temp_data[i]);
}
}
this.setData({
nav_type_list: data.nav_type_list || [],
data_list: temp_data_list,
data_total: data.total,
data_page_total: data.page_total,
data_list_loding_status: (temp_data_list.length > 0) ? 3 : 0,
data_page: this.data_page + 1,
data_is_loading: 0
});
//
this.setData({
data_bottom_line_status: (this.data_page > 1 && this.data_page > this.data_page_total)
});
} else {
this.setData({
data_list_loding_status: 0,
data_is_loading: 0
});
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_is_loading: 0
});
app.globalData.showToast('服务器请求出错');
}
});
},
//
scroll_lower(e) {
this.get_data_list();
},
//
nav_event(e) {
this.setData({
nav_type_index: e.currentTarget.dataset.index || 0,
data_page: 1
});
this.get_data_list(1);
},
//
text_event(e) {
app.globalData.text_event_handle(e);
},
// url
url_event(e) {
app.globalData.url_event(e);
},
//
search_input_keywords_event(e) {
this.setData({
search_input_keywords_value: e.detail.value,
})
},
//
search_submit_event(e) {
this.setData({
data_page: 1
});
this.get_data_list(1);
},
//
address_map_event(e) {
var index = e.currentTarget.dataset.index;
var temp_data = this.data_list;
if ((temp_data[index] || null) == null || (temp_data[index]['address_data'] || null) == null) {
app.globalData.showToast("地址有误");
return false;
}
//
var data = temp_data[index]['address_data'];
var name = data.alias || data.name || '';
app.globalData.open_location(data.lng, data.lat, name, data.address_info);
},
//
popup_abnormal_content_event(e) {
this.setData({
popup_abnormal_content_status: true,
popup_abnormal_data_index: e.currentTarget.dataset.index,
});
},
//
popup_abnormal_content_close_event(e) {
this.setData({
popup_abnormal_content_status: false
});
},
//
start_delivery_event(e) {
uni.showModal({
title: '温馨提示',
content: '确定开始配送订单吗?',
confirmText: '确认',
cancelText: '暂不',
success: result => {
if (result.confirm) {
this.order_status_handle({
index: e.currentTarget.dataset.index,
new_status: 2,
status_name: '配送中',
action: 'startdelivery'
});
}
}
});
},
//
success_delivery_event(e) {
uni.showModal({
title: '温馨提示',
content: '确定订单已配送到客户地址?',
confirmText: '确认',
cancelText: '没有',
success: result => {
if (result.confirm) {
this.order_status_handle({
index: e.currentTarget.dataset.index,
new_status: 3,
status_name: '已配送',
action: 'successdelivery'
});
}
}
});
},
//
form_delivery_submit_event(e) {
var msg = e.detail.value.msg || null;
if(msg == null) {
app.globalData.showToast('请填写原因');
} else {
this.order_status_handle({
index: this.popup_abnormal_data_index,
new_status: 4,
status_name: '异常',
action: 'abnormaldelivery',
msg: msg
});
}
},
//
order_status_handle(params) {
var temp_data = this.data_list;
uni.showLoading({
title: '处理中...'
});
uni.request({
url: app.globalData.get_request_url(params.action, "order", "delivery"),
method: 'POST',
data: {
id: temp_data[params.index]['id'],
msg: params.msg || ''
},
dataType: 'json',
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
var temp_nav = this.nav_type_list;
for(var i in temp_nav) {
if(temp_nav[i]['value'] == temp_data[params.index]['status'] && (temp_nav[i]['count'] || 0) != 0) {
temp_nav[i]['count'] = parseInt(temp_nav[i]['count'])-1;
}
if(temp_nav[i]['value'] == params.new_status) {
temp_nav[i]['count'] = parseInt(temp_nav[i]['count'] || 0)+1;
}
}
temp_data[params.index]['status'] = params.new_status;
temp_data[params.index]['status_name'] = params.status_name;
this.setData({
data_list: temp_data,
nav_type_list: temp_nav,
popup_abnormal_content_status: false
});
app.globalData.showToast(res.data.msg, 'success');
} else {
if (app.globalData.is_login_check(res.data, this, 'order_status_handle', params)) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast('服务器请求出错');
}
});
}
}
};
</script>
<style>
@import './order.css';
</style>

View File

@ -76,10 +76,12 @@
const app = getApp();
import componentNoData from "../../../../components/no-data/no-data";
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
var common_static_url = app.globalData.get_static_url('common');
export default {
data() {
return {
return {
common_static_url: common_static_url,
params: null,
data_list_loding_status: 1,
data_list_loding_msg: '',

View File

@ -13,7 +13,7 @@
<image class="icon fl" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
<view class="text fr">
<text>{{detail.address_data.province_name}}{{detail.address_data.city_name}}{{detail.address_data.county_name}}{{detail.address_data.address}}</text>
<text v-if="detail.order_model == 2 && (detail.address_data.lng || 0) != 0 && (detail.address_data.lat || 0 && detail.address_data.lng != 0 && detail.address_data.lat != 0) != 0" class="address-map-submit cr-base br round bg-white margin-left-sm text-size-xs" @tap="address_map_event"></text>
<text v-if="detail.order_model == 2 && (detail.address_data.lng || 0) != 0 && (detail.address_data.lat || 0) != 0" class="address-map-submit cr-base br round bg-white margin-left-sm text-size-xs" @tap="address_map_event"></text>
</view>
</view>
<view class="address-divider spacing-mb"></view>