小程序开发

feat/task1-c-wallet
devil 2020-01-17 19:44:36 +08:00
parent 9a99eb926f
commit 5c553e913e
25 changed files with 1240 additions and 31 deletions

View File

@ -292,6 +292,9 @@ textarea {
padding: 10rpx;
min-height: 70rpx;
}
.form-container .form-gorup-text {
padding: 20rpx 10rpx;
}
/**
* 表单图片上传

View File

@ -360,6 +360,9 @@ button[disabled].bg-primary {
padding: 0;
min-height: 70rpx;
}
.form-container .form-gorup-text {
padding: 20rpx 10rpx;
}
/**
*

View File

@ -368,6 +368,9 @@ button[disabled].bg-primary {
padding: 0;
min-height: 70rpx;
}
.form-container .form-gorup-text {
padding: 20rpx 10rpx;
}
/**
* 表单图片上传

View File

@ -369,6 +369,9 @@ button[disabled].bg-primary {
padding: 0;
min-height: 70rpx;
}
.form-container .form-gorup-text {
padding: 20rpx 10rpx;
}
/**
* 表单图片上传

View File

@ -1,5 +1,9 @@
{
"pages": [ "pages/plugins/distribution/user/user",
"pages": [
"pages/plugins/distribution/extraction-order/extraction-order",
"pages/plugins/distribution/extraction/extraction",
"pages/plugins/distribution/extraction-apply/extraction-apply",
"pages/plugins/distribution/user/user",
"pages/index/index",
"pages/goods-category/goods-category",
"pages/cart/cart",
@ -39,8 +43,6 @@
"pages/plugins/membershiplevelvip/statistics/statistics",
"pages/plugins/membershiplevelvip/poster/poster",
"pages/plugins/membershiplevelvip/team/team",
"pages/plugins/distribution/order/order",
"pages/plugins/distribution/order-detail/order-detail",
"pages/plugins/distribution/profit/profit",
@ -48,8 +50,14 @@
"pages/plugins/distribution/statistics/statistics",
"pages/plugins/distribution/poster/poster",
"pages/plugins/distribution/team/team",
"pages/plugins/distribution/introduce/introduce"
"pages/plugins/distribution/introduce/introduce",
"pages/common/open-setting-location/open-setting-location"
],
"permission": {
"scope.userLocation": {
"desc": "你的位置将用于小程序中相应业务位置服务使用"
}
},
"window": {
"navigationBarTitleText": "{{application_title}}",
"navigationBarBackgroundColor": "#d2364c",

View File

@ -368,6 +368,9 @@ button[disabled].bg-primary {
padding: 0;
min-height: 70rpx;
}
.form-container .form-gorup-text {
padding: 20rpx 10rpx;
}
/**
* 表单图片上传

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

View File

@ -0,0 +1,61 @@
const app = getApp();
Page({
data: {
params: null,
is_show_open_setting: false,
auth: 'scope.userLocation',
cache_key: 'cache_userlocation_key',
},
onLoad: function (params) {
this.setData({ params: params });
this.init();
},
// 获取权限
init() {
var self = this;
wx.getSetting({
success(res) {
if (!res.authSetting[self.data.auth]) {
wx.authorize({
scope: self.data.auth,
success(res) {
self.choose_location();
},
fail: (res) => {
self.setData({ is_show_open_setting: true });
}
})
} else {
self.choose_location();
}
},
fail: (res) => {
app.showToast("请先获取授权");
}
});
},
// 位置服务回调方法
setting_callback_event(e) {
var self = this;
if (e.detail.authSetting[self.data.auth]) {
self.setData({ is_show_open_setting: false });
self.choose_location();
}
},
// 打开位置服务
choose_location() {
wx.chooseLocation({
success: res => {
wx.setStorageSync(this.data.cache_key, res);
wx.navigateBack();
},
fail: (res) => {
wx.navigateBack();
}
});
},
});

View File

@ -0,0 +1,4 @@
{
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}

View File

@ -0,0 +1,10 @@
<view wx:if="{{is_show_open_setting}}" class="open-setting-view">
<view class="content bg-white">
<view class="msg cr-888">开启相应的权限服务</view>
<view class="value cr-666">获取[ <text>位置信息</text> ]权限</view>
<button type="primary" open-type="openSetting" size="mini" bindopensetting="setting_callback_event">打开设置页</button>
</view>
</view>
<view wx:else class="open-setting-loding">
<image src="/images/default-bg-loding.gif" class="avatar dis-block" mode="widthFix" />
</view>

View File

@ -0,0 +1,39 @@
page {
background: #fbfbfb;
}
.open-setting-view {
background: hsla(0, 0%, 0%, 0.1);
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
z-index: 1000000;
}
.open-setting-view .content {
margin:0 auto;
width: 360rpx;
height: 160rpx;
padding: 50rpx;
border-radius: 12rpx;
margin-top: 70%;
position: relative;
}
.open-setting-view .content button {
margin-top: 15rpx;
}
.open-setting-view .content .value {
margin-top: 5rpx;
}
.open-setting-view .content .value text {
font-weight: 500;
color: #333;
}
.open-setting-loding {
padding-top: 35%;
}
.open-setting-loding image {
margin: 0 auto;
}

View File

@ -0,0 +1,14 @@
<template name="open_setting">
<view class="open-setting-view">
<view class="content bg-white">
<view class="close fr oh">
<view class="fr" bindtap="{{close_event || 'view_setting_close_event'}}">
<icon type="clear" size="20" />
</view>
</view>
<view class="msg cr-888">开启相应的权限服务</view>
<view class="value cr-666">获取[ <text>{{name || '相关业务'}}</text> ]权限</view>
<button type="primary" open-type="openSetting" size="mini" bindopensetting="{{callback || 'setting_callback_event'}}">打开设置页</button>
</view>
</view>
</template>

View File

@ -0,0 +1,373 @@
const app = getApp();
Page({
data: {
params: null,
extraction_data: null,
province_list: [],
city_list: [],
county_list: [],
province_id: null,
city_id: null,
county_id: null,
lng: 0,
lat: 0,
default_province: "请选择省",
default_city: "请选择市",
default_county: "请选择区/县",
province_value: null,
city_value: null,
county_value: null,
user_location_cache_key: 'cache_userlocation_key',
user_location: null,
form_submit_disabled_status: false,
},
onLoad(params) {
this.setData({ params: params });
},
onReady: function () {
// 清除位置缓存信息
wx.removeStorage({key: this.data.user_location_cache_key});
this.init();
},
onShow() {
this.user_location_init();
},
init() {
var user = app.get_user_info(this, "init");
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.redirectTo({
url: "/pages/login/login?event_callback=init"
});
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: '请先绑定手机号码',
});
return false;
} else {
this.get_province_list();
this.applyinfo_init();
}
} else {
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: '请先授权用户信息',
});
}
},
// 自提点信息
applyinfo_init() {
var self = this;
wx.request({
url: app.get_request_url("applyinfo", "extraction", "distribution"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data || null;
self.setData({
extraction_data: data,
});
// 数据设置
if(data != null)
{
self.setData({
province_id: data.province || null,
city_id: data.city || null,
county_id: data.county || null,
});
// 地理位置
var lng = (data.lng || 0) <= 0 ? null : data.lng;
var lat = (data.lat || 0) <= 0 ? null : data.lat;
if (lng != null && lat != null)
{
self.setData({ user_location: {
lng: lng,
lat: lat,
address: data.address || '',
}});
}
}
// 获取城市、区县
self.get_city_list();
self.get_county_list();
// 半秒后初始化数据
setTimeout(function () {
self.init_region_value();
}, 500);
} else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
app.showToast("省份信息失败");
}
});
},
// 肚脐数据初始化
init_region_value() {
this.setData({
province_value: this.get_region_value("province_list", "province_id"),
city_value: this.get_region_value("city_list", "city_id"),
county_value: this.get_region_value("county_list", "county_id"),
});
},
// 地区初始化皮配偶索引
get_region_value(list, id) {
var data = this.data[list];
var data_id = this.data[id];
var value = null;
data.forEach((d, i) => {
if (d.id == data_id) {
value = i;
return false;
}
});
return value;
},
// 获取省份
get_province_list() {
var self = this;
wx.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
province_list: data
});
} else {
app.showToast(res.data.msg);
}
},
fail: () => {
app.showToast("省份获取失败");
}
});
},
// 获取市
get_city_list() {
var self = this;
console.log(self.data.province_id)
if (self.data.province_id) {
wx.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {
pid: self.data.province_id
},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
city_list: data
});
} else {
app.showToast(res.data.msg);
}
},
fail: () => {
app.showToast("城市获取失败");
}
});
}
},
// 获取区/县
get_county_list() {
var self = this;
if (self.data.city_id) {
// 加载loding
wx.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {
pid: self.data.city_id
},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
county_list: data
});
} else {
app.showToast(res.data.msg);
}
},
fail: () => {
app.showToast("区/县获取失败");
}
});
}
},
// 省份事件
select_province_event(e) {
var index = e.detail.value || 0;
if (index >= 0) {
var data = this.data.province_list[index];
this.setData({
province_value: index,
province_id: data.id,
city_value: null,
county_value: null,
city_id: null,
county_id: null
});
this.get_city_list();
}
},
// 市事件
select_city_event(e) {
var index = e.detail.value || 0;
if (index >= 0) {
var data = this.data.city_list[index];
this.setData({
city_value: index,
city_id: data.id,
county_value: null,
county_id: null
});
this.get_county_list();
}
},
// 区/县事件
select_county_event(e) {
var index = e.detail.value || 0;
if (index >= 0) {
var data = this.data.county_list[index];
this.setData({
county_value: index,
county_id: data.id
});
}
},
// 省市区未按照顺序选择提示
region_select_error_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value != null) {
app.showToast(value);
}
},
// 选择地理位置
choose_location_event(e) {
wx.navigateTo({
url: '/pages/common/open-setting-location/open-setting-location'
});
},
// 地址信息初始化
user_location_init() {
var result = wx.getStorageSync(this.data.user_location_cache_key) || null;
var data = null;
if (result != null)
{
data = {
name: result.name || null,
address: result.address || null,
lat: result.latitude || null,
lng: result.longitude || null
}
}
this.setData({user_location: data});
},
// 数据提交
form_submit(e) {
var self = this;
// 表单数据
var form_data = e.detail.value;
// 数据校验
var validation = [
{ fields: "name", msg: "请填写联系人" },
{ fields: "tel", msg: "请填写联系电话" },
{ fields: "province", msg: "请选择省份" },
{ fields: "city", msg: "请选择城市" },
{ fields: "county", msg: "请选择区县" },
{ fields: "address", msg: "请填写详细地址" },
{ fields: "lng", msg: "请选择地理位置" },
{ fields: "lat", msg: "请选择地理位置" }
];
form_data["province"] = self.data.province_id;
form_data["city"] = self.data.city_id;
form_data["county"] = self.data.county_id;
// 地理位置
if ((self.data.user_location || null) != null)
{
form_data["lng"] = self.data.user_location.lat || 0;
form_data["lat"] = self.data.user_location.lat || 0;
}
// 验证提交表单
if (app.fields_check(form_data, validation)) {
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,
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
self.setData({ form_submit_disabled_status: false });
wx.hideLoading();
if (res.data.code == 0) {
app.showToast(res.data.msg, "success");
setTimeout(function () {
wx.navigateBack();
}, 1000);
} else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
}
},
fail: () => {
self.setData({ form_submit_disabled_status: false });
wx.hideLoading();
app.showToast("服务器请求出错");
}
});
}
},
});

View File

@ -0,0 +1,8 @@
{
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ff6a80",
"backgroundColorTop": "#ff6a80",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "取货点申请"
}

View File

@ -0,0 +1,56 @@
<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 个字符" />
</view>
<view class="form-gorup bg-white">
<view class="form-gorup-title">联系人<text class="form-group-tips-must">必填</text></view>
<input type="text" name="name" value="{{extraction_data.name || ''}}" placeholder-class="cr-ccc" class="cr-666" placeholder="联系人格式 2~16 个字符之间" />
</view>
<view class="form-gorup bg-white">
<view class="form-gorup-title">联系电话<text class="form-group-tips-must">必填</text></view>
<input type="text" name="tel" value="{{extraction_data.tel || ''}}" placeholder-class="cr-ccc" class="cr-666" placeholder="座机 或 手机" />
</view>
<view class="form-gorup bg-white">
<view class="form-gorup-title">省市区<text class="form-group-tips-must">必选</text></view>
<view class="select-address oh">
<view class="section fl">
<picker name="province" bindchange="select_province_event" value="{{province_value}}" range="{{province_list}}" range-key="name">
<view class="name {{(province_value == null) ? 'cr-ccc' : 'cr-666' }}">{{province_list[province_value].name || default_province}}</view>
</picker>
</view>
<view class="section fl">
<picker wx:if="{{(province_id || null) != null}}" name="city" bindchange="select_city_event" value="{{city_value}}" range="{{city_list}}" range-key="name">
<view class="name {{(city_value == null) ? 'cr-ccc' : 'cr-666' }}">{{city_list[city_value].name || default_city}}</view>
</picker>
<text wx:else class="cr-ccc" bindtap="region_select_error_event" data-value="请先选择省份">请先选择省份</text>
</view>
<view class="section fl">
<picker wx:if="{{(city_id || null) != null}}" name="county" bindchange="select_county_event" value="{{county_value}}" range="{{county_list}}" range-key="name">
<view class="name {{(county_value == null) ? 'cr-ccc' : 'cr-666' }}">{{county_list[county_value].name || default_county}}</view>
</picker>
<text wx:else class="cr-ccc" bindtap="region_select_error_event" data-value="请先选择城市">请先选择城市</text>
</view>
</view>
</view>
<view class="form-gorup bg-white">
<view class="form-gorup-title">详细地址<text class="form-group-tips-must">必填</text></view>
<input type="text" name="address" value="{{extraction_data.address || ''}}" placeholder-class="cr-ccc" class="cr-666" placeholder="详细地址格式 1~80 个字符之间" />
</view>
<view class="form-gorup bg-white">
<view class="form-gorup-title">地理位置<text class="form-group-tips-must">必选</text></view>
<view bindtap="choose_location_event" class="form-gorup-text">
<view wx:if="{{(user_location || null) == null}}" class="cr-888">请选择地理位置</view>
<view wx:else class="cr-666">{{((user_location || null) != null && (user_location.name || null) != null) ? user_location.name+' ' : ''}}{{user_location.address || ''}}</view>
</view>
</view>
<view class="form-gorup">
<button class="submit-bottom" type="default" formType="submit" hover-class="none" disabled="{{form_submit_disabled_status}}">提交</button>
</view>
</form>

View File

@ -0,0 +1,24 @@
/*
* 三级联动
*/
.select-address {
box-sizing: border-box;
height: 70rpx;
line-height: 70rpx;
padding: 0 10rpx;
}
.select-address .section {
width: 33.33%;
box-sizing: border-box;
}
.select-address .section:not(:first-child) {
padding: 0 5rpx;
}
/*
* 表单
*/
.submit-bottom {
background-color: #ff6a80 !important;
color: #fff !important;
}

View File

@ -0,0 +1,166 @@
const app = getApp();
Page({
data: {
data_list: [],
data_page_total: 0,
data_page: 1,
data_list_loding_status: 1,
data_bottom_line_status: false,
params: null,
nav_status_list: [
{ name: "全部", value: "-1" },
{ name: "待取货", value: "0" },
{ name: "已取货", value: "1" }
],
nav_status_index: -1,
},
onLoad(params) {
// 是否指定状态
var nav_status_index = -1;
if (params.status != undefined) {
for (var i in this.data.nav_status_list) {
if (this.data.nav_status_list[i]['value'] == params.status) {
nav_status_index = i;
break;
}
}
}
this.setData({
params: params,
nav_status_index: nav_status_index,
});
this.init();
},
onShow() { },
init() {
var user = app.get_user_info(this, 'init');
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.redirectTo({
url: "/pages/login/login?event_callback=init"
});
return false;
} else {
// 获取数据
this.get_data_list();
}
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false,
});
}
},
// 获取数据
get_data_list(is_mandatory) {
// 分页是否还有数据
if ((is_mandatory || 0) == 0) {
if (this.data.data_bottom_line_status == true) {
return false;
}
}
// 加载loding
wx.showLoading({ title: "加载中..." });
this.setData({
data_list_loding_status: 1
});
// 参数
var status = ((this.data.nav_status_list[this.data.nav_status_index] || null) == null) ? -1 : this.data.nav_status_list[this.data.nav_status_index]['value'];
// 获取数据
wx.request({
url: app.get_request_url("order", "extraction", "distribution"),
method: "POST",
data: {
page: this.data.data_page,
status: status || 0,
},
dataType: "json",
success: res => {
wx.hideLoading();
wx.stopPullDownRefresh();
if (res.data.code == 0) {
if (res.data.data.data.length > 0) {
if (this.data.data_page <= 1) {
var temp_data_list = res.data.data.data;
} else {
var temp_data_list = this.data.data_list;
var temp_data = res.data.data.data;
for (var i in temp_data) {
temp_data_list.push(temp_data[i]);
}
}
this.setData({
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,
data_list_loding_status: 3,
data_page: this.data.data_page + 1,
});
// 是否还有数据
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
this.setData({ data_bottom_line_status: true });
} else {
this.setData({ data_bottom_line_status: false });
}
} else {
this.setData({
data_list_loding_status: 0,
data_list: [],
data_bottom_line_status: false,
});
}
} else {
this.setData({
data_list_loding_status: 0,
});
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
wx.hideLoading();
wx.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
});
app.showToast("服务器请求出错");
}
});
},
// 下拉刷新
onPullDownRefresh() {
this.setData({
data_page: 1
});
this.get_data_list(1);
},
// 滚动加载
scroll_lower(e) {
this.get_data_list();
},
// 导航事件
nav_event(e) {
this.setData({
nav_status_index: e.currentTarget.dataset.index || 0,
data_page: 1,
});
this.get_data_list(1);
},
});

View File

@ -0,0 +1,8 @@
{
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#ff6a80",
"backgroundColorTop": "#ff6a80",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "取货订单"
}

View File

@ -0,0 +1,42 @@
<!-- 导航 -->
<view class="nav">
<block wx:for="{{nav_status_list}}" wx:key="key">
<view class="item fl tc cr-888 {{nav_status_index == index ? 'active' : ''}}" data-index="{{index}}" bindtap="nav_event">{{item.name}}</view>
</block>
</view>
<!-- 列表 -->
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
<view class="data-list">
<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>
</view>
<view class="content">
<view class="multi-text">
<text class="title cr-666">订单号</text>
<text class="value">{{item.order_no}}</text>
</view>
<view class="multi-text">
<text class="title cr-666">支付金额</text>
<text class="value">{{item.pay_price}}</text>
<text class="unit cr-888">元</text>
</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>
</view>
<view wx:if="{{data_list.length == 0}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status}}">
</template>
</view>
<import src="/pages/common/bottom_line.wxml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</view>
</scroll-view>

View File

@ -0,0 +1,57 @@
/*
* 导航
*/
.nav {
background: #eee;
height: 80rpx;
line-height: 80rpx;
}
.nav .item {
width: 33.33%;
}
.nav .active {
color: #ff6a80;
}
/*
* 列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list .item .base {
padding: 15rpx 10rpx;
}
.data-list .item .base .avatar {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.data-list .item .base .nickname {
margin-top: 10rpx;
}
.data-list .item .content {
padding: 20rpx 10rpx;
}
.data-list .item .content .multi-text {
line-height: 50rpx;
}
.data-list .item .content .multi-text .title {
margin-right: 30rpx;
}
.data-list .item .content .multi-text .value {
font-weight: 500;
}
.data-list .item .content .multi-text .unit {
margin-left: 10rpx;
}
.data-list .item .operation {
padding: 20rpx 10rpx;
}
.data-list .item .submit-order {
border: 1px solid #e5e5e5;
color: #888 !important;
}
.data-list .item .operation button:not(:first-child) {
margin-left: 30rpx;
}

View File

@ -0,0 +1,119 @@
const app = getApp();
Page({
data: {
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_base: null,
extraction: null,
},
onLoad(params) {},
onShow() {
this.init();
},
init() {
var user = app.get_user_info(this, 'init');
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.redirectTo({
url: "/pages/login/login?event_callback=init"
});
return false;
} else {
// 获取数据
this.get_data();
}
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false,
});
}
},
// 获取数据
get_data() {
var self = this;
wx.request({
url: app.get_request_url("index", "extraction", "distribution"),
method: "POST",
data: {},
dataType: "json",
success: res => {
wx.hideLoading();
wx.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
data_base: data.base || null,
extraction: data.extraction || null,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: true,
});
} else {
self.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data, self, 'get_data')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
wx.hideLoading();
wx.stopPullDownRefresh();
self.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错',
});
app.showToast("服务器请求出错");
}
});
},
// 下拉刷新
onPullDownRefresh() {
this.get_data();
},
// 地图查看
address_map_event(e) {
if ((this.data.extraction || null) == null) {
app.showToast("地址有误");
return false;
}
var ads = this.data.extraction;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
if (lng <= 0 || lat <= 0) {
app.showToast("坐标有误");
return false;
}
wx.openLocation({
latitude: lat,
longitude: lng,
scale: 18,
name: ads.alias || '',
address: (ads.province_name || '') + (ads.city_name || '') + (ads.county_name || '') + (ads.address || ''),
});
},
// 进入取货订单管理
order_event(e) {
var value = e.currentTarget.dataset.value || 0;
wx.navigateTo({
url: '/pages/plugins/distribution/extraction-order/extraction-order?status='+value,
});
},
});

View File

@ -0,0 +1,8 @@
{
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#ff6a80",
"backgroundColorTop": "#ff6a80",
"backgroundColorBottom": "#f5f5f5",
"backgroundTextStyle": "light",
"navigationBarTitleText": "取货点"
}

View File

@ -0,0 +1,89 @@
<view wx:if="{{data_list_loding_status == 0}}">
<!-- 未申请 -->
<view wx:if="{{extraction == null}}" class="apply-not bg-white">
<view wx:if="{{(data_base || null) != null && (data_base.self_extraction_apply_desc || null) != null && data_base.self_extraction_apply_desc.length > 0}}" class="apply-desc">
<view wx:for="{{data_base.self_extraction_apply_desc}}" wx:key="key" class="item">
{{item}}
</view>
</view>
<view class="to-submit tc">
<navigator url="/pages/plugins/distribution/extraction-apply/extraction-apply" hover-class="none">
<button type="primary" size="mini" hover-class="none">立即申请</button>
</navigator>
</view>
</view>
<!-- 已存在申请信息 -->
<view wx:else class="apply-already">
<!-- status 状态0待审核, 1已通过, 2已拒绝 -->
<!-- 审核中 -->
<view wx:if="{{extraction.status == 0}}" class="waiting-audit bg-white">
<view class="title-msg tc">申请信息正在审核中...</view>
<view class="operation oh tc">
<view class="cr-666 mini-msg">你可以</view>
<view class="to-submit tc">
<navigator url="/pages/plugins/distribution/extraction-apply/extraction-apply" hover-class="none">
<button type="primary" size="mini" hover-class="none">编辑信息</button>
</navigator>
</view>
</view>
</view>
<!-- 审核通过 -->
<view wx:elif="{{extraction.status == 1}}" 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>
<view class="content bg-white">
<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 class="base br-b oh bg-white spacing-mt">
<view class="base-title">取货订单统计</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>
<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>
</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 class="tips">
<view wx:for="{{data_base.self_extraction_common_notice}}" wx:key="key" class="item">
{{item}}
</view>
</view>
</view>
</view>
<!-- 审核失败 -->
<view wx:else="{{extraction.status == 2}}" class="refuse bg-white">
<view class="title-msg tc">申请信息审核失败</view>
<view wx:if="{{(extraction.fail_reason || null) != null}}" class="fail-tips tips">原因:{{extraction.fail_reason}}</view>
<view class="operation oh tc">
<view class="cr-666 mini-msg">你可以重新编辑信息提交</view>
<view class="to-submit tc">
<navigator url="/pages/plugins/distribution/extraction-apply/extraction-apply" hover-class="none">
<button type="primary" size="mini" hover-class="none">编辑信息</button>
</navigator>
</view>
</view>
</view>
</view>
<import src="/pages/common/bottom_line.wxml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</view>
<view wx:else>
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
</view>

View File

@ -0,0 +1,107 @@
/*
* 公共
*/
.operation {
margin-top: 30rpx;
}
.title-msg {
font-size: 46rpx;
margin-top: 5%;
}
.mini-msg {
color: #0e90d2;
}
.to-submit {
margin-top: 15rpx;
}
.waiting-audit, .refuse {
padding: 10% 10rpx 60rpx 10rpx;
}
/*
* 未申请
*/
.apply-not {
padding: 10rpx 10rpx 60rpx 10rpx;
}
.apply-not .apply-desc {
margin: 30rpx 30rpx 0 30rpx;
}
.apply-not .to-submit {
margin-top: 10%;
}
/*
* 待审核
*/
.waiting-audit .title-msg {
color: #f37b1d;
}
/*
* 已审核
*/
.valid .base {
padding: 20rpx 10rpx;
}
.valid .base-title {
font-weight: 500;
}
.valid .alias {
border: 1px solid #ff6a80;
color: #ff6a80;
padding: 2rpx 10rpx;
border-radius: 6rpx;
margin-right: 10rpx;
}
.valid .base-map-submit {
color: #ff6a80;
}
.valid .content {
line-height: 46rpx;
}
.valid .content, .valid .statistics .item {
padding: 30rpx 10rpx;
}
.valid .extraction-notice {
padding: 0 20rpx;
}
.valid .statistics .item {
width: calc(50% - 1px);
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.valid .statistics .item .value {
font-weight: bold;
font-size: 36rpx;
margin-top: 10rpx;
color: #ff6a80;
}
/*
* 拒绝
*/
.refuse .title-msg {
color: #dd514c;
}
.refuse .fail-tips {
padding-left: 10rpx;
background: #ffffeb;
margin-top: 10rpx;
}
.refuse .mini-msg {
margin-top: 50rpx;
}
/*
* 介绍
*/
.apply-desc {
background: #def2fd;
border: 1px solid #cfeeff;
color: #1490d2;
padding: 10rpx;
font-size: 26rpx;
border-radius: 2px;
}

View File

@ -60,32 +60,32 @@ Page({
// 导航数据
nav_list_data() {
return [
{
icon: "/images/plugins/distribution/user-center-order-icon.png",
title: "分销订单",
url: "/pages/plugins/distribution/order/order",
},
{
icon: "/images/plugins/distribution/user-center-profit-icon.png",
title: "收益明细",
url: "/pages/plugins/distribution/profit/profit",
},
{
icon: "/images/plugins/distribution/user-center-team-icon.png",
title: "我的团队",
url: "/pages/plugins/distribution/team/team",
},
{
icon: "/images/plugins/distribution/user-center-poster-icon.png",
title: "推广返利",
url: "/pages/plugins/distribution/poster/poster",
},
{
icon: "/images/plugins/distribution/user-center-statistics-icon.png",
title: "数据统计",
url: "/pages/plugins/distribution/statistics/statistics",
}
];
{
icon: "/images/plugins/distribution/user-center-order-icon.png",
title: "分销订单",
url: "/pages/plugins/distribution/order/order",
},
{
icon: "/images/plugins/distribution/user-center-profit-icon.png",
title: "收益明细",
url: "/pages/plugins/distribution/profit/profit",
},
{
icon: "/images/plugins/distribution/user-center-team-icon.png",
title: "我的团队",
url: "/pages/plugins/distribution/team/team",
},
{
icon: "/images/plugins/distribution/user-center-poster-icon.png",
title: "推广返利",
url: "/pages/plugins/distribution/poster/poster",
},
{
icon: "/images/plugins/distribution/user-center-statistics-icon.png",
title: "数据统计",
url: "/pages/plugins/distribution/statistics/statistics",
}
];
},
// 获取数据
@ -115,9 +115,10 @@ Page({
// 导航
var temp_data_list = self.nav_list_data();
// 等级介绍
if (data_base != null && (data_base.is_show_introduce || 0) == 1)
{
// 等级介绍
temp_data_list.push({
icon: "/images/plugins/distribution/user-center-introduce-icon.png",
title: "等级介绍",