微信小程序
parent
5b8f667c8b
commit
fdf4c9fb5d
|
|
@ -1002,7 +1002,7 @@ class BuyService
|
|||
$user_note = empty($params['user_note']) ? '' : str_replace(['"', "'"], '', strip_tags($params['user_note']));
|
||||
|
||||
// 订单默认状态
|
||||
$status = (intval(MyC('common_order_is_booking', 0)) == 1) ? 0 : 1;
|
||||
$order_status = (intval(MyC('common_order_is_booking', 0)) == 1) ? 0 : 1;
|
||||
|
||||
// 订单来源
|
||||
$client_type = (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE;
|
||||
|
|
@ -1047,7 +1047,7 @@ class BuyService
|
|||
'user_id' => $params['user']['id'],
|
||||
'warehouse_id' => $v['id'],
|
||||
'user_note' => $user_note,
|
||||
'status' => $status,
|
||||
'status' => $order_status,
|
||||
'preferential_price' => ($v['order_base']['preferential_price'] <= 0.00) ? 0.00 : $v['order_base']['preferential_price'],
|
||||
'increase_price' => ($v['order_base']['increase_price'] <= 0.00) ? 0.00 : $v['order_base']['increase_price'],
|
||||
'price' => ($v['order_base']['total_price'] <= 0.00) ? 0.00 : $v['order_base']['total_price'],
|
||||
|
|
@ -1192,13 +1192,14 @@ class BuyService
|
|||
|
||||
// 返回信息
|
||||
$result = [
|
||||
'order_ids' => $order_ids,
|
||||
'jump_url' => MyUrl('index/order/index'),
|
||||
'order_status' => $order_status,
|
||||
'order_ids' => $order_ids,
|
||||
'jump_url' => MyUrl('index/order/index'),
|
||||
];
|
||||
|
||||
|
||||
// 获取订单信息
|
||||
switch($status)
|
||||
switch($order_status)
|
||||
{
|
||||
// 预约成功
|
||||
case 0 :
|
||||
|
|
|
|||
|
|
@ -288,10 +288,10 @@ class QQ
|
|||
$data = [
|
||||
'appid' => $this->config['appid'],
|
||||
'mch_id' => $this->config['mch_id'],
|
||||
'nonce_str' => md5(time().rand().$params['order_no']),
|
||||
'nonce_str' => md5(time().$params['order_no']),
|
||||
'body' => $params['site_name'].'-'.$params['name'],
|
||||
'notify_url' => $notify_url,
|
||||
'out_trade_no' => $params['order_no'].GetNumberCode(6),
|
||||
'out_trade_no' => $params['order_no'],
|
||||
'fee_type' => 'CNY',
|
||||
'total_fee' => (int) (($params['total_price']*1000)/10),
|
||||
'spbill_create_ip' => GetClientIP(),
|
||||
|
|
@ -355,13 +355,10 @@ class QQ
|
|||
*/
|
||||
private function ReturnData($data)
|
||||
{
|
||||
// 参数处理
|
||||
$out_trade_no = substr($data['out_trade_no'], 0, strlen($data['out_trade_no'])-6);
|
||||
|
||||
// 返回数据固定基础参数
|
||||
$data['trade_no'] = $data['transaction_id']; // 支付平台 - 订单号
|
||||
$data['buyer_user'] = isset($data['openid']) ? $data['openid'] : ''; // 支付平台 - 用户
|
||||
$data['out_trade_no'] = $out_trade_no; // 本系统发起支付的 - 订单号
|
||||
$data['out_trade_no'] = $data['out_trade_no']; // 本系统发起支付的 - 订单号
|
||||
$data['subject'] = isset($data['attach']) ? $data['attach'] : ''; // 本系统发起支付的 - 商品名称
|
||||
$data['pay_price'] = $data['total_fee']/100; // 本系统发起支付的 - 总价
|
||||
return $data;
|
||||
|
|
|
|||
|
|
@ -359,10 +359,10 @@ class Weixin
|
|||
'appid' => $appid,
|
||||
'mch_id' => $this->config['mch_id'],
|
||||
'body' => $params['site_name'].'-'.$params['name'],
|
||||
'nonce_str' => md5(time().rand().$params['order_no']),
|
||||
'nonce_str' => md5(time().$params['order_no']),
|
||||
'notify_url' => $notify_url,
|
||||
'openid' => ($trade_type == 'JSAPI') ? $openid : '',
|
||||
'out_trade_no' => $params['order_no'].GetNumberCode(6),
|
||||
'out_trade_no' => $params['order_no'],
|
||||
'spbill_create_ip' => GetClientIP(),
|
||||
'total_fee' => (int) (($params['total_price']*1000)/10),
|
||||
'trade_type' => $trade_type,
|
||||
|
|
@ -441,13 +441,10 @@ class Weixin
|
|||
*/
|
||||
private function ReturnData($data)
|
||||
{
|
||||
// 参数处理
|
||||
$out_trade_no = substr($data['out_trade_no'], 0, strlen($data['out_trade_no'])-6);
|
||||
|
||||
// 返回数据固定基础参数
|
||||
$data['trade_no'] = $data['transaction_id']; // 支付平台 - 订单号
|
||||
$data['buyer_user'] = $data['openid']; // 支付平台 - 用户
|
||||
$data['out_trade_no'] = $out_trade_no; // 本系统发起支付的 - 订单号
|
||||
$data['out_trade_no'] = $data['out_trade_no']; // 本系统发起支付的 - 订单号
|
||||
$data['subject'] = $data['attach']; // 本系统发起支付的 - 商品名称
|
||||
$data['pay_price'] = $data['total_fee']/100; // 本系统发起支付的 - 总价
|
||||
return $data;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{price_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view a:if="{{data_list.length > 0}}" class="page">
|
||||
<view a:for="{{data_list}}" class="goods-item oh bg-white {{common_site_type == 1 ? 'exhibition-mode-data' : ''}}">
|
||||
<!-- 选择 -->
|
||||
<view a:if="{{common_site_type != 1}}" onTap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<view a:if="{{common_site_type != 1}}" onTap="selected_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view a:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto br-t">
|
||||
<view a:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block a:if="{{common_site_type == 1}}">
|
||||
<view class="exhibition-mode">
|
||||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block a:else>
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view onTap="selectedt_event" data-type="all" class="fl selected">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view onTap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{is_selected_all ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
<text>全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ Page({
|
|||
},
|
||||
|
||||
// 选中处理
|
||||
selectedt_event(e) {
|
||||
selected_event(e) {
|
||||
var type = e.target.dataset.type || null;
|
||||
if (type != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{price_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ Page({
|
|||
},
|
||||
|
||||
// 选中处理
|
||||
selectedt_event(e) {
|
||||
selected_event(e) {
|
||||
var type = e.currentTarget.dataset.type || null;
|
||||
if (type != null) {
|
||||
var temp_data_list = this.data.data_list;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view s-if="data_list.length > 0" class="page">
|
||||
<view s-for="item, index in data_list" s-key="key" class="goods-item oh bg-white {{common_site_type == 1 ? 'exhibition-mode-data' : ''}}">
|
||||
<!-- 选择 -->
|
||||
<view s-if="common_site_type != 1" bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<view s-if="common_site_type != 1" bindtap="selected_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view s-if="data_list.length > 0" class="buy-nav oh wh-auto br-t">
|
||||
<view s-if="data_list.length > 0" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block s-if="common_site_type == 1">
|
||||
<view class="exhibition-mode">
|
||||
|
|
@ -54,8 +54,8 @@
|
|||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block s-else>
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view bindtap="selectedt_event" data-type="all" class="fl selected">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view bindtap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{is_selected_all ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
<text>全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{price_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ Page({
|
|||
},
|
||||
|
||||
// 选中处理
|
||||
selectedt_event(e) {
|
||||
selected_event(e) {
|
||||
var type = e.currentTarget.dataset.type || null;
|
||||
if (type != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view qq:if="{{data_list.length > 0}}" class="page">
|
||||
<view qq:for="{{data_list}}" qq:key="key" class="goods-item oh bg-white {{common_site_type == 1 ? 'exhibition-mode-data' : ''}}">
|
||||
<!-- 选择 -->
|
||||
<view qq:if="{{common_site_type != 1}}" bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<view qq:if="{{common_site_type != 1}}" bindtap="selected_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view qq:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto br-t">
|
||||
<view qq:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block qq:if="{{common_site_type == 1}}">
|
||||
<view class="exhibition-mode">
|
||||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block qq:else>
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view bindtap="selectedt_event" data-type="all" class="fl selected">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view bindtap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{is_selected_all ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
<text>全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{price_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ Page({
|
|||
},
|
||||
|
||||
// 选中处理
|
||||
selectedt_event(e) {
|
||||
selected_event(e) {
|
||||
var type = e.currentTarget.dataset.type || null;
|
||||
if (type != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view tt:if="{{data_list.length > 0}}" class="page">
|
||||
<view tt:for="{{data_list}}" tt:key="key" class="goods-item oh bg-white {{common_site_type == 1 ? 'exhibition-mode-data' : ''}}">
|
||||
<!-- 选择 -->
|
||||
<view tt:if="{{common_site_type != 1}}" bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<view tt:if="{{common_site_type != 1}}" bindtap="selected_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view tt:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto br-t">
|
||||
<view tt:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block tt:if="{{common_site_type == 1}}">
|
||||
<view class="exhibition-mode">
|
||||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block tt:else>
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view bindtap="selectedt_event" data-type="all" class="fl selected">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view bindtap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{is_selected_all ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
<text>全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ Page({
|
|||
|
||||
// 优惠劵
|
||||
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":"[]"}';
|
||||
|
|
@ -80,12 +81,11 @@ Page({
|
|||
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;
|
||||
wx.request({
|
||||
url: app.get_request_url("index", "buy"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
data: this.request_data_coupon_merge(data),
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.stopPullDownRefresh();
|
||||
|
|
@ -110,13 +110,19 @@ Page({
|
|||
// 优惠劵选择处理
|
||||
if ((data.plugins_coupon_data || null) != null)
|
||||
{
|
||||
if ((data.plugins_coupon_data.coupon_choice || null) != null)
|
||||
var plugins_choice_coupon_value = [];
|
||||
for(var i in data.plugins_coupon_data)
|
||||
{
|
||||
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 + '张' : '暂无可用优惠劵' });
|
||||
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']['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 });
|
||||
}
|
||||
|
||||
// 地址
|
||||
|
|
@ -155,6 +161,19 @@ Page({
|
|||
});
|
||||
},
|
||||
|
||||
// 请求参数合并优惠券参数
|
||||
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();
|
||||
|
|
@ -172,7 +191,6 @@ 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;
|
||||
|
||||
// 数据验证
|
||||
|
|
@ -193,14 +211,14 @@ Page({
|
|||
wx.request({
|
||||
url: app.get_request_url("add", "buy"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
data: this.request_data_coupon_merge(data),
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.order.status == 1) {
|
||||
if (res.data.data.order_status == 1) {
|
||||
wx.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 {
|
||||
wx.redirectTo({url: '/pages/user-order/user-order'});
|
||||
|
|
@ -243,7 +261,11 @@ Page({
|
|||
|
||||
// 优惠劵弹层开启
|
||||
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,
|
||||
});
|
||||
},
|
||||
|
||||
// 优惠劵弹层关闭
|
||||
|
|
@ -253,19 +275,28 @@ Page({
|
|||
|
||||
// 优惠劵选择
|
||||
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,
|
||||
plugins_use_coupon_ids: temp,
|
||||
popup_plugins_coupon_status: false,
|
||||
});
|
||||
this.init();
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@
|
|||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠劵 -->
|
||||
<view wx:if="{{(plugins_coupon_data || null) != null && (plugins_coupon_data[index] || null) != null && (plugins_coupon_data[index].coupon_data || null) != null && (plugins_coupon_data[index].coupon_data.coupon_list || null) != null && plugins_coupon_data[index].coupon_data.coupon_list.length > 0}}" class="plugins-coupon bg-white spacing-mb arrow-right" data-index="{{index}}" bindtap="plugins_coupon_open_event">
|
||||
<text class="cr-666">优惠劵</text>
|
||||
<text class="cr-ccc fr">{{((plugins_choice_coupon_value || null) != null && (plugins_choice_coupon_value[group.id] || null) != null) ? plugins_choice_coupon_value[group.id] : '请选择优惠券'}}</text>
|
||||
</view>
|
||||
<!-- 扩展数据展示 -->
|
||||
<view wx:if="{{group.order_base.extension_data.length > 0}}" class="extension-list spacing-mt">
|
||||
<view wx:for="{{group.order_base.extension_data}}" wx:key="key" class="item oh">
|
||||
|
|
@ -85,22 +90,6 @@
|
|||
<view wx:if="{{popup_plugins_coupon_status}}" class="cr-888">{{user_note_value || '留言'}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠劵 -->
|
||||
<view wx:if="{{(plugins_coupon_data || null) != null && plugins_coupon_data.coupon_list.length > 0}}" class="plugins-coupon bg-white spacing-mb arrow-right" bindtap="plugins_coupon_open_event">
|
||||
<text class="cr-666">优惠劵</text>
|
||||
<text class="cr-ccc fr">{{plugins_choice_coupon_value}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 扩展数据展示 -->
|
||||
<view wx:if="{{extension_data.length > 0}}" class="extension-list spacing-mb">
|
||||
<view wx:for="{{extension_data}}" wx:key="key" class="item oh">
|
||||
<text class="cr-666 fl">{{item.name}}
|
||||
</text>
|
||||
<text class="text-tips fr">{{item.tips}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<view wx:if="{{payment_list.length > 0 && common_order_is_booking != 1}}" class="payment-list bg-white oh">
|
||||
<view class="item tc fl" wx:for="{{payment_list}}" wx:key="key">
|
||||
|
|
@ -113,7 +102,7 @@
|
|||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{price_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
|
|
@ -130,18 +119,19 @@
|
|||
|
||||
<!-- 优惠劵选择 -->
|
||||
<component-popup prop-show="{{popup_plugins_coupon_status}}" prop-position="bottom" bindonclose="plugins_coupon_close_event">
|
||||
<wxs src="../../utils/tools.wxs" module="tools" />
|
||||
<view class="plugins-coupon-popup bg-white">
|
||||
<view class="close oh">
|
||||
<view class="fr" catchtap="plugins_coupon_close_event">
|
||||
<icon type="clear" size="20" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{(plugins_coupon_data || null) != null && plugins_coupon_data.coupon_list.length > 0}}" class="coupon-container oh br-b">
|
||||
<view wx:if="{{popup_plugins_coupon_index != null && (plugins_coupon_data || null) != null && (plugins_coupon_data[popup_plugins_coupon_index] || null) != null && (plugins_coupon_data[popup_plugins_coupon_index].coupon_data || null) != null && (plugins_coupon_data[popup_plugins_coupon_index].coupon_data.coupon_list || null) != null && plugins_coupon_data[popup_plugins_coupon_index].coupon_data.coupon_list.length > 0}}" class="coupon-container oh br-b">
|
||||
<view class="not-use-tips tc">
|
||||
<text bindtap="plugins_coupon_not_use_event">不使用优惠劵</text>
|
||||
<text data-wid="{{plugins_coupon_data[popup_plugins_coupon_index].warehouse_id}}" bindtap="plugins_coupon_not_use_event">不使用优惠劵</text>
|
||||
</view>
|
||||
<block wx:for="{{plugins_coupon_data.coupon_list}}" wx:key="item">
|
||||
<view class="item spacing-mt bg-white" style="border:1px solid {{item.coupon.bg_color_value}};">
|
||||
<block wx:for="{{plugins_coupon_data[popup_plugins_coupon_index].coupon_data.coupon_list}}" wx:key="item">
|
||||
<view class="item spacing-mt bg-white {{tools.indexOf(plugins_use_coupon_ids, item.id) ? 'item-disabled' : ''}}" style="border:1px solid {{item.coupon.bg_color_value}};">
|
||||
<view class="v-left fl">
|
||||
<view class="base single-text" style="color:{{item.coupon.bg_color_value}};">
|
||||
<text class="symbol">{{price_symbol}}</text>
|
||||
|
|
@ -152,9 +142,9 @@
|
|||
<view wx:if="{{(item.coupon.use_limit_type_name || null) != null}}" class="base-tips cr-666 single-text">{{item.coupon.use_limit_type_name}}</view>
|
||||
<view class="base-time cr-888 single-text">{{item.time_start_text}} 至 {{item.time_end_text}}</view>
|
||||
</view>
|
||||
<view class="v-right fr" style="background:{{item.coupon.bg_color_value}};" data-index="{{index}}" data-value="{{item.id}}" bindtap="plugins_coupon_use_event">
|
||||
<view class="v-right fr" style="background:{{item.coupon.bg_color_value}};" data-wid="{{plugins_coupon_data[popup_plugins_coupon_index].warehouse_id}}" data-value="{{item.id}}" bindtap="plugins_coupon_use_event">
|
||||
<text class="circle"></text>
|
||||
<text>{{plugins_use_coupon_id == item.id ? '已选' : '选择'}}</text>
|
||||
<text>{{tools.indexOf(plugins_use_coupon_ids, item.id) ? '已选' : '选择'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ Page({
|
|||
},
|
||||
|
||||
// 选中处理
|
||||
selectedt_event(e) {
|
||||
selected_event(e) {
|
||||
var type = e.currentTarget.dataset.type || null;
|
||||
if (type != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view wx:if="{{data_list.length > 0}}" class="page">
|
||||
<view wx:for="{{data_list}}" wx:key="key" class="goods-item oh bg-white {{common_site_type == 1 ? 'exhibition-mode-data' : ''}}">
|
||||
<!-- 选择 -->
|
||||
<view wx:if="{{common_site_type != 1}}" bindtap="selectedt_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<view wx:if="{{common_site_type != 1}}" bindtap="selected_event" data-type="node" data-index="{{index}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{(item.is_error || 0) == 1 ? '-disabled' : ((item.selected || false) ? '-active' : '')}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view wx:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto br-t">
|
||||
<view wx:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block wx:if="{{common_site_type == 1}}">
|
||||
<view class="exhibition-mode">
|
||||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block wx:else>
|
||||
<view class="nav-base bg-white fl single-text">
|
||||
<view bindtap="selectedt_event" data-type="all" class="fl selected">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view bindtap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{is_selected_all ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
<text>全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
price_symbol: app.data.price_symbol,
|
||||
params: {},
|
||||
default_round_success_icon: app.data.default_round_success_icon,
|
||||
default_round_error_icon: app.data.default_round_error_icon,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
<image class="pay-icon" wx:if="{{params.code == '9000'}}" mode="widthFix" src="{{default_round_success_icon}}" />
|
||||
<image class="pay-icon" wx:else mode="widthFix" src="{{default_round_error_icon}}" />
|
||||
<text class="dis-block">{{params.msg}}</text>
|
||||
<view wx:if="{{params.code == '9000'}}" class="price-box">
|
||||
<text class="sales-price">{{price_symbol}}{{params.total_price}}</text>
|
||||
<text class="price-unit cr-888">元</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn-box">
|
||||
|
|
|
|||
|
|
@ -28,6 +28,3 @@ page{
|
|||
.dis-block {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
.price-box {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
|
@ -13,8 +13,7 @@ Page({
|
|||
is_show_payment_popup: false,
|
||||
payment_list: [],
|
||||
payment_id: 0,
|
||||
temp_pay_value: 0,
|
||||
temp_pay_index: 0,
|
||||
temp_pay_value: '',
|
||||
nav_status_list: [
|
||||
{ name: "全部", value: "-1" },
|
||||
{ name: "待付款", value: "1" },
|
||||
|
|
@ -24,6 +23,7 @@ Page({
|
|||
{ name: "已失效", value: "5,6" },
|
||||
],
|
||||
nav_status_index: 0,
|
||||
order_select_ids: [],
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
|
|
@ -115,16 +115,9 @@ Page({
|
|||
// 下订单支付处理
|
||||
if(this.data.load_status == 0)
|
||||
{
|
||||
if((this.data.params.is_pay || 0) == 1 && (this.data.params.order_id || 0) != 0)
|
||||
if((this.data.params.is_pay || 0) == 1 && (this.data.params.order_ids || null) != null)
|
||||
{
|
||||
for(var i in temp_data_list)
|
||||
{
|
||||
if(this.data.params.order_id == temp_data_list[i]['id'])
|
||||
{
|
||||
this.pay_handle(this.data.params.order_id, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.pay_handle(this.data.params.order_ids);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -200,7 +193,6 @@ Page({
|
|||
this.setData({
|
||||
is_show_payment_popup: true,
|
||||
temp_pay_value: e.currentTarget.dataset.value,
|
||||
temp_pay_index: e.currentTarget.dataset.index,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -214,11 +206,11 @@ Page({
|
|||
var payment_id = e.currentTarget.dataset.value || 0;
|
||||
this.setData({payment_id: payment_id});
|
||||
this.payment_popup_event_close();
|
||||
this.pay_handle(this.data.temp_pay_value, this.data.temp_pay_index);
|
||||
this.pay_handle(this.data.temp_pay_value);
|
||||
},
|
||||
|
||||
// 支付方法
|
||||
pay_handle(order_id, index) {
|
||||
pay_handle(order_ids) {
|
||||
var self = this;
|
||||
// 加载loding
|
||||
wx.showLoading({title: "请求中..." });
|
||||
|
|
@ -227,7 +219,7 @@ Page({
|
|||
url: app.get_request_url("pay", "order"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: order_id,
|
||||
ids: order_ids,
|
||||
payment_id: this.data.payment_id,
|
||||
},
|
||||
dataType: "json",
|
||||
|
|
@ -246,12 +238,11 @@ Page({
|
|||
paySign: res.data.data.data.paySign,
|
||||
success: function (res) {
|
||||
// 数据设置
|
||||
self.order_item_pay_success_handle(index);
|
||||
self.order_item_pay_success_handle(order_ids);
|
||||
|
||||
// 跳转支付页面
|
||||
wx.navigateTo({
|
||||
url: "/pages/paytips/paytips?code=9000&total_price=" +
|
||||
self.data.data_list[index]['total_price']
|
||||
url: "/pages/paytips/paytips?code=9000"
|
||||
});
|
||||
},
|
||||
fail: function (res) {
|
||||
|
|
@ -262,15 +253,22 @@ Page({
|
|||
|
||||
// 线下支付
|
||||
case 1 :
|
||||
var order_ids_arr = order_ids.split(',');
|
||||
var temp_data_list = self.data.data_list;
|
||||
temp_data_list[index]['is_under_line'] = 1;
|
||||
for(var i in temp_data_list)
|
||||
{
|
||||
if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1)
|
||||
{
|
||||
temp_data_list[i]['is_under_line'] = 1;
|
||||
}
|
||||
}
|
||||
self.setData({ data_list: temp_data_list });
|
||||
app.alert({ msg: res.data.msg, is_show_cancel: 0});
|
||||
break;
|
||||
|
||||
// 钱包支付
|
||||
case 2 :
|
||||
self.order_item_pay_success_handle(index);
|
||||
self.order_item_pay_success_handle(order_ids);
|
||||
app.showToast('支付成功', 'success');
|
||||
break;
|
||||
|
||||
|
|
@ -290,27 +288,35 @@ Page({
|
|||
},
|
||||
|
||||
// 支付成功数据设置
|
||||
order_item_pay_success_handle(index) {
|
||||
// 数据设置
|
||||
order_item_pay_success_handle(order_ids) {
|
||||
var order_ids_arr = order_ids.split(',');
|
||||
var temp_data_list = this.data.data_list;
|
||||
switch (parseInt(temp_data_list[index]['order_model'])) {
|
||||
// 销售模式
|
||||
case 0:
|
||||
temp_data_list[index]['status'] = 2;
|
||||
temp_data_list[index]['status_name'] = '待发货';
|
||||
break;
|
||||
|
||||
// 自提模式
|
||||
case 2:
|
||||
temp_data_list[index]['status'] = 2;
|
||||
temp_data_list[index]['status_name'] = '待取货';
|
||||
break;
|
||||
// 数据设置
|
||||
for(var i in temp_data_list)
|
||||
{
|
||||
if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1)
|
||||
{
|
||||
switch (parseInt(temp_data_list[i]['order_model'])) {
|
||||
// 销售模式
|
||||
case 0:
|
||||
temp_data_list[i]['status'] = 2;
|
||||
temp_data_list[i]['status_name'] = '待发货';
|
||||
break;
|
||||
|
||||
// 虚拟模式
|
||||
case 3:
|
||||
temp_data_list[index]['status'] = 3;
|
||||
temp_data_list[index]['status_name'] = '待收货';
|
||||
break;
|
||||
// 自提模式
|
||||
case 2:
|
||||
temp_data_list[i]['status'] = 2;
|
||||
temp_data_list[i]['status_name'] = '待取货';
|
||||
break;
|
||||
|
||||
// 虚拟模式
|
||||
case 3:
|
||||
temp_data_list[i]['status'] = 3;
|
||||
temp_data_list[i]['status_name'] = '待收货';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({ data_list: temp_data_list });
|
||||
},
|
||||
|
|
@ -413,7 +419,10 @@ Page({
|
|||
this.setData({
|
||||
nav_status_index: e.currentTarget.dataset.index || 0,
|
||||
data_page: 1,
|
||||
order_select_ids: [],
|
||||
});
|
||||
|
||||
// 重新拉取数据
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
|
|
@ -439,4 +448,31 @@ Page({
|
|||
url: "/pages/user-order-comments/user-order-comments?id=" + e.currentTarget.dataset.value
|
||||
});
|
||||
},
|
||||
|
||||
// 选中处理
|
||||
selected_event(e) {
|
||||
var oid = e.currentTarget.dataset.oid || 0;
|
||||
var temp_select_ids = this.data.order_select_ids;
|
||||
if(temp_select_ids.indexOf(oid) == -1)
|
||||
{
|
||||
temp_select_ids.push(oid);
|
||||
} else {
|
||||
for(var i in temp_select_ids)
|
||||
{
|
||||
if(temp_select_ids[i] == oid)
|
||||
{
|
||||
temp_select_ids.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({order_select_ids: temp_select_ids});
|
||||
},
|
||||
|
||||
// 合并支付
|
||||
pay_merge_event(e) {
|
||||
this.setData({
|
||||
is_show_payment_popup: true,
|
||||
temp_pay_value: this.data.order_select_ids.join(',')
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<wxs src="../../utils/tools.wxs" module="tools" />
|
||||
<!-- 导航 -->
|
||||
<view class="nav">
|
||||
<block wx:for="{{nav_status_list}}" wx:key="key">
|
||||
|
|
@ -11,10 +12,13 @@
|
|||
<view class="list-content">
|
||||
<view class="list-item bg-white spacing-mb" wx:if="{{data_list.length > 0}}" wx:for="{{data_list}}" wx:key="key">
|
||||
<view class="item-base oh br-b">
|
||||
<text class="cr-666 fl">{{item.add_time}}</text>
|
||||
<text class="fr cr-main">
|
||||
{{item.status_name}}<text wx:if="{{(item.is_under_line_text || null) != null}}">({{item.is_under_line_text}})</text>
|
||||
</text>
|
||||
<!-- 选择 -->
|
||||
<view wx:if="{{nav_status_index == 1}}" bindtap="selected_event" data-type="node" data-oid="{{item.id}}" class="fl selected">
|
||||
<image class="icon" src="/images/default-select{{tools.indexOf(order_select_ids, item.id) ? '-active' : ''}}-icon.png" mode="widthFix" />
|
||||
</view>
|
||||
<!-- 基础信息 -->
|
||||
<text class="fl cr-666">{{item.warehouse_name}}</text>
|
||||
<text class="fr cr-main">{{item.status_name}}<text wx:if="{{(item.is_under_line_text || null) != null}}">({{item.is_under_line_text}})</text></text>
|
||||
</view>
|
||||
<view wx:for="{{item.items}}" wx:key="key" wx:for-item="detail" class="goods-item br-b-dashed oh">
|
||||
<navigator url="/pages/user-order-detail/user-order-detail?id={{item.id}}" hover-class="none">
|
||||
|
|
@ -56,6 +60,11 @@
|
|||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 合并支付 -->
|
||||
<view wx:if="{{nav_status_index == 1 && order_select_ids.length > 0}}">
|
||||
<button class="submit-fixed pay-merge-submit" type="default" size="mini" hover-class="none" bindtap="pay_merge_event">合并支付</button>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式 popup -->
|
||||
<component-popup prop-show="{{is_show_payment_popup}}" prop-position="bottom" bindonclose="payment_popup_event_close">
|
||||
<view wx:if="{{payment_list.length > 0}}" class="payment-list oh bg-white">
|
||||
|
|
|
|||
|
|
@ -85,4 +85,23 @@
|
|||
height: 50rpx !important;
|
||||
vertical-align: middle;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选
|
||||
*/
|
||||
.selected .icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx !important;
|
||||
margin: 0 20rpx 0 10rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并支付按钮
|
||||
*/
|
||||
.pay-merge-submit {
|
||||
width: 220rpx;
|
||||
left: calc(50% - 110rpx);
|
||||
bottom: 50rpx;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
function indexOf(arr, value) {
|
||||
if (arr.indexOf(value) < 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
module.exports.indexOf = indexOf;
|
||||
Loading…
Reference in New Issue