diff --git a/sourcecode/alipay/pages/extraction-address/extraction-address.js b/sourcecode/alipay/pages/extraction-address/extraction-address.js
index babff0b66..72e5c032d 100644
--- a/sourcecode/alipay/pages/extraction-address/extraction-address.js
+++ b/sourcecode/alipay/pages/extraction-address/extraction-address.js
@@ -116,11 +116,6 @@ Page({
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
my.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/alipay/pages/plugins/distribution/extraction/extraction.js b/sourcecode/alipay/pages/plugins/distribution/extraction/extraction.js
index b5a03bc91..95f082c05 100644
--- a/sourcecode/alipay/pages/plugins/distribution/extraction/extraction.js
+++ b/sourcecode/alipay/pages/plugins/distribution/extraction/extraction.js
@@ -96,10 +96,6 @@ Page({
var ads = this.data.extraction;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- return false;
- }
-
my.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/alipay/pages/user-order-detail/user-order-detail.js b/sourcecode/alipay/pages/user-order-detail/user-order-detail.js
index 97d6a2b2c..97728f5d5 100644
--- a/sourcecode/alipay/pages/user-order-detail/user-order-detail.js
+++ b/sourcecode/alipay/pages/user-order-detail/user-order-detail.js
@@ -144,11 +144,6 @@ Page({
var ads = this.data.detail.address_data;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
my.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/baidu/pages/extraction-address/extraction-address.js b/sourcecode/baidu/pages/extraction-address/extraction-address.js
index c8c319ca8..eaf69847a 100644
--- a/sourcecode/baidu/pages/extraction-address/extraction-address.js
+++ b/sourcecode/baidu/pages/extraction-address/extraction-address.js
@@ -115,11 +115,6 @@ Page({
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
swan.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/baidu/pages/plugins/distribution/extraction/extraction.js b/sourcecode/baidu/pages/plugins/distribution/extraction/extraction.js
index d58df4b66..92ffc8a2b 100644
--- a/sourcecode/baidu/pages/plugins/distribution/extraction/extraction.js
+++ b/sourcecode/baidu/pages/plugins/distribution/extraction/extraction.js
@@ -95,10 +95,6 @@ Page({
var ads = this.data.extraction;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- return false;
- }
-
swan.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/baidu/pages/user-order-detail/user-order-detail.js b/sourcecode/baidu/pages/user-order-detail/user-order-detail.js
index 664c50a3b..1f7fa97e4 100755
--- a/sourcecode/baidu/pages/user-order-detail/user-order-detail.js
+++ b/sourcecode/baidu/pages/user-order-detail/user-order-detail.js
@@ -107,11 +107,6 @@ Page({
var ads = this.data.detail.address_data;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
swan.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/qq/pages/extraction-address/extraction-address.js b/sourcecode/qq/pages/extraction-address/extraction-address.js
index 7e913e39a..7e5d03d2a 100644
--- a/sourcecode/qq/pages/extraction-address/extraction-address.js
+++ b/sourcecode/qq/pages/extraction-address/extraction-address.js
@@ -116,11 +116,6 @@ Page({
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
qq.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/qq/pages/user-order-detail/user-order-detail.js b/sourcecode/qq/pages/user-order-detail/user-order-detail.js
index f0349e5d1..f0bc1f432 100755
--- a/sourcecode/qq/pages/user-order-detail/user-order-detail.js
+++ b/sourcecode/qq/pages/user-order-detail/user-order-detail.js
@@ -109,11 +109,6 @@ Page({
var ads = this.data.detail.address_data;
var lng = parseFloat(ads.lng || 0);
var lat = parseFloat(ads.lat || 0);
- if (lng <= 0 || lat <= 0) {
- app.showToast("坐标有误");
- return false;
- }
-
qq.openLocation({
latitude: lat,
longitude: lng,
diff --git a/sourcecode/toutiao/app.js b/sourcecode/toutiao/app.js
index 1217c7049..745dbcecb 100755
--- a/sourcecode/toutiao/app.js
+++ b/sourcecode/toutiao/app.js
@@ -67,15 +67,16 @@ App({
// 请求地址
request_url: "{{request_url}}",
- // request_url: 'http://shopxo.com/',
- // request_url: 'https://dev.shopxo.net/',
+ request_url: 'http://shopxo.com/',
+ request_url: 'https://dev.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",
application_describe: "{{application_describe}}",
// 价格符号
- price_symbol: "{{price_symbol}}"
+ price_symbol: "{{price_symbol}}",
+ price_symbol: "¥",
},
/**
diff --git a/sourcecode/toutiao/app.json b/sourcecode/toutiao/app.json
index e8f5f31bb..06b701258 100755
--- a/sourcecode/toutiao/app.json
+++ b/sourcecode/toutiao/app.json
@@ -4,6 +4,7 @@
"pages/goods-category/goods-category",
"pages/cart/cart",
"pages/user/user",
+ "pages/buy/buy",
"pages/web-view/web-view",
"pages/login/login",
"pages/paytips/paytips",
@@ -11,7 +12,6 @@
"pages/goods-detail/goods-detail",
"pages/goods-comment/goods-comment",
"pages/goods-attribute/goods-attribute",
- "pages/buy/buy",
"pages/user-address/user-address",
"pages/user-address-save/user-address-save",
"pages/user-order/user-order",
diff --git a/sourcecode/toutiao/pages/buy/buy.js b/sourcecode/toutiao/pages/buy/buy.js
index 305885a61..cd199b667 100755
--- a/sourcecode/toutiao/pages/buy/buy.js
+++ b/sourcecode/toutiao/pages/buy/buy.js
@@ -19,31 +19,37 @@ Page({
common_site_type: 0,
extraction_address: [],
site_model: 0,
- buy_header_nav: [
- { name: "快递邮寄", value: 0 },
- { name: "自提点取货", value: 2 }
- ],
-
+ buy_header_nav: [{
+ name: "快递邮寄",
+ value: 0
+ }, {
+ name: "自提点取货",
+ value: 2
+ }],
// 优惠劵
plugins_coupon_data: null,
- plugins_use_coupon_id: 0,
- plugins_choice_coupon_value: '选择优惠劵',
+ plugins_use_coupon_ids: [],
+ plugins_choice_coupon_value: [],
popup_plugins_coupon_status: false,
+ popup_plugins_coupon_index: null
},
+
onLoad(params) {
//params['data'] = '{"buy_type":"goods","goods_id":"1","stock":"1","spec":"[]"}';
- if((params.data || null) != null && app.get_length(JSON.parse(params.data)) > 0)
- {
- this.setData({ params: JSON.parse(params.data)});
+ if ((params.data || null) != null && app.get_length(JSON.parse(params.data)) > 0) {
+ this.setData({
+ params: JSON.parse(params.data)
+ }); // 删除地址缓存
- // 删除地址缓存
tt.removeStorageSync(app.data.cache_buy_user_address_select_key);
}
},
onShow() {
this.init();
- this.setData({ is_first: 0 });
+ this.setData({
+ is_first: 0
+ });
},
// 获取数据列表
@@ -52,49 +58,51 @@ Page({
if (this.data.params == null) {
this.setData({
data_list_loding_status: 2,
- data_list_loding_msg: '订单信息有误',
+ data_list_loding_msg: '订单信息有误'
});
tt.stopPullDownRefresh();
return false;
- }
+ } // 本地缓存地址
- // 本地缓存地址
- if(this.data.is_first == 0)
- {
+
+ if (this.data.is_first == 0) {
var cache_address = tt.getStorageSync(app.data.cache_buy_user_address_select_key);
- if((cache_address || null) != null)
- {
+
+ if ((cache_address || null) != null) {
this.setData({
address: cache_address,
- address_id: cache_address.id,
+ address_id: cache_address.id
});
}
- }
+ } // 加载loding
- // 加载loding
- tt.showLoading({title: '加载中...'});
+
+ tt.showLoading({
+ title: '加载中...'
+ });
this.setData({
data_list_loding_status: 1
});
-
var data = this.data.params;
data['address_id'] = this.data.address_id;
data['payment_id'] = this.data.payment_id;
- data['coupon_id'] = this.data.plugins_use_coupon_id;
data['site_model'] = this.data.site_model;
tt.request({
url: app.get_request_url("index", "buy"),
method: "POST",
- data: data,
+ data: this.request_data_coupon_merge(data),
dataType: "json",
success: res => {
tt.stopPullDownRefresh();
tt.hideLoading();
+
if (res.data.code == 0) {
var data = res.data.data;
- if (data.goods_list.length == 0)
- {
- this.setData({data_list_loding_status: 0});
+
+ if (data.goods_list.length == 0) {
+ this.setData({
+ data_list_loding_status: 0
+ });
} else {
this.setData({
goods_list: data.goods_list,
@@ -104,39 +112,46 @@ Page({
common_order_is_booking: data.common_order_is_booking || 0,
common_site_type: data.common_site_type || 0,
extraction_address: data.base.extraction_address || [],
- plugins_coupon_data: data.plugins_coupon_data || null,
- });
+ plugins_coupon_data: data.plugins_coupon_data || null
+ }); // 优惠劵选择处理
- // 优惠劵选择处理
- if ((data.plugins_coupon_data || null) != null)
- {
- if ((data.plugins_coupon_data.coupon_choice || null) != null)
- {
- this.setData({ plugins_choice_coupon_value: data.plugins_coupon_data.coupon_choice.coupon.desc });
- } else {
- var coupon_count = ((data.plugins_coupon_data.coupon_list || null) != null) ? data.plugins_coupon_data.coupon_list.length : 0;
- this.setData({ plugins_choice_coupon_value: (coupon_count > 0) ? '可选优惠劵' + coupon_count + '张' : '暂无可用优惠劵' });
+ if ((data.plugins_coupon_data || null) != null) {
+ var plugins_choice_coupon_value = [];
+
+ for (var i in data.plugins_coupon_data) {
+ var cupk = data.plugins_coupon_data[i]['warehouse_id'];
+
+ if ((data.plugins_coupon_data[i]['coupon_data']['coupon_choice'] || null) != null) {
+ plugins_choice_coupon_value[cupk] = data.plugins_coupon_data[i]['coupon_data']['coupon_choice']['coupon']['desc'];
+ } else {
+ var coupon_count = (data.plugins_coupon_data[i]['coupon_data']['coupon_list'] || null) != null ? data.plugins_coupon_data[i]['coupon_data'].coupon_list.length : 0;
+ plugins_choice_coupon_value[cupk] = coupon_count > 0 ? '可选优惠劵' + coupon_count + '张' : '暂无可用优惠劵';
+ }
}
- }
- // 地址
+ this.setData({
+ plugins_choice_coupon_value: plugins_choice_coupon_value
+ });
+ } // 地址
+
+
this.setData({
address: data.base.address || null,
- address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
+ address_id: (data.base.address || null) != null ? data.base.address.id : null
});
tt.setStorage({
key: app.data.cache_buy_user_address_select_key,
- data: data.base.address || null,
- });
+ data: data.base.address || null
+ }); // 支付方式
- // 支付方式
this.payment_list_data(data.payment_list);
}
} else {
this.setData({
data_list_loding_status: 2,
- data_list_loding_msg: res.data.msg,
+ data_list_loding_msg: res.data.msg
});
+
if (app.is_login_check(res.data, this, 'init')) {
app.showToast(res.data.msg);
}
@@ -147,14 +162,26 @@ Page({
tt.hideLoading();
this.setData({
data_list_loding_status: 2,
- data_list_loding_msg: '服务器请求出错',
+ data_list_loding_msg: '服务器请求出错'
});
-
app.showToast("服务器请求出错");
}
});
},
+ // 请求参数合并优惠券参数
+ request_data_coupon_merge(data) {
+ var coupon_ids = this.data.plugins_use_coupon_ids;
+
+ if ((coupon_ids || null) != null && coupon_ids.length > 0) {
+ for (var i in coupon_ids) {
+ data['coupon_id_' + i] = coupon_ids[i];
+ }
+ }
+
+ return data;
+ },
+
// 下拉刷新
onPullDownRefresh() {
this.init();
@@ -162,7 +189,9 @@ Page({
// 用户留言事件
bind_user_note_event(e) {
- this.setData({user_note_value: e.detail.value});
+ this.setData({
+ user_note_value: e.detail.value
+ });
},
// 提交订单
@@ -172,47 +201,63 @@ Page({
data['address_id'] = this.data.address_id;
data['payment_id'] = this.data.payment_id;
data['user_note'] = this.data.user_note_value;
- data['coupon_id'] = this.data.plugins_use_coupon_id;
- data['site_model'] = this.data.site_model;
+ data['site_model'] = this.data.site_model; // 数据验证
- // 数据验证
var validation = [];
- if (this.data.common_site_type == 0 || this.data.common_site_type == 2 || this.data.common_site_type == 4)
- {
- validation.push({ fields: 'address_id', msg: '请选择地址', is_can_zero: 1 });
+
+ if (this.data.common_site_type == 0 || this.data.common_site_type == 2 || this.data.common_site_type == 4) {
+ validation.push({
+ fields: 'address_id',
+ msg: '请选择地址',
+ is_can_zero: 1
+ });
}
+
if (this.data.common_order_is_booking != 1) {
- validation.push({ fields: 'payment_id', msg: '请选择支付方式' });
+ validation.push({
+ fields: 'payment_id',
+ msg: '请选择支付方式'
+ });
}
+
if (app.fields_check(data, validation)) {
// 加载loding
- tt.showLoading({title: '提交中...'});
- this.setData({ buy_submit_disabled_status: true });
-
+ tt.showLoading({
+ title: '提交中...'
+ });
+ this.setData({
+ buy_submit_disabled_status: true
+ });
tt.request({
url: app.get_request_url("add", "buy"),
method: "POST",
- data: data,
+ data: this.request_data_coupon_merge(data),
dataType: "json",
success: res => {
tt.hideLoading();
+
if (res.data.code == 0) {
- if (res.data.data.order.status == 1) {
+ if (res.data.data.order_status == 1) {
tt.redirectTo({
- url: '/pages/user-order/user-order?is_pay=1&order_id=' + res.data.data.order.id
+ url: '/pages/user-order/user-order?is_pay=1&order_ids=' + res.data.data.order_ids.join(',')
});
} else {
- tt.redirectTo({url: '/pages/user-order/user-order'});
+ tt.redirectTo({
+ url: '/pages/user-order/user-order'
+ });
}
} else {
app.showToast(res.data.msg);
- this.setData({ buy_submit_disabled_status: false });
+ this.setData({
+ buy_submit_disabled_status: false
+ });
}
},
fail: () => {
tt.hideLoading();
- this.setData({buy_submit_disabled_status: false});
-
+ this.setData({
+ buy_submit_disabled_status: false
+ });
app.showToast("服务器请求出错");
}
});
@@ -221,7 +266,9 @@ Page({
// 支付方式选择
payment_event(e) {
- this.setData({ payment_id: e.currentTarget.dataset.value});
+ this.setData({
+ payment_id: e.currentTarget.dataset.value
+ });
this.payment_list_data(this.data.payment_list);
this.init();
},
@@ -237,48 +284,63 @@ Page({
}
}
}
- this.setData({payment_list: data || []});
+
+ this.setData({
+ payment_list: data || []
+ });
},
// 优惠劵弹层开启
plugins_coupon_open_event(e) {
- this.setData({ popup_plugins_coupon_status: true});
+ var index = e.currentTarget.dataset.index;
+ this.setData({
+ popup_plugins_coupon_status: true,
+ popup_plugins_coupon_index: index
+ });
},
// 优惠劵弹层关闭
plugins_coupon_close_event(e) {
- this.setData({ popup_plugins_coupon_status: false });
+ this.setData({
+ popup_plugins_coupon_status: false
+ });
},
// 优惠劵选择
plugins_coupon_use_event(e) {
- var index = e.currentTarget.dataset.index;
+ var wid = e.currentTarget.dataset.wid;
var value = e.currentTarget.dataset.value;
- this.setData({
- plugins_use_coupon_id: value,
- popup_plugins_coupon_status: false,
- });
- this.init();
+ var temp = this.data.plugins_use_coupon_ids; // 是否已选择优惠券id
+
+ if (temp.indexOf(value) == -1) {
+ temp[wid] = value;
+ this.setData({
+ plugins_use_coupon_ids: temp,
+ popup_plugins_coupon_status: false
+ });
+ this.init();
+ }
},
// 不使用优惠劵
plugins_coupon_not_use_event(e) {
+ var wid = e.currentTarget.dataset.wid;
+ var temp = this.data.plugins_use_coupon_ids;
+ temp[wid] = 0;
this.setData({
- plugins_use_coupon_id: 0,
- popup_plugins_coupon_status: false,
+ plugins_use_coupon_ids: temp,
+ popup_plugins_coupon_status: false
});
this.init();
},
// 地址选择事件
address_event(e) {
- if (this.data.common_site_type == 0 || (this.data.common_site_type == 4 && this.data.site_model == 0))
- {
+ if (this.data.common_site_type == 0 || this.data.common_site_type == 4 && this.data.site_model == 0) {
tt.navigateTo({
url: '/pages/user-address/user-address?is_back=1'
});
- } else if (this.data.common_site_type == 2 || (this.data.common_site_type == 4 && this.data.site_model == 2))
- {
+ } else if (this.data.common_site_type == 2 || this.data.common_site_type == 4 && this.data.site_model == 2) {
tt.navigateTo({
url: '/pages/extraction-address/extraction-address?is_back=1'
});
@@ -290,20 +352,47 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
- if (value != this.data.site_model)
- {
+
+ if (value != this.data.site_model) {
// 数据设置
this.setData({
address: null,
address_id: null,
- site_model: value,
- });
+ site_model: value
+ }); // 删除地址缓存
- // 删除地址缓存
- tt.removeStorageSync(app.data.cache_buy_user_address_select_key);
+ tt.removeStorageSync(app.data.cache_buy_user_address_select_key); // 数据初始化
- // 数据初始化
this.init();
}
},
-});
+
+ // 地图查看
+ map_event(e) {
+ if((e.is_power || 0) == 0)
+ {
+ e['is_power'] = 1;
+ app.location_authorize(this, 'map_event', e);
+ return false;
+ }
+
+ var index = e.currentTarget.dataset.index || 0;
+ var data = this.data.goods_list[index] || null;
+
+ if (data == null) {
+ app.showToast("地址有误");
+ return false;
+ }
+
+ var lng = parseFloat(data.lng || 0);
+ var lat = parseFloat(data.lat || 0);
+ tt.openLocation({
+ latitude: lat,
+ longitude: lng,
+ scale: 18,
+ name: data.name || data.alias || '',
+ address: (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '')
+ });
+ }
+
+});
\ No newline at end of file
diff --git a/sourcecode/toutiao/pages/buy/buy.ttml b/sourcecode/toutiao/pages/buy/buy.ttml
index 41efc0d7d..d5792b4be 100755
--- a/sourcecode/toutiao/pages/buy/buy.ttml
+++ b/sourcecode/toutiao/pages/buy/buy.ttml
@@ -32,9 +32,20 @@
-
-
-
+
+
+
+
+
+ {{group.name}}
+ {{group.alias}}
+
+
+ 查看地图
+
+
+
+
{{item.title}}
@@ -52,6 +63,25 @@
+
+
+ 优惠劵
+ {{((plugins_choice_coupon_value || null) != null && (plugins_choice_coupon_value[group.id] || null) != null) ? plugins_choice_coupon_value[group.id] : '请选择优惠券'}}
+
+
+
+
+ {{item.name}}
+
+ {{item.tips}}
+
+
+
+
+
@@ -60,22 +90,6 @@
{{user_note_value || '留言'}}
-
-
- 优惠劵
- {{plugins_choice_coupon_value}}
-
-
-
-
-
- {{item.name}}
-
- {{item.tips}}
-
-
-
-
@@ -105,18 +119,19 @@
+