小程序分销开发

This commit is contained in:
devil 2020-01-18 18:20:51 +08:00
parent 5c553e913e
commit 552e6abbf3
11 changed files with 207 additions and 63 deletions

View File

@ -1,8 +1,8 @@
{
"pages": [
"pages/plugins/distribution/extraction-order/extraction-order",
"pages/plugins/distribution/extraction/extraction",
"pages/plugins/distribution/extraction-apply/extraction-apply",
"pages/plugins/distribution/extraction-order/extraction-order",
"pages/plugins/distribution/user/user",
"pages/index/index",
"pages/goods-category/goods-category",

View File

@ -10,9 +10,6 @@ Page({
city_id: null,
county_id: null,
lng: 0,
lat: 0,
default_province: "请选择省",
default_city: "请选择市",
default_county: "请选择区/县",
@ -338,12 +335,34 @@ Page({
// 验证提交表单
if (app.fields_check(form_data, validation)) {
self.setData({ form_submit_disabled_status: true});
if ((self.data.extraction_data || null) != null && (self.data.extraction_data.status || 0) == 1)
{
wx.showModal({
title: '温馨提示',
content: '数据需重新审核后方可生效',
confirmText: '确认',
cancelText: '暂不',
success: (result) => {
if (result.confirm) {
self.request_data_save(form_data);
}
},
});
} else {
self.request_data_save(form_data);
}
}
},
// 数据保存
request_data_save(data) {
var self = this;
self.setData({ form_submit_disabled_status: true });
wx.showLoading({ title: "处理中..." });
wx.request({
url: app.get_request_url("applysave", "extraction", "distribution"),
method: "POST",
data: form_data,
data: data,
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
@ -368,6 +387,5 @@ Page({
app.showToast("服务器请求出错");
}
});
}
},
});

View File

@ -4,5 +4,5 @@
"backgroundColorTop": "#ff6a80",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "取货点申请"
"navigationBarTitleText": "取货点信息"
}

View File

@ -1,4 +1,4 @@
<form bindsubmit="form_submit"class="form-container spacing-mb oh">
<form bindsubmit="form_submit" class="form-container spacing-mb oh">
<view class="form-gorup bg-white">
<view class="form-gorup-title">别名<text class="form-group-tips">选填</text></view>
<input type="text" name="alias" value="{{extraction_data.alias || ''}}" placeholder-class="cr-ccc" class="cr-666" placeholder="别名格式最多 16 个字符" />
@ -51,6 +51,9 @@
</view>
<view class="form-gorup">
<view wx:if="{{(extraction_data || null) != null && (extraction_data.status || 0) == 1}}" class="tips spacing-mb">
注意:编辑信息将重新审核后方可生效
</view>
<button class="submit-bottom" type="default" formType="submit" hover-class="none" disabled="{{form_submit_disabled_status}}">提交</button>
</view>
</form>

View File

@ -10,15 +10,20 @@ Page({
nav_status_list: [
{ name: "全部", value: "-1" },
{ name: "待取货", value: "0" },
{ name: "已取货", value: "1" }
{ name: "待处理", value: "0" },
{ name: "已处理", value: "1" }
],
nav_status_index: -1,
nav_status_index: 0,
is_show_take_popup: false,
extraction_value: null,
extraction_code: '',
form_submit_disabled_status: false,
},
onLoad(params) {
// 是否指定状态
var nav_status_index = -1;
var nav_status_index = 0;
if (params.status != undefined) {
for (var i in this.data.nav_status_list) {
if (this.data.nav_status_list[i]['value'] == params.status) {
@ -163,4 +168,78 @@ Page({
});
this.get_data_list(1);
},
// 取件码弹层-开启
list_submit_take_event(e) {
this.setData({
is_show_take_popup: true,
extraction_code: '',
extraction_value: {
index: e.currentTarget.dataset.index,
oid: e.currentTarget.dataset.oid,
uid: e.currentTarget.dataset.uid
},
});
},
// 取件码弹层-关闭
take_popup_event_close() {
this.setData({ is_show_take_popup: false });
},
// 取件码输入事件
extraction_code_input_event(e) {
this.setData({ extraction_code: e.detail.value || ''});
},
// 取件提交
form_submit_take_event(e) {
var self = this;
// 参数
if ((self.data.extraction_code || null) == null)
{
app.showToast('请输入取件码');
return false;
}
if ((self.data.extraction_value || null) == null) {
app.showToast('操作数据有误');
return false;
}
// 提交表单
var data = {
id: self.data.extraction_value.oid,
user_id: self.data.extraction_value.uid,
extraction_code: self.data.extraction_code,
};
self.setData({ form_submit_disabled_status: true });
wx.request({
url: app.get_request_url("take", "extraction", "distribution"),
method: "POST",
data: data,
dataType: "json",
success: res => {
self.setData({ form_submit_disabled_status: false });
wx.hideLoading();
if (res.data.code == 0) {
var temp_data_list = this.data.data_list;
var index = self.data.extraction_value.index;
temp_data_list[index]['status'] = 1;
temp_data_list[index]['status_name'] = '已处理';
self.setData({
is_show_take_popup: false,
data_list: temp_data_list,
});
app.showToast(res.data.msg, "success");
} else {
app.showToast(res.data.msg);
}
},
fail: () => {
self.setData({ form_submit_disabled_status: false });
wx.hideLoading();
app.showToast("服务器请求出错");
}
});
},
});

View File

@ -4,5 +4,8 @@
"backgroundColorTop": "#ff6a80",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "取货订单"
"navigationBarTitleText": "取货订单",
"usingComponents": {
"component-popup": "/components/popup/popup"
}
}

View File

@ -11,7 +11,7 @@
<view class="item bg-white spacing-mb" wx:if="{{data_list.length > 0}}" wx:for="{{data_list}}" wx:key="key">
<view class="base oh br-b">
<text class="fl cr-666">{{item.add_time}}</text>
<text class="fr nickname cr-888">{{item.order_status_name}}</text>
<text class="fr nickname cr-888">{{item.status_name}}</text>
</view>
<view class="content">
<view class="multi-text">
@ -25,8 +25,8 @@
</view>
</view>
<view wx:if="{{item.order_status == 2}}" class="operation tr br-t-dashed">
<button class="cr-888 br" type="default" size="mini" hover-class="none" class="br submit-take">取货</button>
<view wx:if="{{item.status == 0}}" class="operation tr br-t-dashed">
<button class="cr-888 br" type="default" size="mini" hover-class="none" class="br" data-index="{{index}}" data-oid="{{item.order_id}}" data-uid="{{item.order_user_id}}" bindtap="list_submit_take_event">取货</button>
</view>
</view>
@ -40,3 +40,16 @@
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</view>
</scroll-view>
<!-- 取货 popup -->
<component-popup prop-show="{{is_show_take_popup}}" prop-position="bottom" bindonclose="take_popup_event_close">
<view class="form-container spacing-mt">
<view class="form-gorup tc">
<view class="form-gorup-title">取货码</view>
<input type="number" value="{{extraction_code}}" placeholder-class="cr-ccc" class="cr-666 br-b spacing-mt" placeholder="请输入取货码" maxlength="4" bindinput="extraction_code_input_event" />
</view>
<view class="form-gorup">
<button class="submit-bottom" type="default" hover-class="none" disabled="{{form_submit_disabled_status}}" bindtap="form_submit_take_event">确认</button>
</view>
</view>
</component-popup>

View File

@ -55,3 +55,11 @@
.data-list .item .operation button:not(:first-child) {
margin-left: 30rpx;
}
/*
* 表单
*/
.submit-bottom {
background-color: #ff6a80 !important;
color: #fff !important;
}

View File

@ -6,6 +6,7 @@ Page({
data_list_loding_msg: '',
data_base: null,
extraction: null,
statistical: null,
},
onLoad(params) {},
@ -51,6 +52,7 @@ Page({
self.setData({
data_base: data.base || null,
extraction: data.extraction || null,
statistical: data.statistical || null,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: true,
@ -87,7 +89,6 @@ Page({
// 地图查看
address_map_event(e) {
if ((this.data.extraction || null) == null) {
app.showToast("地址有误");
return false;
}
@ -95,7 +96,6 @@ Page({
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
if (lng <= 0 || lat <= 0) {
app.showToast("坐标有误");
return false;
}

View File

@ -32,31 +32,43 @@
</view>
<!-- 审核通过 -->
<view wx:elif="{{extraction.status == 1}}" class="valid">
<view wx:elif="{{extraction.status == 1 || extraction.status == 3}}" class="valid">
<view class="base br-b oh bg-white">
<view class="base-title fl">取货点信息</view>
<view wx:if="{{(extraction.lng || 0) > 0 && (extraction.lat || 0) > 0}}" class="base-map-submit fr" bindtap="address_map_event">查看位置</view>
<view class="fr edit-submit">
<navigator url="/pages/plugins/distribution/extraction-apply/extraction-apply" hover-class="none">编辑信息</navigator>
</view>
<view class="content bg-white">
</view>
<view class="content bg-white" bindtap="address_map_event">
<text wx:if="{{(extraction.alias || null) != null}}" class="alias">{{extraction.alias}}</text>
<text class="cr-666">{{extraction.province_name}}{{extraction.city_name}}{{extraction.county_name}}{{extraction.address}}</text>
</view>
<view wx:if="{{extraction.status == 1}}" >
<view class="base br-b oh bg-white spacing-mt">
<view class="base-title">取货订单统计</view>
<view class="base-title fl">取货订单统计</view>
<view class="fr edit-submit">
<navigator url="/pages/plugins/distribution/extraction-order/extraction-order" hover-class="none">查看取货订单</navigator>
</view>
</view>
<view class="content bg-white statistics oh">
<view class="item fl tc" data-value="0" bindtap="order_event">
<view class="title cr-666">待处理</view>
<view class="value single-text">4544543564634534635635</view>
<view class="value single-text order-wait-value">{{statistical.order_wait || 0}}</view>
</view>
<view class="item fl tc br-l" data-value="1" bindtap="order_event">
<view class="title cr-666">已处理</view>
<view class="value single-text">67769865787657635325454546</view>
<view class="value single-text order-already-value">{{statistical.order_already || 0}}</view>
</view>
</view>
</view>
<view wx:else class="spacing-mt relieve">
<view class="tips">
当前状态也解约,可重新编辑数据提交审核。
</view>
</view>
<view wx:if="{{(data_base || null) != null && (data_base.self_extraction_common_notice || null) != null && data_base.self_extraction_common_notice.length > 0}}" class="extraction-notice spacing-mt">
<view wx:if="{{extraction.status == 1 && (data_base || null) != null && (data_base.self_extraction_common_notice || null) != null && data_base.self_extraction_common_notice.length > 0}}" class="extraction-notice spacing-mt">
<view class="tips">
<view wx:for="{{data_base.self_extraction_common_notice}}" wx:key="key" class="item">
{{item}}

View File

@ -54,8 +54,8 @@
border-radius: 6rpx;
margin-right: 10rpx;
}
.valid .base-map-submit {
color: #ff6a80;
.valid .edit-submit {
color: #0e90d2;
}
.valid .content {
line-height: 46rpx;
@ -76,7 +76,15 @@
font-weight: bold;
font-size: 36rpx;
margin-top: 10rpx;
color: #ff6a80;
}
.valid .statistics .item .order-wait-value {
color: #f00;
}
.valid .statistics .item .order-already-value {
color: #2ba245;
}
.valid .relieve {
padding: 0 10rpx;
}
/*