mirror of
https://gitee.com/zongzhige/shopxo-uniapp.git
synced 2026-06-05 18:25:48 +08:00
手机端支持拼团
This commit is contained in:
7
App.vue
7
App.vue
@ -7,10 +7,10 @@
|
||||
data: {
|
||||
// 基础配置
|
||||
// 数据接口请求地址
|
||||
request_url:'https://new.shopxo.vip/',
|
||||
request_url:'http://shopxo.com/',
|
||||
|
||||
// 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/)
|
||||
static_url:'https://new.shopxo.vip/',
|
||||
static_url:'http://shopxo.com/',
|
||||
|
||||
// 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立)
|
||||
system_type: 'default',
|
||||
@ -3223,6 +3223,9 @@
|
||||
if(client_value == 'alipay') {
|
||||
// 自定义头页面
|
||||
var pages_always = [
|
||||
'pages/user-order/user-order',
|
||||
'pages/plugins/groupbuy/order/order',
|
||||
'pages/user-orderaftersale/user-orderaftersale',
|
||||
'pages/plugins/shop/index/index',
|
||||
'pages/plugins/shop/detail/detail',
|
||||
'pages/plugins/realstore/detail/detail',
|
||||
|
||||
@ -79,6 +79,8 @@
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
params: {},
|
||||
// init 传入的 data_params,合并到下单页 data
|
||||
buy_data_params: {},
|
||||
back_data: {},
|
||||
popup_status: false,
|
||||
goods_spec_base_price: 0,
|
||||
@ -100,6 +102,8 @@
|
||||
goods_cover_class: '',
|
||||
is_exist_many_spec: false,
|
||||
spec_confirm_btn_disabled_status: true,
|
||||
// 弹窗打开时的默认价格库存(未选完规格时恢复展示)
|
||||
default_spec_display: null,
|
||||
// 选中规格临时定时变量
|
||||
spec_selected_timer: null,
|
||||
spec_selected_timerout: null,
|
||||
@ -127,17 +131,68 @@
|
||||
type: Number,
|
||||
default: 100,
|
||||
},
|
||||
// 插件名称(拼团等规格接口走插件)
|
||||
propPluginsName: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
created: function () {},
|
||||
|
||||
methods: {
|
||||
// 合并下单页扩展参数(init 传入 data_params)
|
||||
buy_data_extend_merge(data) {
|
||||
var extend = this.buy_data_params || {};
|
||||
var reserve_keys = { buy_type: 1, goods_data: 1 };
|
||||
for (var key in extend) {
|
||||
if (reserve_keys[key] == 1) {
|
||||
continue;
|
||||
}
|
||||
if (extend[key] !== undefined && extend[key] !== null) {
|
||||
data[key] = extend[key];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// 规格/库存接口请求参数(拼团插件 id 为拼团活动 id)
|
||||
get_spec_request_data(extend) {
|
||||
extend = extend || {};
|
||||
var plugins = this.params.plugins_name || this.propPluginsName || '';
|
||||
var data = {};
|
||||
if (plugins == 'groupbuy') {
|
||||
data.id = parseInt(this.params.id || 0);
|
||||
} else {
|
||||
data.id = this.goods.id;
|
||||
}
|
||||
for (var key in extend) {
|
||||
if (extend[key] !== undefined && extend[key] !== null) {
|
||||
data[key] = extend[key];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// 规格接口地址
|
||||
get_goods_spec_request_url(action) {
|
||||
var plugins = this.params.plugins_name || this.propPluginsName || '';
|
||||
if(plugins != '')
|
||||
{
|
||||
return app.globalData.get_request_url(action, 'goods', plugins);
|
||||
}
|
||||
return app.globalData.get_request_url(action, 'goods');
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init(goods = {}, params = {}, back_data = null) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
params = params || {};
|
||||
var buy_data_params = params.data_params || {};
|
||||
var init_params = Object.assign({}, params);
|
||||
delete init_params.data_params;
|
||||
|
||||
// 状态默认开启弹窗
|
||||
var status = true;
|
||||
@ -147,12 +202,12 @@
|
||||
var is_exist_many_spec = parseInt(goods.is_exist_many_spec || 0) == 1 && goods_spec_choose.length > 0;
|
||||
// 无规格是否直接操作
|
||||
var is_direct_cart = 0;
|
||||
if ((params.is_direct_cart || 0) == 1 && !is_exist_many_spec) {
|
||||
if ((init_params.is_direct_cart || 0) == 1 && !is_exist_many_spec) {
|
||||
status = false;
|
||||
is_direct_cart = 1;
|
||||
}
|
||||
// 是否成功提示、默认提示
|
||||
var is_success_tips = params.is_success_tips == undefined ? 1 : params.is_success_tips || 0;
|
||||
var is_success_tips = init_params.is_success_tips == undefined ? 1 : init_params.is_success_tips || 0;
|
||||
// 直接加购、并且用户已经存在购物车则依次+1
|
||||
if (is_direct_cart == 1 && parseInt(goods.user_cart_count || 0) > 0) {
|
||||
var buy_number = 1;
|
||||
@ -162,7 +217,7 @@
|
||||
|
||||
// 购买按钮处理,仅展示购买和购物车
|
||||
var opt_button = [];
|
||||
var buy_button = params.buy_button || null;
|
||||
var buy_button = init_params.buy_button || null;
|
||||
if (buy_button != null && (buy_button.data || null) != null && buy_button.data.length > 0) {
|
||||
var arr = ['buy', 'cart', 'show'];
|
||||
for (var i in buy_button.data) {
|
||||
@ -175,12 +230,24 @@
|
||||
// 商品封面尺寸类型
|
||||
var goods_cover_size_type = app.globalData.get_config('config.common_goods_cover_size_type', 0);
|
||||
|
||||
// 默认价格库存快照(未选完多层规格时恢复)
|
||||
var default_spec_display = {
|
||||
price: goods.price,
|
||||
original_price: goods.original_price || 0,
|
||||
inventory: goods.inventory,
|
||||
inventory_unit: goods.inventory_unit,
|
||||
show_price_unit: goods.show_price_unit,
|
||||
show_original_price_unit: goods.show_original_price_unit,
|
||||
};
|
||||
|
||||
// 设置数据
|
||||
this.setData({
|
||||
popup_status: status,
|
||||
params: params || {},
|
||||
params: init_params || {},
|
||||
buy_data_params: buy_data_params,
|
||||
back_data: back_data,
|
||||
goods: goods || {},
|
||||
default_spec_display: default_spec_display,
|
||||
goods_spec_choose: goods_spec_choose,
|
||||
goods_spec_base_price: goods.price,
|
||||
goods_spec_base_original_price: goods.original_price || 0,
|
||||
@ -189,7 +256,7 @@
|
||||
goods_show_price_unit: goods.show_price_unit,
|
||||
goods_show_original_price_unit: goods.show_original_price_unit,
|
||||
buy_number: buy_number,
|
||||
buy_event_type: params.buy_event_type || 'cart',
|
||||
buy_event_type: init_params.buy_event_type || 'cart',
|
||||
opt_button: opt_button,
|
||||
is_direct_cart: is_direct_cart,
|
||||
is_success_tips: is_success_tips,
|
||||
@ -205,7 +272,7 @@
|
||||
}
|
||||
|
||||
// 初始化不能选择规格处理
|
||||
var is_init = (params.is_init === undefined || parseInt(params.is_init) == 1);
|
||||
var is_init = (init_params.is_init === undefined || parseInt(init_params.is_init) == 1);
|
||||
this.spec_handle_dont(is_init ? 0 : null);
|
||||
|
||||
// 获取规格详情
|
||||
@ -248,126 +315,117 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 清除自动选规格定时器
|
||||
clear_spec_selected_timer() {
|
||||
clearInterval(this.spec_selected_timer);
|
||||
clearTimeout(this.spec_selected_timerout);
|
||||
this.setData({
|
||||
spec_selected_timer: null,
|
||||
spec_selected_timerout: null,
|
||||
});
|
||||
},
|
||||
|
||||
// 未选完规格时恢复默认价格库存
|
||||
restore_default_spec_display() {
|
||||
var display = this.default_spec_display || null;
|
||||
var goods = this.goods || {};
|
||||
if (display == null) {
|
||||
display = {
|
||||
price: goods.price,
|
||||
original_price: goods.original_price || 0,
|
||||
inventory: goods.inventory,
|
||||
inventory_unit: goods.inventory_unit,
|
||||
show_price_unit: goods.show_price_unit,
|
||||
show_original_price_unit: goods.show_original_price_unit,
|
||||
};
|
||||
}
|
||||
var buy_number = parseInt(this.buy_number);
|
||||
var buy_min_number = parseInt(goods.buy_min_number || 1);
|
||||
var buy_max_number = parseInt(goods.buy_max_number || 0);
|
||||
if (buy_number < buy_min_number) {
|
||||
buy_number = buy_min_number;
|
||||
}
|
||||
if (buy_max_number > 0 && buy_number > buy_max_number) {
|
||||
buy_number = buy_max_number;
|
||||
}
|
||||
this.setData({
|
||||
goods_spec_base_price: display.price,
|
||||
goods_spec_base_original_price: display.original_price,
|
||||
goods_spec_base_inventory: display.inventory,
|
||||
goods_spec_base_inventory_unit: display.inventory_unit,
|
||||
goods_show_price_unit: display.show_price_unit,
|
||||
goods_show_original_price_unit: display.show_original_price_unit,
|
||||
goods_spec_base_buy_min_number: 0,
|
||||
goods_spec_base_buy_max_number: 0,
|
||||
buy_number: buy_number,
|
||||
spec_confirm_btn_disabled_status: this.is_exist_many_spec,
|
||||
});
|
||||
this.$emit('BackReleaseEvent');
|
||||
},
|
||||
|
||||
// 自动选中下一层规格(无法继续时停止并恢复默认展示)
|
||||
auto_select_spec_interval_handle(spec_choose, sku_count, match_name_callback) {
|
||||
var self = this;
|
||||
self.clear_spec_selected_timer();
|
||||
var num = 0;
|
||||
var timer = setInterval(function () {
|
||||
for (var i in spec_choose) {
|
||||
var active =
|
||||
spec_choose[i]['value']
|
||||
.map(function (v) {
|
||||
return v.is_active;
|
||||
})
|
||||
.join('') || null;
|
||||
if (active == null) {
|
||||
self.spec_handle_dont(i);
|
||||
var status = false;
|
||||
for (var k in spec_choose[i]['value']) {
|
||||
if (!status && (spec_choose[i]['value'][k]['is_disabled'] || null) == null && (spec_choose[i]['value'][k]['is_dont'] || null) == null && match_name_callback(spec_choose, i, k)) {
|
||||
self.goods_spec_choice_handle(i, k);
|
||||
status = true;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (!status) {
|
||||
self.clear_spec_selected_timer();
|
||||
self.restore_default_spec_display();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num >= sku_count) {
|
||||
self.clear_spec_selected_timer();
|
||||
}
|
||||
}, 100);
|
||||
var timerout = setTimeout(function () {
|
||||
self.clear_spec_selected_timer();
|
||||
self.restore_default_spec_display();
|
||||
}, 20000);
|
||||
self.setData({
|
||||
spec_selected_timer: timer,
|
||||
spec_selected_timerout: timerout,
|
||||
});
|
||||
},
|
||||
|
||||
// 指定规格初始化
|
||||
appoint_selected_spec_handle(spec_choose, spec) {
|
||||
spec = decodeURIComponent(spec).split('|');
|
||||
if (spec.length == spec_choose.length) {
|
||||
// 选择处理
|
||||
var self = this;
|
||||
// 销毁之前的任务
|
||||
clearInterval(self.spec_selected_timer);
|
||||
clearInterval(self.spec_selected_timerout);
|
||||
// 必须存在购买和加入购物车任意一个、规格必须多个
|
||||
var sku_count = app.globalData.get_length(spec_choose);
|
||||
// 先清除价格展示信息
|
||||
self.setData({
|
||||
goods_spec_base_price: '...',
|
||||
goods_spec_base_original_price: '...',
|
||||
});
|
||||
var num = 0;
|
||||
var timer = setInterval(function () {
|
||||
for (var i in spec_choose) {
|
||||
// 清除价格展示信息、避免获取价格类型赋值
|
||||
self.setData({
|
||||
goods_spec_base_price: '...',
|
||||
goods_spec_base_original_price: '...',
|
||||
});
|
||||
// 必须不存在已选择项
|
||||
var active =
|
||||
spec_choose[i]['value']
|
||||
.map(function (v) {
|
||||
return v.is_active;
|
||||
})
|
||||
.join('') || null;
|
||||
if (active == null) {
|
||||
// 不能选择规格处理
|
||||
self.spec_handle_dont(i);
|
||||
|
||||
// 规格选择处理
|
||||
var temp_spec = spec[i];
|
||||
var status = false;
|
||||
for (var k in spec_choose[i]['value']) {
|
||||
// 必须是可选和未选
|
||||
if (!status && (spec_choose[i]['value'][k]['is_disabled'] || null) == null && (spec_choose[i]['value'][k]['is_dont'] || null) == null && temp_spec == spec_choose[i]['value'][k]['name']) {
|
||||
self.goods_spec_choice_handle(i, k);
|
||||
status = true;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num >= sku_count) {
|
||||
clearInterval(self.spec_selected_timer);
|
||||
}
|
||||
}, 100);
|
||||
var timerout = setTimeout(function () {
|
||||
clearInterval(self.spec_selected_timerout);
|
||||
}, 20000);
|
||||
self.setData({
|
||||
spec_selected_timer: timer,
|
||||
spec_selected_timerout: timerout,
|
||||
this.auto_select_spec_interval_handle(spec_choose, sku_count, function (spec_choose, i, k) {
|
||||
return spec[i] == spec_choose[i]['value'][k]['name'];
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 默认选中第一个规格 - 智能工具箱插件
|
||||
plugins_intellectstools_selected_spec_handle(spec_choose) {
|
||||
// 选择处理
|
||||
var self = this;
|
||||
// 销毁之前的任务
|
||||
clearInterval(self.spec_selected_timer);
|
||||
clearInterval(self.spec_selected_timerout);
|
||||
// 读取智能工具插件配置、是否开启
|
||||
var config = self.plugins_intellectstools_config || null;
|
||||
var config = this.plugins_intellectstools_config || null;
|
||||
if (config != null && (config.is_goods_detail_selected_first_spec || 0) == 1) {
|
||||
// 必须存在购买和加入购物车任意一个、规格必须多个
|
||||
var sku_count = app.globalData.get_length(spec_choose);
|
||||
// 先清除价格展示信息
|
||||
self.setData({
|
||||
goods_spec_base_price: '...',
|
||||
goods_spec_base_original_price: '...',
|
||||
});
|
||||
var num = 0;
|
||||
var timer = setInterval(function () {
|
||||
for (var i in spec_choose) {
|
||||
// 清除价格展示信息、避免获取价格类型赋值
|
||||
self.setData({
|
||||
goods_spec_base_price: '...',
|
||||
goods_spec_base_original_price: '...',
|
||||
});
|
||||
// 必须不存在已选择项
|
||||
var active =
|
||||
spec_choose[i]['value']
|
||||
.map(function (v) {
|
||||
return v.is_active;
|
||||
})
|
||||
.join('') || null;
|
||||
if (active == null) {
|
||||
// 不能选择规格处理
|
||||
self.spec_handle_dont(i);
|
||||
|
||||
// 规格选择处理
|
||||
var status = false;
|
||||
for (var k in spec_choose[i]['value']) {
|
||||
// 必须是可选和未选
|
||||
if (!status && (spec_choose[i]['value'][k]['is_disabled'] || null) == null && (spec_choose[i]['value'][k]['is_dont'] || null) == null) {
|
||||
self.goods_spec_choice_handle(i, k);
|
||||
status = true;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num >= sku_count) {
|
||||
clearInterval(self.spec_selected_timer);
|
||||
}
|
||||
}, 100);
|
||||
var timerout = setTimeout(function () {
|
||||
clearInterval(self.spec_selected_timerout);
|
||||
}, 20000);
|
||||
self.setData({
|
||||
spec_selected_timer: timer,
|
||||
spec_selected_timerout: timerout,
|
||||
this.auto_select_spec_interval_handle(spec_choose, sku_count, function () {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -448,11 +506,11 @@
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
var data = this.params;
|
||||
data['id'] = this.goods.id;
|
||||
data['spec'] = JSON.stringify(spec);
|
||||
var data = this.get_spec_request_data({
|
||||
spec: JSON.stringify(spec),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('spectype', 'goods'),
|
||||
url: this.get_goods_spec_request_url('spectype'),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
@ -485,6 +543,11 @@
|
||||
this.setData({
|
||||
goods_spec_choose: temp_spec,
|
||||
});
|
||||
// 下一层无可选规格时,保持弹窗顶部默认价格库存
|
||||
var selected_spec = this.goods_selected_spec();
|
||||
if (selected_spec.length > 0 && selected_spec.length < sku_count && spec_type.length <= 0) {
|
||||
this.restore_default_spec_display();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
@ -523,39 +586,17 @@
|
||||
var sku_count = this.goods_spec_choose.length;
|
||||
var active_count = spec.length;
|
||||
if (spec.length <= 0 || active_count < sku_count) {
|
||||
var buy_number = parseInt(this.buy_number);
|
||||
var buy_min_number = parseInt(this.goods.buy_min_number || 1);
|
||||
var buy_max_number = parseInt(this.goods.buy_max_number || 0);
|
||||
if (buy_number < buy_min_number) {
|
||||
buy_number = buy_min_number;
|
||||
}
|
||||
if (buy_max_number > 0 && buy_number > buy_max_number) {
|
||||
buy_number = buy_max_number;
|
||||
}
|
||||
this.setData({
|
||||
goods_spec_base_price: this.goods.price,
|
||||
goods_spec_base_original_price: this.goods.original_price || 0,
|
||||
goods_spec_base_inventory: this.goods.inventory,
|
||||
goods_spec_base_inventory_unit: this.goods.inventory_unit,
|
||||
goods_show_price_unit: this.goods.show_price_unit,
|
||||
goods_show_original_price_unit: this.goods.show_original_price_unit,
|
||||
goods_spec_base_buy_min_number: 0,
|
||||
goods_spec_base_buy_max_number: 0,
|
||||
buy_number: buy_number,
|
||||
spec_confirm_btn_disabled_status: this.is_exist_many_spec,
|
||||
});
|
||||
// 释放-调用父级
|
||||
this.$emit("BackReleaseEvent");
|
||||
this.restore_default_spec_display();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
var data = this.params;
|
||||
data['id'] = this.goods.id;
|
||||
data['spec'] = JSON.stringify(spec);
|
||||
data['stock'] = this.buy_number;
|
||||
var data = this.get_spec_request_data({
|
||||
spec: JSON.stringify(spec),
|
||||
stock: this.buy_number,
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('specdetail', 'goods'),
|
||||
url: this.get_goods_spec_request_url('specdetail'),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
@ -564,10 +605,12 @@
|
||||
this.goods_spec_detail_back_handle(res.data.data);
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
this.restore_default_spec_display();
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
this.restore_default_spec_display();
|
||||
},
|
||||
});
|
||||
},
|
||||
@ -727,12 +770,12 @@
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
var data = this.params;
|
||||
data['id'] = this.goods.id;
|
||||
data['spec'] = spec;
|
||||
data['stock'] = this.buy_number;
|
||||
var data = this.get_spec_request_data({
|
||||
spec: spec,
|
||||
stock: this.buy_number,
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('stock', 'goods'),
|
||||
url: this.get_goods_spec_request_url('stock'),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
@ -803,29 +846,30 @@
|
||||
// 购买
|
||||
case 'buy':
|
||||
// 进入订单确认页面
|
||||
var goods_item = {
|
||||
goods_id: this.goods.id,
|
||||
stock: this.buy_number,
|
||||
spec: spec,
|
||||
};
|
||||
var data = {
|
||||
buy_type: 'goods',
|
||||
goods_data: encodeURIComponent(
|
||||
base64.encode(
|
||||
JSON.stringify([
|
||||
{
|
||||
goods_id: this.goods.id,
|
||||
stock: this.buy_number,
|
||||
spec: spec,
|
||||
},
|
||||
goods_item,
|
||||
])
|
||||
)
|
||||
)
|
||||
};
|
||||
// 转换数据
|
||||
var data_params = encodeURIComponent(base64.encode(JSON.stringify(data)));
|
||||
this.buy_data_extend_merge(data);
|
||||
var buy_query_data = encodeURIComponent(base64.encode(JSON.stringify(data)));
|
||||
|
||||
// 购买链接、默认系统购买页面
|
||||
if(buylink == null) {
|
||||
buylink = '/pages/buy/buy';
|
||||
}
|
||||
// 进去订单确认页面
|
||||
app.globalData.url_open(buylink+'?data=' + data_params);
|
||||
app.globalData.url_open(buylink+'?data=' + buy_query_data);
|
||||
|
||||
// 关闭弹窗
|
||||
this.popup_close_event();
|
||||
|
||||
@ -367,7 +367,11 @@
|
||||
"plugins-orderfeed-form": "Feed Data",
|
||||
"plugins-presale-index": "Presale",
|
||||
"plugins-presale-buy": "Order Confirmation",
|
||||
"plugins-presale-order": "Presale order"
|
||||
"plugins-presale-order": "Presale order",
|
||||
"plugins-groupbuy-index": "Group buy",
|
||||
"plugins-groupbuy-detail": "Group buy details",
|
||||
"plugins-groupbuy-team": "Join group",
|
||||
"plugins-groupbuy-order": "My group buy"
|
||||
},
|
||||
"login": {
|
||||
"login": {
|
||||
@ -2053,5 +2057,10 @@
|
||||
"fsdf33": "Please choose a specific type",
|
||||
"98yyuf": "Please enter your wonderful comment"
|
||||
}
|
||||
},
|
||||
"plugins-groupbuy-order": {
|
||||
"order": {
|
||||
"gbo001": "Enter group buy order no."
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -365,7 +365,11 @@
|
||||
"plugins-orderfeed-form": "反馈数据",
|
||||
"plugins-presale-index": "预售",
|
||||
"plugins-presale-buy": "订单确认",
|
||||
"plugins-presale-order": "预售订单"
|
||||
"plugins-presale-order": "预售订单",
|
||||
"plugins-groupbuy-index": "拼团",
|
||||
"plugins-groupbuy-detail": "拼团详情",
|
||||
"plugins-groupbuy-team": "参团",
|
||||
"plugins-groupbuy-order": "我的拼团"
|
||||
},
|
||||
"login": {
|
||||
"login": {
|
||||
@ -2036,5 +2040,10 @@
|
||||
"fsdf33": "请选择具体的类型",
|
||||
"98yyuf": "请输入您的精彩评论"
|
||||
}
|
||||
},
|
||||
"plugins-groupbuy-order": {
|
||||
"order": {
|
||||
"gbo001": "请输入拼团单号"
|
||||
}
|
||||
}
|
||||
}
|
||||
40
pages.json
40
pages.json
@ -2239,6 +2239,46 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/plugins/groupbuy",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "detail/detail",
|
||||
"style": {
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "team/team",
|
||||
"style": {
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "order/order",
|
||||
"style": {
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || APP
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
"transparentTitle": "auto",
|
||||
"titlePenetrate": "YES",
|
||||
// #endif
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/plugins/presale",
|
||||
"pages": [
|
||||
|
||||
@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view v-if="is_show" class="groupbuy-play-flow border-radius-main bg-white padding-main spacing-mb">
|
||||
<view class="play-flow-title text-wrapper title-left-border cr-black text-size-md fw-b">拼团玩法</view>
|
||||
<view class="groupbuy-play-steps-row flex-row align-stretch">
|
||||
<view v-if="play_flow_steps.length > 0" class="play-flow-steps flex-1">
|
||||
<block v-for="(item, index) in play_flow_steps" :key="index">
|
||||
<view class="play-flow-step tc" :class="item.step_class">
|
||||
<image v-if="(item.icon || null) != null" :src="item.icon" mode="aspectFill" class="play-step-icon radius margin-bottom-xs"></image>
|
||||
<view v-else class="play-step-icon play-step-icon-default bg-grey-f5 radius margin-bottom-xs">
|
||||
<iconfont name="icon-gift" size="40rpx" :color="item.icon_color"></iconfont>
|
||||
</view>
|
||||
<view :class="item.name_class">{{ item.name }}</view>
|
||||
</view>
|
||||
<view v-if="item.show_line" class="play-flow-line flex-row align-c" :class="item.line_class">
|
||||
<view class="play-flow-line-bar"></view>
|
||||
<iconfont name="icon-angle-right" size="28rpx" :color="item.line_icon_color" :propStyle="item.line_icon_style"></iconfont>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-if="play_side_nav.length > 0" class="groupbuy-play-side-nav">
|
||||
<button
|
||||
v-for="(nav, nav_index) in play_side_nav"
|
||||
:key="nav_index"
|
||||
class="groupbuy-play-side-nav-btn round bg-white br-grey cr-grey text-size-xs"
|
||||
type="default"
|
||||
:data-value="nav.url"
|
||||
@tap="side_nav_event"
|
||||
hover-class="none">{{ nav.name }}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="content_notice.length > 0" class="groupbuy-play-rules">
|
||||
<view class="play-rules-title text-wrapper title-left-border cr-black text-size-sm fw-b">拼团规则</view>
|
||||
<view class="play-rules-list">
|
||||
<view v-for="(rule, rindex) in content_notice" :key="rindex" v-if="rule" class="play-rules-item cr-grey text-size-xs">{{ rule }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
propConfig: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 大于 0 时启用拼团进度高亮(参团页)
|
||||
propPlayCurrentStep: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
propPlaySideNav: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
play_side_nav() {
|
||||
return (this.propPlaySideNav || null) != null && this.propPlaySideNav.length > 0 ? this.propPlaySideNav : [];
|
||||
},
|
||||
// 玩法步骤列表
|
||||
play_list() {
|
||||
var config = this.propConfig || {};
|
||||
return (config.play_list || null) != null && config.play_list.length > 0 ? config.play_list : [];
|
||||
},
|
||||
// 拼团规则列表
|
||||
content_notice() {
|
||||
var config = this.propConfig || {};
|
||||
return (config.content_notice || null) != null && config.content_notice.length > 0 ? config.content_notice : [];
|
||||
},
|
||||
// 是否显示组件
|
||||
is_show() {
|
||||
return this.play_list.length > 0 || this.content_notice.length > 0;
|
||||
},
|
||||
// 玩法流程展示数据(含进度高亮)
|
||||
play_flow_steps() {
|
||||
var list = this.play_list || [];
|
||||
var current = parseInt(this.propPlayCurrentStep || 0);
|
||||
var progress = current > 0;
|
||||
var steps = [];
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var step = i + 1;
|
||||
var step_class = '';
|
||||
var name_class = 'text-size-xs cr-grey step-name';
|
||||
var line_class = '';
|
||||
var line_icon_color = '#ccc';
|
||||
var line_icon_style = '';
|
||||
if (progress) {
|
||||
if (step < current) {
|
||||
step_class = 'is-done';
|
||||
name_class = 'text-size-xs step-name cr-main fw-b';
|
||||
line_class = 'is-active';
|
||||
line_icon_color = '#e54d42';
|
||||
line_icon_style = 'font-weight:bold;';
|
||||
} else if (step == current) {
|
||||
step_class = 'is-current';
|
||||
name_class = 'text-size-xs step-name cr-main fw-b';
|
||||
}
|
||||
}
|
||||
steps.push({
|
||||
icon: list[i].icon,
|
||||
name: list[i].name,
|
||||
step_class: step_class,
|
||||
name_class: name_class,
|
||||
icon_color: '#999',
|
||||
line_class: line_class,
|
||||
line_icon_color: line_icon_color,
|
||||
line_icon_style: line_icon_style,
|
||||
show_line: i + 1 < list.length,
|
||||
});
|
||||
}
|
||||
return steps;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
side_nav_event(e) {
|
||||
var url = e.currentTarget.dataset.value || '';
|
||||
if (url != '') {
|
||||
getApp().globalData.url_open(url);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.groupbuy-play-steps-row {
|
||||
gap: 20rpx;
|
||||
}
|
||||
.groupbuy-play-side-nav {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
width: 160rpx;
|
||||
}
|
||||
.groupbuy-play-side-nav-btn {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 8rpx;
|
||||
line-height: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
.play-flow-title {
|
||||
display: inline-block;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.play-rules-title {
|
||||
display: inline-block;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.play-flow-steps {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
flex-wrap: nowrap;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.play-flow-step {
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 0 8rpx;
|
||||
max-width: 200rpx;
|
||||
}
|
||||
.play-flow-steps .play-flow-line {
|
||||
flex: 1;
|
||||
min-width: 40rpx;
|
||||
max-width: 120rpx;
|
||||
align-self: flex-start;
|
||||
margin-top: 40rpx;
|
||||
padding: 0 4rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.play-flow-line-bar {
|
||||
flex: 1;
|
||||
height: 2rpx;
|
||||
background: #ddd;
|
||||
}
|
||||
.play-flow-line.is-active .play-flow-line-bar {
|
||||
height: 4rpx;
|
||||
background: var(--color-main, #e54d42);
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
.play-step-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
.play-step-icon-default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.groupbuy-play-steps-row + .groupbuy-play-rules {
|
||||
margin-top: 32rpx;
|
||||
padding-top: 24rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.play-rules-item {
|
||||
line-height: 1.6;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.play-rules-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
133
pages/plugins/groupbuy/detail/detail.css
Normal file
133
pages/plugins/groupbuy/detail/detail.css
Normal file
@ -0,0 +1,133 @@
|
||||
.goods-photo-swiper-wrap,
|
||||
.goods-photo-swiper-dot,
|
||||
.goods-photo-swiper {
|
||||
height: 750rpx;
|
||||
}
|
||||
.goods-photo-swiper-wrap {
|
||||
position: relative;
|
||||
}
|
||||
.goods-photo-image {
|
||||
width: 100%;
|
||||
height: 750rpx;
|
||||
}
|
||||
|
||||
/* 相册下方拼团价/成团信息全宽;仅约 20px 压到相册上 */
|
||||
.groupbuy-detail-hero {
|
||||
position: relative;
|
||||
}
|
||||
.groupbuy-detail-head-float {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
margin-top: -40rpx;
|
||||
}
|
||||
.groupbuy-detail-hero-no-photo .groupbuy-detail-head-float {
|
||||
margin-top: 0;
|
||||
}
|
||||
.groupbuy-detail-price-header {
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
overflow: hidden;
|
||||
padding: 32rpx 24rpx 56rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
}
|
||||
.groupbuy-detail-info-card {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-top: -48rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
}
|
||||
.groupbuy-detail-price-value {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.groupbuy-detail-original-price {
|
||||
margin-left: 12rpx;
|
||||
text-decoration: line-through;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.groupbuy-detail-team-tag {
|
||||
flex-shrink: 0;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
border-radius: 32rpx 0 32rpx 0;
|
||||
}
|
||||
.groupbuy-detail-status-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.groupbuy-detail-status-item {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.groupbuy-detail-status-item:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 20%;
|
||||
height: 60%;
|
||||
width: 1rpx;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.groupbuy-detail-spec-row {
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
.groupbuy-detail-spec-label {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.groupbuy-detail-spec-value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
justify-content: flex-end;
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
.groupbuy-detail-spec-text {
|
||||
max-width: 480rpx;
|
||||
text-align: right;
|
||||
}
|
||||
.groupbuy-detail-spec-arrow {
|
||||
flex-shrink: 0;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.goods-detail .groupbuy-detail-goods-title {
|
||||
padding: 24rpx 24rpx 0;
|
||||
}
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 50;
|
||||
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.groupbuy-detail-buy-nav-left {
|
||||
flex-shrink: 0;
|
||||
gap: 28rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.groupbuy-detail-nav-item {
|
||||
min-width: 72rpx;
|
||||
}
|
||||
.groupbuy-detail-nav-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.page-bottom-fixed {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
364
pages/plugins/groupbuy/detail/detail.vue
Normal file
364
pages/plugins/groupbuy/detail/detail.vue
Normal file
@ -0,0 +1,364 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data_list_loding_status == 3">
|
||||
<view class="page-bottom-fixed">
|
||||
<view class="groupbuy-detail-hero spacing-mb" :class="photo_list.length <= 0 ? 'groupbuy-detail-hero-no-photo' : ''">
|
||||
<view v-if="photo_list.length > 0" class="goods-photo-swiper-wrap">
|
||||
<uni-swiper-dot class="goods-photo-swiper-dot" mode="dot" :dots-styles="photo_dots_styles" :info="photo_list" :current="photo_swiper_current">
|
||||
<swiper class="goods-photo-swiper" circular :indicator-dots="false" @change="photo_swiper_change_event">
|
||||
<swiper-item v-for="(item, index) in photo_list" :key="index">
|
||||
<image :src="item.images" mode="aspectFill" class="goods-photo-image" :data-value="item.images" @tap="images_view_event"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
</view>
|
||||
<view class="groupbuy-detail-head-float">
|
||||
<view class="groupbuy-detail-price-header" :style="detail_header_bg_style">
|
||||
<view class="groupbuy-detail-price-main flex-row jc-sb align-c">
|
||||
<view class="groupbuy-detail-price-left">
|
||||
<view class="cr-white text-size-xs">拼团价</view>
|
||||
<view class="groupbuy-detail-price-value cr-white fw-b margin-top-xs">
|
||||
<text class="text-size-xs">{{ currency_symbol }}</text>
|
||||
<text class="text-size-xl">{{ display_price }}</text>
|
||||
<text v-if="show_original_price" class="groupbuy-detail-original-price text-size-xs">{{ currency_symbol }}{{ goods.original_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="groupbuy-detail-team-tag bg-white cr-main text-size-xs padding-horizontal-main padding-vertical-xs">
|
||||
{{ groupbuy.group_number }}人团
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="groupbuy-detail-info-card bg-white">
|
||||
<view class="multi-text text-size-md">{{ groupbuy.title || goods.title }}</view>
|
||||
<view class="groupbuy-detail-status-bar margin-top-main">
|
||||
<view class="groupbuy-detail-status-item flex-row jc-c align-c">
|
||||
<text class="groupbuy-detail-status-label text-size-xs cr-grey">成团</text>
|
||||
<text class="groupbuy-detail-status-value text-size-sm cr-black margin-left-xs">{{ groupbuy.group_number }}人</text>
|
||||
</view>
|
||||
<view class="groupbuy-detail-status-item flex-row jc-c align-c">
|
||||
<text class="groupbuy-detail-status-label text-size-xs cr-grey">成团数</text>
|
||||
<text class="groupbuy-detail-status-value text-size-sm cr-black margin-left-xs">{{ groupbuy.team_success_count || 0 }}</text>
|
||||
</view>
|
||||
<view class="groupbuy-detail-status-item flex-row jc-c align-c">
|
||||
<text class="groupbuy-detail-status-label text-size-xs cr-grey">限购</text>
|
||||
<text class="groupbuy-detail-status-value text-size-sm cr-black margin-left-xs">{{ limit_buy_display_text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="padding-horizontal-main">
|
||||
<view v-if="goods.is_exist_many_spec == 1" class="groupbuy-detail-spec-row border-radius-main bg-white spacing-mb flex-row jc-sb align-c" @tap="buy_open_event">
|
||||
<text class="groupbuy-detail-spec-label text-size-sm cr-black">规格</text>
|
||||
<view class="groupbuy-detail-spec-value flex-row align-c">
|
||||
<text v-if="(spec_selected_text || null) == null || spec_selected_text == ''" class="groupbuy-detail-spec-text text-size-sm cr-grey single-text">请选择规格</text>
|
||||
<text v-else class="groupbuy-detail-spec-text text-size-sm cr-black single-text">{{ spec_selected_text }}</text>
|
||||
<iconfont name="icon-arrow-right" color="#999" propClass="groupbuy-detail-spec-arrow"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<component-groupbuy-play-rules :propConfig="groupbuy_config" :propPlaySideNav="play_side_nav"></component-groupbuy-play-rules>
|
||||
|
||||
<view class="goods-detail border-radius-main bg-white spacing-mb">
|
||||
<view class="spacing-nav-title groupbuy-detail-goods-title">
|
||||
<text class="text-wrapper title-left-border text-size-xs">商品详情</text>
|
||||
</view>
|
||||
<view class="padding-main">
|
||||
<mp-html v-if="(goods.content_web || null) != null" :content="goods.content_web" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<view class="bottom-nav bg-white bottom-line-exclude">
|
||||
<view class="flex-row align-c padding-horizontal-main padding-vertical-sm gap-10">
|
||||
<view v-if="detail_buy_nav.length > 0" class="groupbuy-detail-buy-nav-left flex-row align-c">
|
||||
<block v-for="(nav, nav_index) in detail_buy_nav" :key="nav_index">
|
||||
<view
|
||||
v-if="nav.type == 'home' || nav.type == 'order'"
|
||||
class="groupbuy-detail-nav-item tc"
|
||||
:data-value="nav.url"
|
||||
@tap="url_event">
|
||||
<iconfont v-if="(nav.icon_app || null) != null" :name="'icon-' + nav.icon_app" size="40rpx" color="#666"></iconfont>
|
||||
<image v-else-if="(nav.icon || null) != null" :src="nav.icon" mode="aspectFit" class="groupbuy-detail-nav-icon"></image>
|
||||
<text class="dis-block text-size-xs cr-grey margin-top-xs">{{ nav.name }}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<button v-if="(goods.shop_goods_url || null) != null" class="btn round bg-white br-grey cr-grey text-size-sm flex-1" type="default" :data-value="goods.shop_goods_url" @tap="url_event" hover-class="none">单独购买</button>
|
||||
<button class="btn round bg-main cr-white text-size-sm flex-1" type="default" :disabled="buy_disabled" @tap="buy_open_event" hover-class="none">{{ buy_button_text }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<component-goods-buy ref="goods_buy" propPluginsName="groupbuy" v-on:SpecChoiceEvent="goods_spec_choice_event"></component-goods-buy>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentGoodsBuy from '@/components/goods-buy/goods-buy';
|
||||
import componentGroupbuyPlayRules from '../components/groupbuy-play-rules/groupbuy-play-rules';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
params: {},
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
goods: {},
|
||||
groupbuy: {},
|
||||
groupbuy_config: {},
|
||||
play_side_nav: [],
|
||||
detail_buy_nav: [],
|
||||
join_team_id: 0,
|
||||
photo_list: [],
|
||||
display_price: '0.00',
|
||||
spec_selected_text: '',
|
||||
buy_disabled: false,
|
||||
buy_button_text: '立即开团',
|
||||
show_original_price: false,
|
||||
share_info: {},
|
||||
photo_swiper_current: 0,
|
||||
photo_dots_styles: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 详情头部背景样式
|
||||
detail_header_bg_style() {
|
||||
var url = (this.groupbuy_config || {}).detail_base_bg_app || '';
|
||||
if (url == '') {
|
||||
return '';
|
||||
}
|
||||
return 'background-image:url(' + url + ');';
|
||||
},
|
||||
// 限购显示文案
|
||||
limit_buy_display_text() {
|
||||
var limit = parseInt((this.groupbuy || {}).limit_buy_text || (this.groupbuy || {}).buy_max_number || 0);
|
||||
if (limit > 0) {
|
||||
return limit;
|
||||
}
|
||||
if ((this.groupbuy || {}).user_limit_buy_number > 0) {
|
||||
return parseInt(this.groupbuy.user_limit_buy_number);
|
||||
}
|
||||
return '不限';
|
||||
},
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentGoodsBuy,
|
||||
componentGroupbuyPlayRules,
|
||||
componentBottomLine,
|
||||
},
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 参数处理
|
||||
params = app.globalData.launch_params_handle(params || {});
|
||||
this.setData({
|
||||
params: params || {},
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
photo_dots_styles: this.get_photo_dots_styles(),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 轮播指示点样式
|
||||
get_photo_dots_styles() {
|
||||
return {
|
||||
bottom: 36,
|
||||
width: 6,
|
||||
height: 6,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
||||
border: '0',
|
||||
selectedBackgroundColor: app.globalData.get_theme_color(),
|
||||
selectedBorder: '0',
|
||||
};
|
||||
},
|
||||
|
||||
// 轮播切换
|
||||
photo_swiper_change_event(e) {
|
||||
this.setData({
|
||||
photo_swiper_current: e.detail.current,
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var data = {
|
||||
id: this.params.id || this.params.groupbuy_id || 0,
|
||||
team_id: this.params.team_id || 0,
|
||||
};
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'index', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
var result = res.data.data;
|
||||
var goods = result.goods || {};
|
||||
var groupbuy = result.groupbuy || {};
|
||||
var join_team_id = parseInt(result.join_team_id || 0);
|
||||
var photo_list = [];
|
||||
if ((goods.photo || null) != null && goods.photo.length > 0) {
|
||||
photo_list = goods.photo;
|
||||
} else if ((goods.images || null) != null) {
|
||||
photo_list = [{ images: goods.images }];
|
||||
}
|
||||
var buy_display = result.detail_buy_display || {};
|
||||
var inventory = parseInt(goods.inventory || 0);
|
||||
var buy_button_text = buy_display.buy_button_text || (join_team_id > 0 ? '立即参团' : '立即开团');
|
||||
var buy_disabled = buy_display.buy_disabled == 1;
|
||||
if (inventory <= 0 && !buy_display.buy_button_text) {
|
||||
buy_button_text = '没库存了';
|
||||
buy_disabled = true;
|
||||
}
|
||||
var show_original_price = buy_display.show_original_price == 1;
|
||||
if (!show_original_price && (goods.original_price || null) != null && (groupbuy.min_groupbuy_price || null) != null) {
|
||||
show_original_price = parseFloat(goods.original_price) > parseFloat(groupbuy.min_groupbuy_price);
|
||||
}
|
||||
this.setData({
|
||||
goods: goods,
|
||||
groupbuy: groupbuy,
|
||||
show_original_price: show_original_price,
|
||||
groupbuy_config: result.groupbuy_config || {},
|
||||
play_side_nav: result.play_side_nav || [],
|
||||
detail_buy_nav: result.detail_buy_nav || [],
|
||||
join_team_id: join_team_id,
|
||||
photo_list: photo_list,
|
||||
display_price: groupbuy.groupbuy_price_text || groupbuy.min_groupbuy_price || goods.price || '0.00',
|
||||
buy_disabled: buy_disabled || inventory <= 0,
|
||||
buy_button_text: buy_button_text,
|
||||
spec_selected_text: '',
|
||||
data_list_loding_status: 3,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: true,
|
||||
share_info: {
|
||||
title: groupbuy.title || goods.title,
|
||||
path: '/pages/plugins/groupbuy/detail/detail?id=' + groupbuy.id + (join_team_id > 0 ? '&team_id=' + join_team_id : ''),
|
||||
img: goods.images || '',
|
||||
},
|
||||
});
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 规格选择
|
||||
goods_spec_choice_event(e) {
|
||||
var spec = (e || null) != null ? e.spec || [] : [];
|
||||
var text = '';
|
||||
if (spec.length > 0) {
|
||||
text = spec.map(function (v) {
|
||||
return v.value;
|
||||
}).join(' ');
|
||||
}
|
||||
var temp_goods = this.goods;
|
||||
if ((temp_goods.specifications || null) != null && (e.goods_spec_choose || null) != null) {
|
||||
temp_goods['specifications']['choose'] = e.goods_spec_choose;
|
||||
}
|
||||
this.setData({
|
||||
goods: temp_goods,
|
||||
spec_selected_text: text,
|
||||
});
|
||||
},
|
||||
|
||||
// 打开购买弹窗
|
||||
buy_open_event() {
|
||||
if (this.buy_disabled) {
|
||||
return false;
|
||||
}
|
||||
var user = app.globalData.get_user_info(this, 'buy_open_event');
|
||||
if (user == false) {
|
||||
return false;
|
||||
}
|
||||
var buy_name = this.join_team_id > 0 ? '立即参团' : '立即开团';
|
||||
this.$refs.goods_buy.init(this.goods, {
|
||||
id: this.groupbuy.id,
|
||||
plugins_name: 'groupbuy',
|
||||
buy_event_type: 'buy',
|
||||
is_success_tips: 0,
|
||||
buy_button: {
|
||||
data: [{ type: 'buy', name: buy_name, color: 'main' }],
|
||||
},
|
||||
data_params: {
|
||||
groupbuy_id: this.groupbuy.id,
|
||||
team_id: this.join_team_id,
|
||||
is_team_leader: this.join_team_id > 0 ? 0 : 1,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 图片预览
|
||||
images_view_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if (value != null) {
|
||||
uni.previewImage({ current: value, urls: [value] });
|
||||
}
|
||||
},
|
||||
|
||||
// 链接事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './detail.css';
|
||||
</style>
|
||||
75
pages/plugins/groupbuy/index/index.css
Normal file
75
pages/plugins/groupbuy/index/index.css
Normal file
@ -0,0 +1,75 @@
|
||||
.groupbuy-index-page {
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding-top: 16rpx;
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
|
||||
/* 商品横排列表 */
|
||||
.groupbuy-goods-list {
|
||||
margin-top: 0;
|
||||
}
|
||||
.groupbuy-goods-card {
|
||||
position: relative;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.groupbuy-goods-main {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.groupbuy-goods-image-wrap {
|
||||
flex-shrink: 0;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.groupbuy-goods-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
display: block;
|
||||
}
|
||||
.groupbuy-goods-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.groupbuy-goods-meta {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 12rpx;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.groupbuy-tag {
|
||||
display: inline-block;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
.groupbuy-goods-price-row {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
.groupbuy-goods-price {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.groupbuy-current-price {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.groupbuy-goods-btn {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
bottom: 24rpx;
|
||||
z-index: 2;
|
||||
padding: 0 32rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
185
pages/plugins/groupbuy/index/index.vue
Normal file
185
pages/plugins/groupbuy/index/index.vue
Normal file
@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data_list_loding_status == 3">
|
||||
<view class="groupbuy-index-page bg-grey-f5 padding-horizontal-main">
|
||||
<component-banner v-if="slider_list.length > 0" :propData="slider_list" propRadius="radius"></component-banner>
|
||||
|
||||
<block v-if="data.length > 0">
|
||||
<view class="groupbuy-goods-list">
|
||||
<view v-for="(item, index) in data" :key="index" class="groupbuy-goods-card border-radius-main bg-white spacing-mb">
|
||||
<view class="groupbuy-goods-main" :data-value="item.url" @tap="url_event">
|
||||
<view class="groupbuy-goods-image-wrap bg-grey-f5 radius">
|
||||
<image class="groupbuy-goods-image" :src="item.images" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="groupbuy-goods-body">
|
||||
<view class="multi-text cr-black">{{ item.groupbuy_title || item.title }}</view>
|
||||
<view class="groupbuy-goods-meta">
|
||||
<text class="groupbuy-tag br-main cr-main bg-white text-size-xs radius padding-horizontal-sm">{{ item.group_number }}人团</text>
|
||||
<text class="groupbuy-success-text cr-main text-size-xs">{{ item.groupbuy_success_text }}</text>
|
||||
</view>
|
||||
<view class="groupbuy-goods-price-row">
|
||||
<view class="groupbuy-goods-price">
|
||||
<text v-if="item.is_show_original_price == 1" class="original-price">{{ currency_symbol }}{{ item.original_price }}</text>
|
||||
<view class="groupbuy-current-price cr-main fw-b">
|
||||
<text class="price-symbol text-size-xs">{{ currency_symbol }}</text>
|
||||
<text class="price-value text-size-lg">{{ item.groupbuy_price_text || item.groupbuy_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="groupbuy-goods-btn bg-main cr-white text-size-sm radius" :data-value="item.url" @tap="url_event">去拼团</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data propStatus="0" :propMsg="$t('detail.detail.5knxg6')"></component-no-data>
|
||||
</block>
|
||||
|
||||
<component-groupbuy-play-rules v-if="data.length > 0" :propConfig="groupbuy_config" :propPlaySideNav="play_side_nav"></component-groupbuy-play-rules>
|
||||
<component-bottom-line v-if="data.length > 0" :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentBanner from '@/components/slider/slider';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentGroupbuyPlayRules from '../components/groupbuy-play-rules/groupbuy-play-rules';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
data: [],
|
||||
slider_list: [],
|
||||
groupbuy_config: null,
|
||||
play_side_nav: [],
|
||||
data_base: null,
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentBanner,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGroupbuyPlayRules,
|
||||
},
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var data_list = data.data || [];
|
||||
var slider_list = data.slider_list || [];
|
||||
var data_base = data.data_base || null;
|
||||
var nav_title = '拼团';
|
||||
var share_img = '';
|
||||
if (data_base != null) {
|
||||
nav_title = data_base.application_name || nav_title;
|
||||
if (slider_list.length > 0 && (slider_list[0].images_url || null) != null) {
|
||||
share_img = slider_list[0].images_url;
|
||||
} else if (data_list.length > 0 && (data_list[0].images || null) != null) {
|
||||
share_img = data_list[0].images;
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data: data_list,
|
||||
slider_list: slider_list,
|
||||
groupbuy_config: data.groupbuy_config || null,
|
||||
play_side_nav: data.play_side_nav || [],
|
||||
data_base: data_base,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: data_list.length > 0,
|
||||
share_info: {
|
||||
title: (data_base || {}).seo_title || nav_title,
|
||||
desc: (data_base || {}).seo_desc || '',
|
||||
path: '/pages/plugins/groupbuy/index/index',
|
||||
img: share_img,
|
||||
},
|
||||
});
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 链接事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './index.css';
|
||||
</style>
|
||||
19
pages/plugins/groupbuy/order/order.css
Normal file
19
pages/plugins/groupbuy/order/order.css
Normal file
@ -0,0 +1,19 @@
|
||||
.goods-cover {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.groupbuy-order-nav.nav-base {
|
||||
height: auto;
|
||||
line-height: normal;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.groupbuy-order-nav .item {
|
||||
display: inline-block;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 28rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
479
pages/plugins/groupbuy/order/order.vue
Normal file
479
pages/plugins/groupbuy/order/order.vue
Normal file
@ -0,0 +1,479 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<!-- 自定义导航 + 搜索 -->
|
||||
<component-nav-back :propFixed="false" propClass="bg-white cr-black" propColor="#333" :propName="nav_title" :style="'padding-top:' + status_bar_height + 'px;'">
|
||||
<template slot="right" :class="is_mp_env ? 'top-search-width' : ''">
|
||||
<view class="margin-left-main" :class="is_mp_env ? '' : 'flex-1 flex-width'">
|
||||
<component-search
|
||||
@onsearch="search_button_event"
|
||||
:propDefaultValue="search_keywords"
|
||||
:propIsOnEvent="true"
|
||||
:propIsRequired="false"
|
||||
:propPlaceholder="$t('plugins-groupbuy-order.order.gbo001')"
|
||||
propIconColor="#ccc"
|
||||
propPlaceholderClass="cr-grey-c"
|
||||
propBgColor="#f6f6f6"
|
||||
></component-search>
|
||||
</view>
|
||||
</template>
|
||||
</component-nav-back>
|
||||
<view class="groupbuy-order-header bg-white">
|
||||
<view v-if="nav_status_list.length > 0" class="nav-base groupbuy-order-nav scroll-view-horizontal padding-horizontal-main">
|
||||
<scroll-view :scroll-x="true" :show-scrollbar="false" :scroll-with-animation="true" :scroll-into-view="'groupbuy-nav-' + nav_status_index">
|
||||
<block v-for="(item, index) in nav_status_list" :key="index">
|
||||
<view
|
||||
:id="'groupbuy-nav-' + index"
|
||||
:class="'item tc ' + (nav_status_index == index ? 'cr-main nav-active-line' : 'cr-grey')"
|
||||
:data-index="index"
|
||||
@tap="nav_event"
|
||||
>{{ item.name }}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" class="scroll-box-groupbuy-order" :style="content_style" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view v-if="data_list.length > 0" class="data-list padding-horizontal-main padding-top-main">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item padding-main border-radius-main oh bg-white spacing-mb">
|
||||
<view class="base oh br-b-dashed padding-bottom-main flex-row jc-sb align-c">
|
||||
<text class="cr-grey-9">{{ item.add_time }}</text>
|
||||
<text :class="item.status_class || 'cr-grey-9'">{{ item.status_name }}</text>
|
||||
</view>
|
||||
<block v-for="(items, index2) in item.detail" :key="index2">
|
||||
<view class="oh margin-top flex-row gap-10" :data-value="items.url || items.goods_url" @tap="url_event">
|
||||
<image :src="items.images" mode="aspectFill" class="br-f5 radius goods-cover"></image>
|
||||
<view class="goods-base flex-1 flex-width">
|
||||
<view class="single-text">{{ items.title }}</view>
|
||||
<view class="margin-top-xs cr-grey text-size-xs">
|
||||
<text>{{ currency_symbol }}{{ items.price }} x{{ items.buy_number }}</text>
|
||||
</view>
|
||||
<view v-if="(items.spec_text || null) != null" class="margin-top-xs cr-grey-9 text-size-xs single-text">{{ items.spec_text }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<component-panel-content :propData="item" :propDataField="field_list" propIsItemShowMax="6" propExcludeField="add_time,status_name" :propIsTerse="true"></component-panel-content>
|
||||
<view v-if="(item.team_url || null) != null || (item.system_order_url || null) != null || (item.is_operate_cancel || 0) == 1 || (item.is_operate_delete || 0) == 1" class="item-operation tr margin-top-main">
|
||||
<button v-if="(item.team_url || null) != null" class="btn round bg-main br-main cr-white text-size-md margin-bottom-sm" type="default" size="mini" :data-value="item.team_url" @tap="url_event" hover-class="none">参团</button>
|
||||
<button v-if="(item.system_order_url || null) != null" class="btn round br-green cr-green bg-white text-size-md margin-bottom-sm" type="default" size="mini" :data-value="item.system_order_url" @tap="url_event" hover-class="none">订单</button>
|
||||
<button v-if="(item.is_operate_cancel || 0) == 1" class="btn round br-grey-9 bg-white text-size-md" type="default" size="mini" @tap="cancel_event" :data-value="item.id" :data-index="index" hover-class="none">{{$t('common.cancel')}}</button>
|
||||
<button v-if="(item.is_operate_delete || 0) == 1" class="btn round br-red cr-red bg-white text-size-md" type="default" size="mini" @tap="delete_event" :data-value="item.id" :data-index="index" hover-class="none">{{$t('common.del')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-else>
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNavBack from '@/components/nav-back/nav-back';
|
||||
import componentSearch from '@/components/search/search';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentPanelContent from '@/components/panel-content/panel-content';
|
||||
|
||||
// 状态栏高度
|
||||
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
|
||||
// #ifdef MP-TOUTIAO || H5
|
||||
bar_height = 0;
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
client_type: app.globalData.application_client_type(),
|
||||
status_bar_height: bar_height,
|
||||
is_mp_env: false,
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-QQ || MP-KUAISHOU
|
||||
is_mp_env: true,
|
||||
// #endif
|
||||
nav_title: '',
|
||||
content_style: '',
|
||||
field_list: [],
|
||||
params: {},
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
data_base: null,
|
||||
groupbuy_config: {},
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
search_keywords: '',
|
||||
nav_status_list: [],
|
||||
nav_status_index: 0,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNavBack,
|
||||
componentSearch,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentPanelContent,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 参数处理
|
||||
params = app.globalData.launch_params_handle(params || {});
|
||||
|
||||
this.setData({
|
||||
params: params || {},
|
||||
search_keywords: params.order_no || params.keywords || '',
|
||||
nav_title: this.$t('pages.plugins-groupbuy-order'),
|
||||
content_style: 'height: calc(100vh - 80rpx - ' + (this.status_bar_height + (this.client_type == 'h5' ? 55 : 50)) + 'px);',
|
||||
});
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 初始化
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
|
||||
// onShow 可能早于 init 完成,tab 已就绪但列表未拉取时补拉一次
|
||||
if (this.nav_status_list.length > 0 && this.data_list.length <= 0 && this.data_is_loading == 0) {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
} else if (this.nav_status_list.length <= 0 && this.data_list_loding_status != 1) {
|
||||
this.init();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.get_data_base();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取基础数据
|
||||
get_data_base() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('init', 'order', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var nav_list = data.nav_list || [];
|
||||
var nav_status_index = 0;
|
||||
var page_params = this.params || {};
|
||||
if ((page_params.status || null) != null) {
|
||||
for (var i in nav_list) {
|
||||
if (nav_list[i].value == page_params.status) {
|
||||
nav_status_index = parseInt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var self = this;
|
||||
this.setData({
|
||||
data_base: data.data_base || null,
|
||||
groupbuy_config: data.groupbuy_config || {},
|
||||
nav_status_list: nav_list,
|
||||
nav_status_index: nav_status_index,
|
||||
data_page: 1,
|
||||
data_bottom_line_status: false,
|
||||
}, function () {
|
||||
self.get_data_list(1);
|
||||
});
|
||||
if ((data.data_base || null) != null) {
|
||||
var title = data.data_base.user_menu_name || data.data_base.application_name || '';
|
||||
if (title != '') {
|
||||
this.setData({
|
||||
nav_title: title,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_base')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取数据列表
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0 && this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
var nav_list = this.nav_status_list || [];
|
||||
if (nav_list.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 请求参数
|
||||
var data = { page: this.data_page };
|
||||
var nav = nav_list[this.nav_status_index] || nav_list[0] || null;
|
||||
if (nav != null && nav.value != -1) {
|
||||
data.status = nav.value;
|
||||
}
|
||||
if ((this.search_keywords || null) != null && this.search_keywords.length > 0) {
|
||||
data.order_no = this.search_keywords;
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'order', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var result = res.data.data;
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = result.data_list || [];
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = result.data_list || [];
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
temp_data_list = this.format_order_list(temp_data_list);
|
||||
this.setData({
|
||||
field_list: result.field_list || [],
|
||||
data_list: temp_data_list,
|
||||
data_page_total: result.page_total,
|
||||
data_list_loding_status: temp_data_list.length > 0 ? 3 : 0,
|
||||
data_list_loding_msg: '',
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
// 是否还有数据(有列表且已加载完才显示底线,无数据不显示)
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_list.length > 0 && this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 滚动加载
|
||||
scroll_lower() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 导航切换
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_status_index: e.currentTarget.dataset.index || 0,
|
||||
data_page: 1,
|
||||
data_list: [],
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 取消
|
||||
cancel_event(e) {
|
||||
uni.showModal({
|
||||
title: this.$t('common.warm_tips'),
|
||||
content: this.$t('common.cancel_confirm_tips'),
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
uni.showLoading({ title: this.$t('common.processing_in_text') });
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('cancel', 'order', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: { ids: value },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data_list;
|
||||
temp_data_list[index]['status'] = 4;
|
||||
temp_data_list[index]['status_name'] = '已取消';
|
||||
temp_data_list[index]['status_class'] = 'cr-red';
|
||||
this.setData({ data_list: temp_data_list });
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
delete_event(e) {
|
||||
uni.showModal({
|
||||
title: this.$t('common.warm_tips'),
|
||||
content: this.$t('common.delete_confirm_tips'),
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
uni.showLoading({ title: this.$t('common.processing_in_text') });
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('delete', 'order', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: { ids: value },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_list_loding_status: temp_data_list.length > 0 ? 3 : 0,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 链接事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 列表状态样式
|
||||
format_order_list(list) {
|
||||
if (list == null || list.length <= 0) {
|
||||
return list || [];
|
||||
}
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var s = parseInt(list[i].status);
|
||||
var status_class = 'cr-grey-9';
|
||||
if (s === 2) {
|
||||
status_class = 'cr-green';
|
||||
} else if (s === 3) {
|
||||
status_class = 'cr-yellow';
|
||||
} else if (s === 4 || s === 5) {
|
||||
status_class = 'cr-red';
|
||||
} else if (s === 1) {
|
||||
status_class = 'cr-main';
|
||||
}
|
||||
list[i].status_class = status_class;
|
||||
}
|
||||
return list;
|
||||
},
|
||||
// 关键字搜索
|
||||
search_button_event(e) {
|
||||
this.setData({
|
||||
search_keywords: e,
|
||||
data_page: 1,
|
||||
data_list: [],
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './order.css';
|
||||
</style>
|
||||
142
pages/plugins/groupbuy/team/team.css
Normal file
142
pages/plugins/groupbuy/team/team.css
Normal file
@ -0,0 +1,142 @@
|
||||
.team-goods-image {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
}
|
||||
.groupbuy-tag {
|
||||
display: inline-block;
|
||||
}
|
||||
.team-members .member-item {
|
||||
width: 120rpx;
|
||||
margin: 0 16rpx 20rpx;
|
||||
position: relative;
|
||||
}
|
||||
.member-avatar {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
.member-empty {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.leader-badge {
|
||||
position: absolute;
|
||||
top: 70rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 拼团成功:喜庆背景(对齐 PC 参团页) */
|
||||
.team-status-panel-success {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(180deg, #ffd4b8 0%, #ffe8d6 28%, #fff3eb 55%, #fffaf6 100%);
|
||||
}
|
||||
.team-status-panel-success::before,
|
||||
.team-status-panel-success::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
.team-status-panel-success::before {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
top: -70rpx;
|
||||
right: -50rpx;
|
||||
background: radial-gradient(circle, rgba(255, 152, 64, 0.45) 0%, rgba(255, 183, 77, 0) 70%);
|
||||
}
|
||||
.team-status-panel-success::after {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
bottom: -50rpx;
|
||||
left: -40rpx;
|
||||
background: radial-gradient(circle, rgba(229, 77, 66, 0.18) 0%, rgba(229, 77, 66, 0) 70%);
|
||||
}
|
||||
.team-status-success {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
}
|
||||
.team-success-visual {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.team-success-icon-wrap {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, #ff7043 0%, #e54d42 55%, #d84315 100%);
|
||||
box-shadow: 0 8rpx 24rpx rgba(229, 77, 66, 0.35);
|
||||
}
|
||||
.team-success-spark {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: #ffb74d;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.team-success-spark-1 {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
top: 4rpx;
|
||||
right: 8rpx;
|
||||
}
|
||||
.team-success-spark-2 {
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
bottom: 12rpx;
|
||||
left: -4rpx;
|
||||
background: #ffb74d;
|
||||
}
|
||||
.team-success-spark-3 {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
top: 24rpx;
|
||||
left: 16rpx;
|
||||
background: #ff8a65;
|
||||
}
|
||||
.team-success-title {
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
letter-spacing: 2rpx;
|
||||
color: #e54d42;
|
||||
}
|
||||
.team-success-desc {
|
||||
margin-bottom: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.team-success-tags {
|
||||
gap: 12rpx;
|
||||
}
|
||||
.team-success-tag {
|
||||
display: inline-block;
|
||||
padding: 4rpx 18rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: #e54d42;
|
||||
background: rgba(255, 255, 255, 0.88);
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
|
||||
/* 拼团失败 */
|
||||
.team-status-fail {
|
||||
width: 100%;
|
||||
}
|
||||
.team-fail-icon-wrap {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
margin-bottom: 12rpx;
|
||||
border-radius: 50%;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
284
pages/plugins/groupbuy/team/team.vue
Normal file
284
pages/plugins/groupbuy/team/team.vue
Normal file
@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="data_list_loding_status == 3">
|
||||
<view class="padding-horizontal-main padding-top-main">
|
||||
<view class="border-radius-main bg-white padding-main spacing-mb">
|
||||
<view class="flex-row gap-20" :data-value="'/pages/plugins/groupbuy/detail/detail?id=' + groupbuy.id" @tap="url_event">
|
||||
<image :src="goods.images" mode="aspectFill" class="team-goods-image radius"></image>
|
||||
<view class="flex-1 flex-width">
|
||||
<view class="single-text fw-b">{{ groupbuy.title || goods.title }}</view>
|
||||
<view class="margin-top-xs">
|
||||
<text class="groupbuy-tag cr-white bg-main text-size-xs radius padding-horizontal-sm">{{ groupbuy.group_number }}人团</text>
|
||||
</view>
|
||||
<view class="margin-top-sm">
|
||||
<text class="cr-main fw-b">{{ currency_symbol }}{{ groupbuy.groupbuy_price_text || groupbuy.min_groupbuy_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="border-radius-main padding-main spacing-mb team-status-panel" :class="team.status == 1 ? 'team-status-panel-success' : 'bg-white'">
|
||||
<block v-if="team.status == 0">
|
||||
<view class="tc fw-b text-size-md">拼团中,还差 <text class="cr-red">{{ team.remain_number }}</text> 人</view>
|
||||
<view v-if="countdown_text != ''" class="tc cr-grey text-size-xs margin-top-sm">剩余 {{ countdown_text }} 结束</view>
|
||||
</block>
|
||||
<block v-else-if="team.status == 1">
|
||||
<view class="team-status-success tc">
|
||||
<view class="team-success-visual">
|
||||
<view class="team-success-icon-wrap">
|
||||
<view class="team-success-spark team-success-spark-1"></view>
|
||||
<view class="team-success-spark team-success-spark-2"></view>
|
||||
<view class="team-success-spark team-success-spark-3"></view>
|
||||
<iconfont name="icon-checked-smooth" size="56rpx" color="#ffffff"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
<view class="team-success-title">拼团成功</view>
|
||||
<view class="team-success-desc cr-grey text-size-sm">恭喜!本团已满员,拼团圆满成团啦~</view>
|
||||
<view class="team-success-tags flex-row jc-c flex-wrap">
|
||||
<text class="team-success-tag">满员成团</text>
|
||||
<text class="team-success-tag">{{ groupbuy.group_number }}人团</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="team-status-fail tc">
|
||||
<view class="team-fail-icon-wrap">
|
||||
<iconfont name="icon-sigh" size="48rpx" color="#999999"></iconfont>
|
||||
</view>
|
||||
<view class="fw-b text-size-lg cr-red">拼团失败</view>
|
||||
<view class="cr-grey text-size-xs margin-top-sm">很遗憾,本次拼团未成团</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="team-members flex-row flex-wrap jc-c margin-top-main">
|
||||
<view v-for="(item, index) in members" :key="'m-' + index" class="member-item tc">
|
||||
<image :src="item.avatar" mode="aspectFill" class="member-avatar radius"></image>
|
||||
<view v-if="item.is_team_leader == 1" class="leader-badge bg-main cr-white text-size-xss radius padding-horizontal-xs">团长</view>
|
||||
<view class="text-size-xs cr-grey margin-top-xs single-text">{{ item.user_name_view }}</view>
|
||||
</view>
|
||||
<view v-for="(item, index) in empty_slots" :key="'e-' + index" class="member-item tc">
|
||||
<view class="member-avatar member-empty bg-grey-f5 cr-grey-c radius">?</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="team.status == 0" class="margin-top-main">
|
||||
<button v-if="user == null" class="btn round bg-main cr-white text-size-md wh-auto" type="default" @tap="login_event" hover-class="none">登录后参团</button>
|
||||
<block v-else>
|
||||
<button class="btn round bg-main cr-white text-size-md wh-auto margin-bottom-main" type="default" @tap="join_team_event" hover-class="none">立即参团</button>
|
||||
<button class="btn round bg-white br-main cr-main text-size-md wh-auto" type="default" open-type="share" hover-class="none">邀请好友参团</button>
|
||||
<view v-if="is_leader" class="tc margin-top-main">
|
||||
<text class="cr-grey text-size-xs" @tap="team_cancel_event">取消开团</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<component-groupbuy-play-rules :propConfig="groupbuy_config" :propPlayCurrentStep="play_current_step" :propPlaySideNav="play_side_nav"></component-groupbuy-play-rules>
|
||||
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentGroupbuyPlayRules from '../components/groupbuy-play-rules/groupbuy-play-rules';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
params: {},
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
team: {},
|
||||
groupbuy: {},
|
||||
goods: {},
|
||||
members: [],
|
||||
empty_slots: [],
|
||||
groupbuy_config: {},
|
||||
play_side_nav: [],
|
||||
user: null,
|
||||
is_leader: false,
|
||||
play_current_step: 2,
|
||||
countdown_text: '',
|
||||
countdown_timer: null,
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGroupbuyPlayRules,
|
||||
},
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 参数处理
|
||||
params = app.globalData.launch_params_handle(params || {});
|
||||
this.setData({
|
||||
params: params || {},
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 页面卸载
|
||||
onUnload() {
|
||||
clearInterval(this.countdown_timer);
|
||||
},
|
||||
|
||||
// 分享
|
||||
onShareAppMessage() {
|
||||
return this.share_info || {};
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('team', 'index', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: { id: this.params.id || 0 },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
var result = res.data.data;
|
||||
var team = result.team || {};
|
||||
var user = result.user || null;
|
||||
var is_leader = user != null && team.leader_user_id == user.id;
|
||||
this.setData({
|
||||
team: team,
|
||||
groupbuy: result.groupbuy || {},
|
||||
goods: result.goods || {},
|
||||
members: result.members || [],
|
||||
empty_slots: result.empty_slots || [],
|
||||
groupbuy_config: result.groupbuy_config || {},
|
||||
play_side_nav: result.play_side_nav || [],
|
||||
user: user,
|
||||
is_leader: is_leader,
|
||||
play_current_step: result.play_current_step || 2,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
share_info: {
|
||||
title: (result.groupbuy || {}).title || '邀请你参团',
|
||||
path: team.share_url || ('/pages/plugins/groupbuy/team/team?id=' + team.id),
|
||||
imageUrl: (result.goods || {}).images || '',
|
||||
},
|
||||
});
|
||||
this.countdown_init(team.expire_time || 0);
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 倒计时初始化
|
||||
countdown_init(expire_time) {
|
||||
clearInterval(this.countdown_timer);
|
||||
if (expire_time <= 0) {
|
||||
return false;
|
||||
}
|
||||
var update = () => {
|
||||
var left = parseInt(expire_time) - parseInt(Date.now() / 1000);
|
||||
if (left <= 0) {
|
||||
this.setData({ countdown_text: '00:00:00' });
|
||||
clearInterval(this.countdown_timer);
|
||||
return false;
|
||||
}
|
||||
var h = String(Math.floor(left / 3600)).padStart(2, '0');
|
||||
var m = String(Math.floor((left % 3600) / 60)).padStart(2, '0');
|
||||
var s = String(left % 60).padStart(2, '0');
|
||||
this.setData({ countdown_text: h + ':' + m + ':' + s });
|
||||
};
|
||||
update();
|
||||
this.countdown_timer = setInterval(update, 1000);
|
||||
},
|
||||
|
||||
// 登录
|
||||
login_event() {
|
||||
app.globalData.url_open('/pages/login/login?event_callback=groupbuy_team');
|
||||
},
|
||||
|
||||
// 立即参团
|
||||
join_team_event() {
|
||||
app.globalData.url_open('/pages/plugins/groupbuy/detail/detail?id=' + this.groupbuy.id + '&team_id=' + this.team.id);
|
||||
},
|
||||
|
||||
// 取消开团
|
||||
team_cancel_event() {
|
||||
uni.showModal({
|
||||
title: this.$t('common.warm_tips'),
|
||||
content: '确定要取消当前拼团吗?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
uni.showLoading({ title: this.$t('common.processing_in_text') });
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('teamcancel', 'index', 'groupbuy'),
|
||||
method: 'POST',
|
||||
data: { team_id: this.team.id },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
this.get_data();
|
||||
} else {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 链接事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './team.css';
|
||||
</style>
|
||||
@ -70,7 +70,8 @@
|
||||
(item.plugins_delivery_data || 0) +
|
||||
(item.plugins_ordergoodsform_data || 0) +
|
||||
(item.plugins_orderresources_data || 0) +
|
||||
(item.plugins_is_orderfeed_button || 0)
|
||||
(item.plugins_is_orderfeed_button || 0) +
|
||||
(item.plugins_is_groupbuy_team_button || 0)
|
||||
> 0 ) ||
|
||||
(item.status == 2 && item.order_model != 2) ||
|
||||
((item.plugins_express_data || 0) == 1 && (item.express_data || null) != null) ||
|
||||
@ -91,6 +92,7 @@
|
||||
<button v-if="(item.plugins_ordergoodsform_data || 0) == 1" class="round bg-white cr-blue br-blue margin-bottom-main" type="default" size="mini" @tap="url_event" :data-value="'/pages/plugins/ordergoodsform/order/order?id=' + item.id" hover-class="none">{{$t('user-order.user-order.9l47b6')}}</button>
|
||||
<button v-if="(item.plugins_orderresources_data || 0) == 1" class="round bg-white cr-blue br-blue margin-bottom-main" type="default" size="mini" @tap="url_event" :data-value="'/pages/plugins/orderresources/orderannex/orderannex?oid=' + item.id" hover-class="none">{{$t('user-order.user-order.fyuikn')}}</button>
|
||||
<button v-if="(item.plugins_is_orderfeed_button || 0) == 1" class="round bg-white cr-blue br-blue margin-bottom-main" type="default" size="mini" @tap="url_event" :data-value="'/pages/plugins/orderfeed/form/form?oid=' + item.id" hover-class="none">{{$t('common.feed_text')}}</button>
|
||||
<button v-if="(item.plugins_is_groupbuy_team_button || 0) == 1" class="round bg-white cr-main br-main margin-bottom-main" type="default" size="mini" @tap="url_event" :data-value="item.plugins_groupbuy_team_url" hover-class="none">{{$t('pages.plugins-groupbuy-team')}}</button>
|
||||
<button v-if="(item.plugins_intellectstools_data || null) != null && (item.plugins_intellectstools_data.continue_buy_data || null) != null && item.plugins_intellectstools_data.continue_buy_data.length > 0" class="round bg-white cr-base br-base margin-bottom-main" type="default" size="mini" :data-index="index" @tap="continue_buy_event" hover-class="none">{{$t('user-order.user-order.3l2jr5')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user