小程序支持主题管理
883
sourcecode/qq/default/app.js
Executable file
@ -0,0 +1,883 @@
|
||||
App({
|
||||
data: {
|
||||
// uuid缓存key
|
||||
cache_user_uuid_key: "cache_user_uuid_key",
|
||||
|
||||
// 配置信息缓存key
|
||||
cache_config_info_key: "cache_config_info_key",
|
||||
|
||||
// 用户登录缓存key
|
||||
cache_user_login_key: "cache_user_login_key",
|
||||
|
||||
// 用户信息缓存key
|
||||
cache_user_info_key: "cache_shop_user_info_key",
|
||||
|
||||
// 用户站点信息缓存key
|
||||
cache_user_merchant_key: "cache_shop_user_merchant_key",
|
||||
|
||||
// 设备信息缓存key
|
||||
cache_system_info_key: "cache_shop_system_info_key",
|
||||
|
||||
// 用户地址选择缓存key
|
||||
cache_buy_user_address_select_key: "cache_buy_user_address_select_key",
|
||||
|
||||
// 启动参数缓存key
|
||||
cache_launch_info_key: "cache_shop_launch_info_key",
|
||||
|
||||
// 获取位置选择缓存key
|
||||
cache_userlocation_key: "cache_userlocation_key",
|
||||
|
||||
// 默认用户头像
|
||||
default_user_head_src: "/images/default-user.png",
|
||||
|
||||
// 成功圆形提示图片
|
||||
default_round_success_icon: "/images/default-round-success-icon.png",
|
||||
|
||||
// 错误圆形提示图片
|
||||
default_round_error_icon: "/images/default-round-error-icon.png",
|
||||
|
||||
// tabbar页面
|
||||
tabbar_pages: [
|
||||
"/pages/index/index",
|
||||
"/pages/goods-category/goods-category",
|
||||
"/pages/cart/cart",
|
||||
"/pages/user/user",
|
||||
],
|
||||
|
||||
// 页面标题
|
||||
common_pages_title: {
|
||||
"goods_search": "商品搜索",
|
||||
"goods_detail": "商品详情",
|
||||
"user_address": "我的地址",
|
||||
"user_address_save_add": "添加地址",
|
||||
"user_address_save_edit": "编辑地址",
|
||||
"buy": "订单确认",
|
||||
"user_order": "我的订单",
|
||||
"user_order_detail": "订单详情",
|
||||
"user_favor": "我的收藏",
|
||||
"answer_form": "留言",
|
||||
"answer_list": "问答",
|
||||
"user_answer_list": "我的留言",
|
||||
"user": "用户中心",
|
||||
"goods_category": "分类",
|
||||
"cart": "购物车",
|
||||
"message": "消息",
|
||||
"user_integral": "我的积分",
|
||||
"user_goods_browse": "我的足迹",
|
||||
"goods_comment": "商品评论",
|
||||
"user_orderaftersale": "退款/售后",
|
||||
"user_orderaftersale_detail": "订单售后",
|
||||
"user_order_comments": "订单评论",
|
||||
"extraction_address": "自提地址",
|
||||
},
|
||||
|
||||
// 请求地址
|
||||
request_url: "{{request_url}}",
|
||||
// request_url: 'http://shopxo.com/',
|
||||
// request_url: 'https://dev.shopxo.net/',
|
||||
|
||||
// 基础信息
|
||||
application_title: "{{application_title}}",
|
||||
application_describe: "{{application_describe}}",
|
||||
|
||||
// 货币价格符号
|
||||
currency_symbol: "{{currency_symbol}}"
|
||||
},
|
||||
|
||||
/**
|
||||
* 小程序初始化
|
||||
*/
|
||||
onLaunch(params) {
|
||||
// 启动参数处理
|
||||
params = this.launch_params_handle(params);
|
||||
|
||||
// 设置设备信息
|
||||
this.set_system_info();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
/**
|
||||
* 启动参数处理
|
||||
*/
|
||||
launch_params_handle(params) {
|
||||
// 启动参数处理
|
||||
if ((params.query || null) != null) {
|
||||
params = params.query;
|
||||
}
|
||||
if ((params.scene || null) != null) {
|
||||
params = this.url_params_to_json(decodeURIComponent(params.scene));
|
||||
}
|
||||
// 缓存启动参数
|
||||
qq.setStorage({
|
||||
key: this.data.cache_launch_info_key,
|
||||
data: params
|
||||
});
|
||||
|
||||
return params;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
*/
|
||||
get_system_info() {
|
||||
let system_info = qq.getStorageSync(this.data.cache_system_info_key) || null;
|
||||
if (system_info == null) {
|
||||
return this.set_system_info();
|
||||
}
|
||||
return system_info;
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置设备信息
|
||||
*/
|
||||
set_system_info() {
|
||||
var system_info = qq.getSystemInfoSync();
|
||||
qq.setStorage({
|
||||
key: this.data.cache_system_info_key,
|
||||
data: system_info
|
||||
});
|
||||
return system_info;
|
||||
},
|
||||
|
||||
/**
|
||||
* 请求地址生成
|
||||
* a 方法
|
||||
* c 控制器
|
||||
* plugins 插件标记(传参则表示为插件请求)
|
||||
* params url请求参数
|
||||
*/
|
||||
get_request_url(a, c, plugins, params) {
|
||||
a = a || "index";
|
||||
c = c || "index";
|
||||
|
||||
// 是否插件请求
|
||||
var plugins_params = "";
|
||||
if ((plugins || null) != null)
|
||||
{
|
||||
plugins_params = "&pluginsname=" + plugins + "&pluginscontrol=" + c + "&pluginsaction=" + a;
|
||||
|
||||
// 走api统一插件调用控制器
|
||||
c = "plugins"
|
||||
a = "index"
|
||||
}
|
||||
|
||||
// 参数处理
|
||||
params = params || "";
|
||||
if (params != "" && params.substr(0, 1) != "&") {
|
||||
params = "&" + params;
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
var user = this.get_user_cache_info();
|
||||
var token = (user == false) ? '' : user.token || '';
|
||||
var uuid = this.request_uuid();
|
||||
return this.data.request_url +
|
||||
"index.php?s=/api/" + c + "/" + a + plugins_params+
|
||||
"&application=app&application_client_type=qq" +
|
||||
"&token=" + token +
|
||||
"&ajax=ajax" +
|
||||
"&uuid="+ uuid +
|
||||
params;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户信息,信息不存在则唤醒授权
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
* return 有用户数据直接返回, 则回调调用者
|
||||
*/
|
||||
get_user_info(object, method) {
|
||||
var user = this.get_user_cache_info();
|
||||
if (user == false) {
|
||||
// 唤醒用户授权
|
||||
this.user_login(object, method);
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return user;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 从缓存获取用户信息
|
||||
*/
|
||||
get_user_cache_info() {
|
||||
let user = qq.getStorageSync(this.data.cache_user_info_key) || null;
|
||||
if (user == null) {
|
||||
return false;
|
||||
}
|
||||
return user;
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
* auth_data 授权数据
|
||||
*/
|
||||
user_auth_login(object, method, auth_data) {
|
||||
var self = this;
|
||||
qq.checkSession({
|
||||
success: function () {
|
||||
var openid = qq.getStorageSync(self.data.cache_user_login_key) || null;
|
||||
if (openid == null)
|
||||
{
|
||||
self.user_login(object, method);
|
||||
} else {
|
||||
self.get_user_login_info(object, method, openid, auth_data);
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
self.user_login(object, method);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
*/
|
||||
user_login(object, method) {
|
||||
var openid = qq.getStorageSync(this.data.cache_user_login_key) || null;
|
||||
if (openid == null)
|
||||
{
|
||||
var self = this;
|
||||
qq.showLoading({ title: "授权中..." });
|
||||
qq.login({
|
||||
success: (res) => {
|
||||
if (res.code) {
|
||||
qq.request({
|
||||
url: self.get_request_url('qquserauth', 'user'),
|
||||
method: 'POST',
|
||||
data: { authcode: res.code },
|
||||
dataType: 'json',
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
success: (res) => {
|
||||
qq.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if ((data.is_user_exist || 0) == 1) {
|
||||
qq.setStorage({
|
||||
key: self.data.cache_user_info_key,
|
||||
data: data,
|
||||
success: (res) => {
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method]();
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
self.showToast('用户信息缓存失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
qq.setStorage({
|
||||
key: self.data.cache_user_login_key,
|
||||
data: data.openid
|
||||
});
|
||||
self.login_to_auth();
|
||||
}
|
||||
} else {
|
||||
self.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.hideLoading();
|
||||
self.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (e) => {
|
||||
qq.hideLoading();
|
||||
self.showToast('授权失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.login_to_auth();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转到登录页面授权
|
||||
*/
|
||||
login_to_auth() {
|
||||
qq.showModal({
|
||||
title: '温馨提示',
|
||||
content: '授权用户信息',
|
||||
confirmText: '确认',
|
||||
cancelText: '暂不',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
qq.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户授权信息
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
* openid 用户openid
|
||||
* auth_data 授权数据
|
||||
*/
|
||||
get_user_login_info(object, method, openid, auth_data) {
|
||||
// 邀请人参数
|
||||
var params = qq.getStorageSync(this.data.cache_launch_info_key) || null;
|
||||
var referrer = (params == null) ? 0 : (params.referrer || 0);
|
||||
|
||||
// 远程解密数据
|
||||
var self = this;
|
||||
qq.showLoading({ title: "授权中..." });
|
||||
qq.request({
|
||||
url: self.get_request_url('qquserinfo', 'user'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
"encrypted_data": auth_data.encryptedData,
|
||||
"iv": auth_data.iv,
|
||||
"openid": openid,
|
||||
"referrer": referrer
|
||||
},
|
||||
dataType: 'json',
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
success: (res) => {
|
||||
qq.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
qq.setStorage({
|
||||
key: self.data.cache_user_info_key,
|
||||
data: res.data.data,
|
||||
success: (res) => {
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method]();
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
self.showToast('用户信息缓存失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.hideLoading();
|
||||
self.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 字段数据校验
|
||||
* data 待校验的数据, 一维json对象
|
||||
* validation 待校验的字段, 格式 [{fields: 'mobile', msg: '请填写手机号码', is_can_zero: 1(是否可以为0)}, ...]
|
||||
*/
|
||||
fields_check(data, validation) {
|
||||
for (var i in validation) {
|
||||
var temp_value = data[validation[i]["fields"]];
|
||||
var temp_is_can_zero = validation[i]["is_can_zero"] || null;
|
||||
|
||||
if ((temp_value == undefined || temp_value.length == 0 || temp_value == -1) || (temp_is_can_zero == null && temp_value == 0)
|
||||
) {
|
||||
this.showToast(validation[i]['msg']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前时间戳
|
||||
*/
|
||||
get_timestamp() {
|
||||
return parseInt(new Date().getTime() / 1000);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日期
|
||||
* format 日期格式(默认 yyyy-MM-dd h:m:s)
|
||||
* timestamp 时间戳(默认当前时间戳)
|
||||
*/
|
||||
get_date(format, timestamp) {
|
||||
var d = new Date((timestamp || this.get_timestamp()) * 1000);
|
||||
var date = {
|
||||
"M+": d.getMonth() + 1,
|
||||
"d+": d.getDate(),
|
||||
"h+": d.getHours(),
|
||||
"m+": d.getMinutes(),
|
||||
"s+": d.getSeconds(),
|
||||
"q+": Math.floor((d.getMonth() + 3) / 3),
|
||||
"S+": d.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/i.test(format)) {
|
||||
format = format.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (var k in date) {
|
||||
if (new RegExp("(" + k + ")").test(format)) {
|
||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
|
||||
}
|
||||
}
|
||||
return format;
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取对象、数组的长度、元素个数
|
||||
* obj 要计算长度的元素(object、array、string)
|
||||
*/
|
||||
get_length(obj) {
|
||||
var obj_type = typeof obj;
|
||||
if (obj_type == "string") {
|
||||
return obj.length;
|
||||
} else if (obj_type == "object") {
|
||||
var obj_len = 0;
|
||||
for (var i in obj) {
|
||||
obj_len++;
|
||||
}
|
||||
return obj_len;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 价格保留两位小数
|
||||
* price 价格保留两位小数
|
||||
*/
|
||||
price_two_decimal(x) {
|
||||
var f_x = parseFloat(x);
|
||||
if (isNaN(f_x)) {
|
||||
return 0;
|
||||
}
|
||||
var f_x = Math.round(x * 100) / 100;
|
||||
var s_x = f_x.toString();
|
||||
var pos_decimal = s_x.indexOf('.');
|
||||
if (pos_decimal < 0) {
|
||||
pos_decimal = s_x.length;
|
||||
s_x += '.';
|
||||
}
|
||||
while (s_x.length <= pos_decimal + 2) {
|
||||
s_x += '0';
|
||||
}
|
||||
return s_x;
|
||||
},
|
||||
|
||||
/**
|
||||
* 当前地址是否存在tabbar中
|
||||
*/
|
||||
is_tabbar_pages(url) {
|
||||
if (url.indexOf("?") == -1)
|
||||
{
|
||||
var value = url;
|
||||
} else {
|
||||
var temp_str = url.split("?");
|
||||
var value = temp_str[0];
|
||||
}
|
||||
if ((value || null) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var temp_tabbar_pages = this.data.tabbar_pages;
|
||||
for (var i in temp_tabbar_pages)
|
||||
{
|
||||
if (temp_tabbar_pages[i] == value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 事件操作
|
||||
*/
|
||||
operation_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
var type = parseInt(e.currentTarget.dataset.type);
|
||||
if (value != null) {
|
||||
switch (type) {
|
||||
// web
|
||||
case 0:
|
||||
qq.navigateTo({ url: '/pages/web-view/web-view?url=' + encodeURIComponent(value) });
|
||||
break;
|
||||
|
||||
// 内部页面
|
||||
case 1:
|
||||
if (this.is_tabbar_pages(value))
|
||||
{
|
||||
qq.switchTab({ url: value });
|
||||
} else {
|
||||
qq.navigateTo({ url: value });
|
||||
}
|
||||
break;
|
||||
|
||||
// 跳转到外部小程序
|
||||
case 2:
|
||||
qq.navigateToMiniProgram({ appId: value });
|
||||
break;
|
||||
|
||||
// 跳转到地图查看位置
|
||||
case 3:
|
||||
var values = value.split('|');
|
||||
if (values.length != 4) {
|
||||
this.showToast('事件值格式有误');
|
||||
return false;
|
||||
}
|
||||
|
||||
this.open_location(values[2], values[3], values[0], values[1]);
|
||||
break;
|
||||
|
||||
// 拨打电话
|
||||
case 4:
|
||||
this.call_tel(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 默认弱提示方法
|
||||
* msg [string] 提示信息
|
||||
* status [string] 状态 默认error [正确success, 错误error]
|
||||
*/
|
||||
showToast(msg, status)
|
||||
{
|
||||
if ((status || 'error') == 'success')
|
||||
{
|
||||
qq.showToast({
|
||||
title: msg,
|
||||
duration: 3000
|
||||
});
|
||||
} else {
|
||||
qq.showToast({
|
||||
image: '/images/default-toast-error.png',
|
||||
title: msg,
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* alert确认框
|
||||
* title [string] 标题(默认空)
|
||||
* msg [string] 提示信息,必传
|
||||
* is_show_cancel [int] 是否显示取消按钮(默认显示 0否, 1|undefined是)
|
||||
* cancel_text [string] 取消按钮文字(默认 取消)
|
||||
* cancel_color [string] 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000)
|
||||
* confirm_text [string] 确认按钮文字(默认 确认)
|
||||
* confirm_color [string] 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000)
|
||||
* object [boject] 回调操作对象,点击确认回调参数1,取消回调0
|
||||
* method [string] 回调操作对象的函数
|
||||
*/
|
||||
alert(e)
|
||||
{
|
||||
var msg = e.msg || null;
|
||||
if (msg != null)
|
||||
{
|
||||
var title = e.title || '';
|
||||
var is_show_cancel = (e.is_show_cancel == 0) ? false : true;
|
||||
var cancel_text = e.cancel_text || '取消';
|
||||
var confirm_text = e.confirm_text || '确认';
|
||||
var cancel_color = e.cancel_color || '#000000';
|
||||
var confirm_color = e.confirm_color || '#576B95';
|
||||
|
||||
qq.showModal({
|
||||
title: title,
|
||||
content: msg,
|
||||
showCancel: is_show_cancel,
|
||||
cancelText: cancel_text,
|
||||
cancelColor: cancel_color,
|
||||
confirmText: confirm_text,
|
||||
confirmColor: confirm_color,
|
||||
success(res) {
|
||||
if ((e.object || null) != null && typeof e.object === 'object' && (e.method || null) != null) {
|
||||
e.object[e.method](res.confirm ? 1 : 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.showToast('提示信息为空 alert');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否需要登录
|
||||
* 是否需要绑定手机号码
|
||||
*/
|
||||
user_is_need_login(user) {
|
||||
// 用户信息是否正确
|
||||
if (user == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 是否需要绑定手机号码
|
||||
if ((user.is_mandatory_bind_mobile || 0) == 1)
|
||||
{
|
||||
if ((user.mobile || null) == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* url参数转json对象
|
||||
*/
|
||||
url_params_to_json(url_params) {
|
||||
var json = new Object();
|
||||
if ((url_params || null) != null)
|
||||
{
|
||||
var arr = url_params.split('&');
|
||||
for(var i = 0; i<arr.length; i++) {
|
||||
var temp = arr[i].split('=');
|
||||
json[temp[0]] = temp[1]
|
||||
}
|
||||
}
|
||||
return json;
|
||||
},
|
||||
|
||||
// 拨打电话
|
||||
call_tel(value) {
|
||||
if ((value || null) != null) {
|
||||
qq.makePhoneCall({ phoneNumber: value });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 登录校验
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
*/
|
||||
is_login_check(res, object, method) {
|
||||
if(res.code == -400)
|
||||
{
|
||||
qq.clearStorage();
|
||||
this.get_user_info(object, method);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置导航reddot
|
||||
* index tabBar 的哪一项,从左边算起(0开始)
|
||||
* type 0 移出, 1 添加 (默认 0 移出)
|
||||
*/
|
||||
set_tab_bar_reddot(index, type) {
|
||||
if (index !== undefined && index !== null)
|
||||
{
|
||||
if ((type || 0) == 0)
|
||||
{
|
||||
qq.hideTabBarRedDot({ index: Number(index) });
|
||||
} else {
|
||||
qq.showTabBarRedDot({ index: Number(index) });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置导航车badge
|
||||
* index tabBar 的哪一项,从左边算起(0开始)
|
||||
* type 0 移出, 1 添加 (默认 0 移出)
|
||||
* value 显示的文本,超过 4 个字符则显示成 ...(type参数为1的情况下有效)
|
||||
*/
|
||||
set_tab_bar_badge(index, type, value) {
|
||||
if (index !== undefined && index !== null)
|
||||
{
|
||||
if ((type || 0) == 0) {
|
||||
qq.removeTabBarBadge({ index: Number(index) });
|
||||
} else {
|
||||
qq.setTabBarBadge({ index: Number(index), "text": value.toString() });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取配置信息、可指定默认值
|
||||
* key 数据key(支持多级读取、以 . 分割key名称)
|
||||
* default_value 默认值
|
||||
*/
|
||||
get_config(key, default_value) {
|
||||
var value = null;
|
||||
var config = qq.getStorageSync(this.data.cache_config_info_key) || null;
|
||||
if(config != null)
|
||||
{
|
||||
// 数据读取
|
||||
var arr = key.split('.');
|
||||
if(arr.length == 1)
|
||||
{
|
||||
value = config[key] == undefined ? null : config[key];
|
||||
} else {
|
||||
value = config;
|
||||
for(var i in arr)
|
||||
{
|
||||
if(value[arr[i]] != undefined)
|
||||
{
|
||||
value = value[arr[i]];
|
||||
} else {
|
||||
value = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (value === null) ? ((default_value === undefined) ? value : default_value) : value;
|
||||
},
|
||||
|
||||
// 初始化 配置信息
|
||||
init_config() {
|
||||
var self = this;
|
||||
qq.request({
|
||||
url: this.get_request_url('common', 'base'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
qq.setStorage({
|
||||
key: this.data.cache_config_info_key,
|
||||
data: res.data.data,
|
||||
fail: () => {
|
||||
this.showToast('配置信息缓存失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 配置是否有效(100毫秒检验一次、最多检验100次)
|
||||
* object 回调操作对象
|
||||
* method 回调操作对象的函数
|
||||
*/
|
||||
is_config(object, method) {
|
||||
var self = this;
|
||||
var count = 0;
|
||||
var timer = setInterval(function()
|
||||
{
|
||||
if(self.get_config('status') == 1)
|
||||
{
|
||||
clearInterval(timer);
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method](true);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
if(count >= 100)
|
||||
{
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
|
||||
/**
|
||||
* 火星坐标GCJ02到百度坐标BD-09(高德,谷歌,腾讯坐标 -> 百度)
|
||||
* lng 经度
|
||||
* lat 纬度
|
||||
*/
|
||||
map_gcj_to_bd(lng, lat) {
|
||||
lng = parseFloat(lng);
|
||||
lat = parseFloat(lat);
|
||||
let x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
let x = lng;
|
||||
let y = lat;
|
||||
let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
|
||||
let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
|
||||
let lngs = z * Math.cos(theta) + 0.0065;
|
||||
let lats = z * Math.sin(theta) + 0.006;
|
||||
return {
|
||||
lng: lngs,
|
||||
lat: lats
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 百度坐标BD-09到火星坐标GCJ02(百度 -> 高德,谷歌,腾讯坐标)
|
||||
* lng 经度
|
||||
* lat 纬度
|
||||
*/
|
||||
map_bd_to_gcj(lng, lat) {
|
||||
lng = parseFloat(lng);
|
||||
lat = parseFloat(lat);
|
||||
let x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
let x = lng - 0.0065;
|
||||
let y = lat - 0.006;
|
||||
let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
|
||||
let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
|
||||
let lngs = z * Math.cos(theta);
|
||||
let lats = z * Math.sin(theta);
|
||||
return {
|
||||
lng: lngs,
|
||||
lat: lats
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 百度坐标BD-09到火星坐标GCJ02(高德,谷歌,腾讯坐标)
|
||||
* lng 经度
|
||||
* lat 纬度
|
||||
* name 地图上面显示的名称
|
||||
* address 地图上面显示的详细地址
|
||||
* scale 缩放比例,范围5~18
|
||||
*/
|
||||
open_location(lng, lat, name, address, scale) {
|
||||
if(lng == undefined || lat == undefined || lng == '' || lat == '') {
|
||||
this.showToast('坐标有误');
|
||||
return false;
|
||||
}
|
||||
if((address || null) == null) {
|
||||
this.showToast('地址有误');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 转换坐标打开位置
|
||||
var position = this.map_bd_to_gcj(lng, lat);
|
||||
qq.openLocation({
|
||||
name: name || '当前位置',
|
||||
address: address || '',
|
||||
scale: scale || 18,
|
||||
longitude: position.lng,
|
||||
latitude: position.lat
|
||||
});
|
||||
},
|
||||
|
||||
// uuid生成
|
||||
uuid() {
|
||||
var d = new Date().getTime();
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
},
|
||||
|
||||
// 获取当前uuid
|
||||
request_uuid() {
|
||||
var uuid = qq.getStorageSync(this.data.cache_user_uuid_key) || null;
|
||||
if(uuid == null) {
|
||||
uuid = this.uuid();
|
||||
qq.setStorage({
|
||||
key: this.data.cache_user_uuid_key,
|
||||
data: uuid,
|
||||
fail: () => {
|
||||
this.showToast('uuid缓存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
return uuid;
|
||||
},
|
||||
|
||||
});
|
||||
87
sourcecode/qq/default/app.json
Executable file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/goods-category/goods-category",
|
||||
"pages/cart/cart",
|
||||
"pages/user/user",
|
||||
"pages/web-view/web-view",
|
||||
"pages/login/login",
|
||||
"pages/paytips/paytips",
|
||||
"pages/goods-search/goods-search",
|
||||
"pages/goods-detail/goods-detail",
|
||||
"pages/goods-comment/goods-comment",
|
||||
"pages/buy/buy",
|
||||
"pages/user-address/user-address",
|
||||
"pages/user-address-save/user-address-save",
|
||||
"pages/user-order/user-order",
|
||||
"pages/user-order-detail/user-order-detail",
|
||||
"pages/user-order-comments/user-order-comments",
|
||||
"pages/user-faovr/user-faovr",
|
||||
"pages/user-answer-list/user-answer-list",
|
||||
"pages/answer-list/answer-list",
|
||||
"pages/answer-form/answer-form",
|
||||
"pages/message/message",
|
||||
"pages/user-integral/user-integral",
|
||||
"pages/user-goods-browse/user-goods-browse",
|
||||
"pages/user-orderaftersale/user-orderaftersale",
|
||||
"pages/user-orderaftersale-detail/user-orderaftersale-detail",
|
||||
"pages/extraction-address/extraction-address",
|
||||
"pages/common/open-setting-location/open-setting-location",
|
||||
"pages/plugins/coupon/index/index",
|
||||
"pages/plugins/coupon/user/user",
|
||||
"pages/plugins/wallet/user/user",
|
||||
"pages/plugins/wallet/recharge/recharge",
|
||||
"pages/plugins/wallet/cash-auth/cash-auth",
|
||||
"pages/plugins/wallet/cash-create/cash-create",
|
||||
"pages/plugins/wallet/wallet-log/wallet-log",
|
||||
"pages/plugins/wallet/wallet-log-detail/wallet-log-detail",
|
||||
"pages/plugins/wallet/user-recharge/user-recharge",
|
||||
"pages/plugins/wallet/user-recharge-detail/user-recharge-detail",
|
||||
"pages/plugins/wallet/user-cash/user-cash",
|
||||
"pages/plugins/wallet/user-cash-detail/user-cash-detail",
|
||||
"pages/plugins/excellentbuyreturntocash/profit/profit",
|
||||
"pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail",
|
||||
"pages/plugins/exchangerate/currency/currency"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
"navigationBarBackgroundColor": "#d2364c"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#8a8a8a",
|
||||
"selectedColor": "#d2364c",
|
||||
"backgroundColor": "#fff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "/images/nav-icon-home.png",
|
||||
"selectedIconPath": "/images/nav-icon-home-active.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/goods-category/goods-category",
|
||||
"iconPath": "/images/nav-icon-category.png",
|
||||
"selectedIconPath": "/images/nav-icon-category-active.png",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/cart/cart",
|
||||
"iconPath": "/images/nav-icon-cart.png",
|
||||
"selectedIconPath": "/images/nav-icon-cart-active.png",
|
||||
"text": "购物车"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/user",
|
||||
"iconPath": "/images/nav-icon-user.png",
|
||||
"selectedIconPath": "/images/nav-icon-user-active.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkTimeout": {
|
||||
"request": 10000,
|
||||
"downloadFile": 10000
|
||||
},
|
||||
"plugins": {},
|
||||
"debug": true
|
||||
}
|
||||
481
sourcecode/qq/default/app.qss
Executable file
@ -0,0 +1,481 @@
|
||||
/* 框架样式覆盖 */
|
||||
.a-textarea-control textarea {
|
||||
font-size: 12px;
|
||||
}
|
||||
button:after, button:before {
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* 公共样式 */
|
||||
page {
|
||||
background: #f5f5f5;
|
||||
color: #4a4a4a;
|
||||
}
|
||||
page, textarea {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"],
|
||||
input[type="idcard"],
|
||||
input[type="digit"],
|
||||
textarea {
|
||||
-webkit-appearance: none;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 导航分割 */
|
||||
.spacing-nav-title {
|
||||
position: relative;
|
||||
color: #d2364c;
|
||||
text-align: center;
|
||||
background-color: #ffffff;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.spacing-nav-title .line {
|
||||
display: inline-block;
|
||||
width: 80%;
|
||||
height: 1px;
|
||||
background: #d2364c;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
||||
.spacing-nav-title .text-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
background-color: #ffffff;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 模块分割间距 */
|
||||
.spacing { padding-top: 20rpx; }
|
||||
.spacing-10 { padding-top: 10rpx; }
|
||||
.spacing-mb { margin-bottom: 20rpx; }
|
||||
.spacing-mt { margin-top: 20rpx; }
|
||||
|
||||
.drift { position: fixed; left: -1000px; }
|
||||
.nav-submit-fixed { background: #eee; height: 46px; position: fixed; bottom: 0; z-index: 10; }
|
||||
|
||||
.tips { background: #ffffeb url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAKN0lEQVR4Xu1beZAcZRX/vZ7NTn9DWJAjQKIYpKRSoqJCuHJMLwkQNjvdJEoIIMHSotRgIaIErJICpDwoCBYUFKApwYgp2Jhjejabg4Tt3oTEKkhREg4NxVUqQjgEEqZ7j+ln9exOT3dPz/bsJrs7hPSf813v/b7fe+/73vuG8Cn/6FOuPw4BcIgBY4xAT3vz6QXHuVCSSE+2Gs+PtjhjZgLcdknClvc8DNCVRaWZ90oSnZnMGP8YTRDGBADOnTfJdpxlIMwJKMv8R6GZ3zuoAchnm6eBHJ1AR4UVZWY9pZnaQQuAnW2ey3BWgkhEKcngXEo11YMOAGZIVk65npjvAJFUTcFaGWDpM08CS0tAfCKDbk+pxt+GC9qI+wBrjTKZE/w4gc6sEJJ5N4hOKf1eKwMsXdkMYNbAuD4Gfp5SjbuGA8KIAtCdS89zHFoOwvgIe19JxDcC0qseADX6AEtXXgIwxT8nA+0i2biQLtz08VCAGBEAuO3URit57FIi/KhSGGaAbhaq8SveMOMEuyfxZpkBaE+pRiZOASurfBvEywEKyM/ATlHAbJpnfBA3R6n9gAPQT3msJeC0CMq7sX5RMmOsLYb+EABgrBOa0VqL8PZaZbYj8QoCHRsKpS/Khd5mmr99Ty3zHFAAijsDPBBFeTDvArEm1K7XvB0fJgO88euU4+0CVgKYHlSWd8gZczoRnDgQagKAOxXZ3oezq01GjPHMfAOIZlYJb/eKhtQSalnfHbDb/WCAB0LHRUm711oFwlz/3MR8p6yZS4YMgKU3pxl8TySF42YLtTP4HYlpkawZGyKBCQMA7hCqGVCkliW5U2mwPuJVRBQ4QxCxKmfM3GBzVDDAyirbQJhWy8KD9+FNMtEVlDHerdZvf3xARVTpVBrsvbwRoPN8UWWPSI07hc7f/GFV9oYbLF15HcDnhwuAu+tEuFFkzIfj5uB+G/5vuR+vF6rZEh5nr5t+CrGUSLZ2ueGv6scbLzjMsru3EtHXvU7My4VmXjXiADD4aQm0Iml3P0QLdlhxyrvtFQAwNgjNuMg/Np9VVhLhW2B2QLhZqOavB5u7O6dMcRw8D0LCY4LkTEu1dm2PGldpAkEG9MncexRpT+2tRaGh9oljAK9RjrQT+J9/XmZeI5rocmo27Grr2dn0Uia63gMAyKZU4+IhA8DMe1KaedxQFau1fxwD+u8Q6Xcqb468Q7Z7ZlVjGncq4+2P+E0QHd4vi3v44pP9Ibgk46AMYODtlGocX6tCQ+0XAcBGoRmBHEE+lz4HDv5KRBMDTHCPvhlDJQJHrWvpym8A3OSxgPmBlGYuDvetLwDAm4RqXhgWknOnpyw+fDkB3/S3EfNiWTMfiAKAs7OOs6nwbwANRQ6A3xf2hAm0YGUhMEd4sD8KjDgD+oV8q+yxUcGA8g5CsvT0mkCsZ+yTC4nJNH/Le1Eg5HUlR0D5aE00W2Q6t9QvAFUY4IHgOkWJnwPR58pK8C+Fat5SxQy+A8Afjh8SqvGDegbgCaGaFwzmS2xdaWXAO931U/vdE2jBCz0VptNxVpPdK94vhUQGP5dSzcAlbWx9QKUJbBaacX6cM7V0xU2fn+p5cnLmypmujkgWZNMvgOhLA8HAkSftk+mMnb31EQXCAIBjGeAKbuvK9xl40KfwMqEaV0ebQXoFQJeV2hLsfKNR63q2PgFg1MSA4gFJ4vd8+cUXhGp8ORKAnHITGG5IHCABLktpxmP1AcDqcyfYDY1v+wTfIlRjdpwJuO1WmNrjUqnwdbu/n3IVCI94CodC59j6gAoA+EmhmqVk56A4WHp6HUDli1NCmizmPvlGeFC33qw54GIGauD7hZuO++QzQFdcGl/q2TbR1xoznX8PA2DlFAWMTp/Cd8mqcUOdAlA7A/LZdNZ/KCKmKbLW+c8wAHZWmcOE9d7vjNuEZtxaHwB0zDjW7kuUk5fMnUIzvYTGYDaQzypPE+GMUh+5oTCBWra+Ex6T19OXEWhFWWH+saya936iAeBnTh9n/2f8xyAa1+/a8aHQjCOjALP19GIG3V9u40VCNf/8iQbA1mdewJA2+mhd9Q6R15XfEXCd15cwQ2SMbfUJAGAI1WiOC4NWNv0nEC0qhzZcJ2vGPVHjLF1xHaDimQrtPYwyO/P1CoApVMMTNkohzk6baNM4N9wVr7nFr0oIdJvyevp9An1mwFReF5pxkn/esT0HhJ0gEAtAXlfWEOBLb3GbUE0vHPqV61nbfFZBYq9yzMwrU5q5oH4AyCnH2Iyy52buEpqZrmYCVjZ9NYh+77P9gsSFryYv3vpitANU7mTgZ6U2JixMZYzH6xmArUIzI6tLtp6+iEFrACTLtl+9+uPmE+1c+jWATuynP/fK3T1HhPOIY2sCNTDALct1f8S3FXfS/7iCeZcs7Tvb79D8O2tllStAeNTbfebVKc0MpNTctvoCANgmVGOGJ7RbZpeP2UagqSGKvyFz4izStvgvUmXLcHdfV3aDcLL3I6FZZAwjbCoxdQHOC9U8rJpN7u/vvHrW0XZDoVw6YzwlNMOr9ObbZ55LjvSUfx1mflYUeucMVv62dMV9abbMN+55oRpfiZI3rjDijnkEjIpbVlXliV+RM+ZfailNxwHAbkqrT/4XQE39Zoz7xaS9P/FndMJyuLkCS8JrRPBOhgzn0pTa1TZcAIaz0SYS0lVR19PAblYwgLcLzQwUZvMdymepD7dKhPbSw4rBBLKyyqMgXOGzh12yap5WrX4QwYD0boC+OBytQ2O6GbglpRp3VJurkgGVAAxFDjunXMOM+/xjEoypjZrxTLV5KgDIZ5X7iHDNUBYevC+3ycnkd6MeL8WZwFBksHLKdDgw/EVR1w9UyxWW5q4AwL1p9bzZ1OIwl0vMNUrChIujH1bwy5LEWri8zRVhMOgEa1wWVnt6Bhxy7/w+h80vycnk1LhXYzU9kalVEGaQlVN+SozfhnbCdWF5CdLlSbUz64W5ypxgIAzWsq6dm9nCLK32H5AYeAsNmJpqMdzS2KDfAQWgtJJLR3awlghHB1d3q7S4vVTJGajflUtjoXPAYJIPlM7dx5GBx9XM+KAhQbMbWzt3xinvto8IAO7E7nM5SLzR/xK07JnxmNyEK5HHMYEXIsxVj8J+ZdzzARxpFQGByrVbzk9IlB7Kk/sRA8AVmJ+YfYSd73schIqKL8DrielaJrzsC1k1AWDpyi4AoToAv4oCzRLzDPeJT83fiAJQBKHtkoQl77mbQNdWSMV4JXBcjbkNeiamh0I1Y53chIXUbOyrWfOBjiMOQEkgO5v+IRPuDz9vDQhcIwDFAinzUoAmMuG24T6UHlEfELUTxSIFO20gaqyyU7EJkaHucFz/UWNAIEIwu/8Y6U9TBb+DHwBXX7t9+he4kFhfGSGin8jE7eL+tI86A0rCFiOE1dfuf+gsEc9PZkw36zNq35gB0B8hzhF2MvkHECYx4cFwvm40UBhTAEZDwbg1DgEQh9DB3v5/c3FujBE8RpQAAAAASUVORK5CYII=') no-repeat 5rpx 12rpx; background-size: 35rpx 35rpx; color: #f7b240; border: 1px solid #faebd2; line-height: 38rpx; padding: 10rpx 10rpx 10rpx 45rpx; font-size: 26rpx; border-radius: 2px; display: block; }
|
||||
|
||||
.data-loding image { width: 60px; height: 60px; background-size: 80% 80% !important; }
|
||||
|
||||
|
||||
/* 边框 */
|
||||
.br { border: solid 1px #efefef; }
|
||||
.br-b { border-bottom: solid 1px #efefef; }
|
||||
.br-t { border-top: solid 1px #efefef; }
|
||||
.br-l { border-left: solid 1px #efefef; }
|
||||
.br-r { border-right: solid 1px #efefef; }
|
||||
|
||||
/* 虚线边框 */
|
||||
.br-dashed { border: dashed 1px #efefef; }
|
||||
.br-b-dashed { border-bottom: dashed 1px #efefef; }
|
||||
.br-t-dashed { border-top: dashed 1px #efefef; }
|
||||
.br-l-dashed { border-left: dashed 1px #efefef; }
|
||||
.br-r-dashed { border-right: dashed 1px #efefef; }
|
||||
|
||||
/* 箭头符号 */
|
||||
.arrow-right { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA+klEQVRYR+3WsWrDMBAG4P/eotCQLlk73UGfq6O3BgLNEsg7JQQPZ7ADfos8gAeBijYTAsnpREJBXmX0f/7RCRNe/NCL81EBtYH/1YCq/gK4iMiu1PSYGlDVloi+AOyZ+bsEwgQYx/FtmqYDgFUphAmQvniOiDFuRaTxNGEGlEZkAWaIFsCHp4lsQEIMw7AIIRw9CBfgGgFgzcw/ljPhBtxoohGR7aOIIoC+799DCCciWsYYnwvwhKeWXA14w12AEuHZgFLhWYCS4WbAPDxn5m+NpukQquqZiD49V+81wgToum6TfkiYef/oRXPvPRPg3mY56xVQG6gN/AEiuagh/yEjYQAAAABJRU5ErkJggg=='); background-size: 18px 18px; background-repeat: no-repeat; background-position: center right; }
|
||||
|
||||
|
||||
/* 常用样式 */
|
||||
.fl { float: left; }
|
||||
.fr { float: right; }
|
||||
.bg-white { background-color: #fff; }
|
||||
.wh-auto { width: 100%; }
|
||||
.ht-auto { height: 100%; }
|
||||
.tc { text-align: center; }
|
||||
.tl { text-align: left; }
|
||||
.tr { text-align: right; }
|
||||
.oh { overflow: hidden; }
|
||||
.dis-none { display: none; }
|
||||
.dis-block { display: block; }
|
||||
|
||||
.cr-main { color: #d2364c; }
|
||||
.cr-666 { color: #666; }
|
||||
.cr-888 { color: #888; }
|
||||
.cr-ccc { color: #ccc; }
|
||||
.cr-fff { color: #fff; }
|
||||
|
||||
.my-btn-default{
|
||||
font-size: 38rpx;
|
||||
color: #fff !important;
|
||||
border: none !important;
|
||||
background-color:#d2364c !important;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.my-btn-default.btn-disabled{
|
||||
background-color: #a6a6a6 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
.my-btn-gray{
|
||||
font-size: 30rpx;
|
||||
color: #fff !important;
|
||||
border: none !important;
|
||||
background-color:#a6a6a6 !important;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* 文字超出部分使用省略号 */
|
||||
.single-text {
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
.multi-text {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
|
||||
/* 没有数据状态/处理错误/加载中 */
|
||||
.no-data-box {
|
||||
padding: 80rpx 0;
|
||||
}
|
||||
.no-data-box image {
|
||||
width: 160rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.no-data-box .no-data-tips {
|
||||
font-size: 28rpx;
|
||||
color: #a6a6a6;
|
||||
}
|
||||
.no-data-loding {
|
||||
padding-top: 15%;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 底线 */
|
||||
.data-bottom-line{
|
||||
padding: 40rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.data-bottom-line view {
|
||||
width: 33.3%;
|
||||
}
|
||||
.data-bottom-line .left, .data-bottom-line .right{
|
||||
margin-top: 8px;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
}
|
||||
.data-bottom-line .msg{
|
||||
color: #999;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/* 业务公共 */
|
||||
.copyright {
|
||||
color: #a5a5a5;
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.copyright .text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.sales-price {
|
||||
color: #f40;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.original-price {
|
||||
color: #888;
|
||||
font-size: 26rpx;
|
||||
text-decoration: line-through;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.submit-fixed {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: #d2364c !important;
|
||||
color: #fff !important;
|
||||
border: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bg-main, .bg-primary, .bg-warning {
|
||||
color: #fff !important;
|
||||
border: 0;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.bg-main {
|
||||
background-color: #d2364c !important;
|
||||
}
|
||||
.bg-primary {
|
||||
background-color: #ed6977 !important;
|
||||
}
|
||||
.bg-warning {
|
||||
background-color: #F37B1D !important;
|
||||
}
|
||||
.bg-active-main {
|
||||
background-color: #d2364c !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.submit-bottom {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 0;
|
||||
}
|
||||
button[disabled].bg-main {
|
||||
background-color: #fbe0e5 !important;
|
||||
color: #f7b6c2 !important;
|
||||
}
|
||||
button[disabled].bg-warning {
|
||||
background-color: #ffcda6 !important;
|
||||
color: #fdae70 !important;
|
||||
}
|
||||
button[disabled].bg-primary {
|
||||
background-color: #ffd2d7 !important;
|
||||
color: #ffa0ab !important;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 10%;
|
||||
}
|
||||
|
||||
/*
|
||||
滚动标签高度
|
||||
*/
|
||||
.scroll-box {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/*
|
||||
分享组建样式
|
||||
*/
|
||||
.share-popup {
|
||||
padding: 20rpx 10rpx 0 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.share-popup .close {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.share-popup-content {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 40rpx;
|
||||
text-align: left;
|
||||
}
|
||||
.share-popup-content .share-items {
|
||||
padding: 30rpx 0;
|
||||
height: 85rpx;
|
||||
}
|
||||
.share-popup-content .share-items:not(:first-child) {
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
.share-popup-content .share-items button {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin: 0;
|
||||
}
|
||||
.share-popup-content .share-items image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.share-popup-content .share-items .single-text {
|
||||
width: calc(100% - 100rpx);
|
||||
line-height: 85rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷导航
|
||||
*/
|
||||
.common-quick-nav {
|
||||
border: 0;
|
||||
padding: 15rpx;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
right: 10rpx;
|
||||
border-radius: 50%;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
.common-quick-nav image {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在线客服
|
||||
*/
|
||||
.common-online-service {
|
||||
bottom: 35%;
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单
|
||||
*/
|
||||
.form-container .form-gorup {
|
||||
padding: 20rpx 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.form-container .form-gorup-title {
|
||||
margin-bottom: 5rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.form-container .form-group-tips,
|
||||
.form-container .form-group-tips-must {
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
.form-container .form-group-tips-must {
|
||||
color: #f00;
|
||||
}
|
||||
.form-container .form-gorup input,
|
||||
.form-container .form-gorup textarea,
|
||||
.form-container .form-gorup .picker {
|
||||
border-radius: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.form-container .form-gorup input,
|
||||
.form-container .form-gorup .picker {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
.form-container .form-gorup textarea {
|
||||
padding: 0;
|
||||
min-height: 70rpx;
|
||||
}
|
||||
.form-container .form-gorup-text {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.form-container .form-gorup .switch {
|
||||
margin: 30rpx 0 20rpx 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单图片上传
|
||||
*/
|
||||
.form-container-upload .form-upload-data .item {
|
||||
padding: 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
.form-container-upload .form-upload-data .delete-icon {
|
||||
position: absolute;
|
||||
top: 15rpx;
|
||||
right: 15rpx;
|
||||
color: #e5e5e5;
|
||||
background-color: #d9534f;
|
||||
padding: 5rpx 18rpx;
|
||||
font-size: 30rpx;
|
||||
border-style: solid;
|
||||
border-width: 0 0 1px 1px;
|
||||
border-color: #eee;
|
||||
}
|
||||
.form-container-upload .form-upload-data image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
padding: 5rpx;
|
||||
border: 1px solid #eee;
|
||||
display: block;
|
||||
}
|
||||
.form-container-upload .upload-icon {
|
||||
margin: 10rpx 0 0 10rpx;
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border: 1px dashed #e9e9e9;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 优惠劵 - 插件
|
||||
*/
|
||||
.coupon-container {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.coupon-container .item {
|
||||
overflow: hidden;
|
||||
height: 180rpx;
|
||||
border: 1px solid #D2364C;
|
||||
}
|
||||
.coupon-container .v-left {
|
||||
width: calc(100% - 140rpx);
|
||||
padding: 30rpx 0 30rpx 20rpx;
|
||||
box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
-webkit-box-sizing:border-box;
|
||||
}
|
||||
.coupon-container .v-left .base {
|
||||
color: #D2364C;
|
||||
}
|
||||
.coupon-container .v-left .base .symbol {
|
||||
font-family: Verdana, Tahoma;
|
||||
font-weight: 700;
|
||||
}
|
||||
.coupon-container .v-left .base .price {
|
||||
font-weight: 700;
|
||||
font-family: arial;
|
||||
font-size: 76rpx;
|
||||
}
|
||||
.coupon-container .v-left .base .desc {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.coupon-container .v-left base-tips, .coupon-container .v-left .base-time {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.coupon-container .v-right {
|
||||
background: #d2364c;
|
||||
width: 140rpx;
|
||||
height: 180rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
.coupon-container .v-right:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.coupon-container .v-right .circle {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -1px;
|
||||
top: -3px;
|
||||
width: 3px;
|
||||
height: 180rpx;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAACpCAYAAADur4c3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3NpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3MjUzYzIwOS04ZWNlLTRlNTctODQ4OC01ZDExOTkwOGNkYmMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTM1QzgxREZGRDI5MTFFNTg3QjhGRUQ1MDY5OURERUQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTM1QzgxREVGRDI5MTFFNTg3QjhGRUQ1MDY5OURERUQiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NTJiNzVkOGUtZDc2Yi00MzEzLWFmNmYtYTJkNTRlYTI4YTY1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjcyNTNjMjA5LThlY2UtNGU1Ny04NDg4LTVkMTE5OTA4Y2RiYyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pvy+vnQAAAEqSURBVHjaYvz//z8DDDAxIAFyOVeBOAHEYfyPMDsLmXMfmfMT2YADDP8h4CEQq4A4aUDMA1LNSKZDXwJxGcg1yJaWIXOeInO+IxuwA+acK0AsA+IEADEbic7hhPOAer4DcQcQMyNb2oLMeYVsADcyZwPMObuBWBTEsQFpI9E54sjO+QvEc0F+YoHKJgHxJ2TnvEM2gBmZswrmnA1AzAXiaJPhHC1k58BNQ3bBTGTOR2QD/iJzFsH8Mw/kHxBHggzn2KA7BxzWyC5Yisz5imwACmc2LLY7QbEN4nCS4ZwAIGZFds5lUEpEdsF6nKn3PTJnAsiAV0BcBsSM5GamFCDmQXYOOJ8iu2Anzrz9HKU8ABlwDYgTKcnbo0XNaFEzWtQgipqOYVLUAAQYAKPWa4c8cIHnAAAAAElFTkSuQmCC) no-repeat;
|
||||
}
|
||||
.coupon-container .item-disabled .v-right {
|
||||
background: #dfdfdf !important;
|
||||
color: #c0c0c0 !important;
|
||||
cursor: no-drop !important;
|
||||
}
|
||||
.coupon-container .item-disabled {
|
||||
border: 1px solid #dfdfdf !important;
|
||||
}
|
||||
23
sourcecode/qq/default/components/badge/badge.js
Executable file
@ -0,0 +1,23 @@
|
||||
// components/badge.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
propNumber: Number,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
4
sourcecode/qq/default/components/badge/badge.json
Executable file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
5
sourcecode/qq/default/components/badge/badge.qml
Executable file
@ -0,0 +1,5 @@
|
||||
<view qq:if="{{propNumber > 0}}" class="am-badge">
|
||||
<view class="am-badge-text {{(propNumber > 99) ? 'am-badge-text-max' : ''}}">
|
||||
<text>{{(propNumber > 99) ? '99+' : propNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
26
sourcecode/qq/default/components/badge/badge.qss
Executable file
@ -0,0 +1,26 @@
|
||||
.am-badge {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.am-badge-text {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
transform: translate(50%, -50%);
|
||||
top: 0px;
|
||||
min-width: 16px;
|
||||
padding: 0;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
background-color: #FF3B30;
|
||||
border-radius: 16px;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
padding: 1px 1px;
|
||||
}
|
||||
.am-badge-text-max {
|
||||
padding: 1px 2px;
|
||||
}
|
||||
12
sourcecode/qq/default/components/icon-nav/icon-nav.js
Executable file
@ -0,0 +1,12 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
data: {},
|
||||
properties: {
|
||||
propData: Array
|
||||
},
|
||||
methods: {
|
||||
navigation_event(e) {
|
||||
app.operation_event(e);
|
||||
},
|
||||
},
|
||||
});
|
||||
3
sourcecode/qq/default/components/icon-nav/icon-nav.json
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
10
sourcecode/qq/default/components/icon-nav/icon-nav.qml
Executable file
@ -0,0 +1,10 @@
|
||||
<view qq:if="{{propData.length > 0}}">
|
||||
<view class="data-list">
|
||||
<view class="items" qq:for="{{propData}}" qq:key="key">
|
||||
<view class="items-content" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="navigation_event" style="background-color:{{item.bg_color}}">
|
||||
<image src="{{item.images_url}}" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="title">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
33
sourcecode/qq/default/components/icon-nav/icon-nav.qss
Executable file
@ -0,0 +1,33 @@
|
||||
.data-list {
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.data-list .items {
|
||||
width: calc(25% - 60rpx);
|
||||
float: left;
|
||||
padding: 30rpx;
|
||||
}
|
||||
.items-content {
|
||||
border-radius: 50%;
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 60rpx !important;
|
||||
height: 60rpx !important;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
.data-list .items .title {
|
||||
margin-top: 10rpx;
|
||||
font-size: 32rpx;
|
||||
text-align:center;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
30
sourcecode/qq/default/components/popup/popup.js
Executable file
@ -0,0 +1,30 @@
|
||||
// components/popup.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
propClassname: String,
|
||||
propShow: Boolean,
|
||||
propPosition: String,
|
||||
propMask: Boolean,
|
||||
propAnimation: Boolean,
|
||||
propDisablescroll: Boolean
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onMaskTap: function onMaskTap() {
|
||||
this.triggerEvent('onclose', {}, {});
|
||||
}
|
||||
}
|
||||
})
|
||||
4
sourcecode/qq/default/components/popup/popup.json
Executable file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
6
sourcecode/qq/default/components/popup/popup.qml
Executable file
@ -0,0 +1,6 @@
|
||||
<view class="am-popup {{propClassname || ''}} {{(propShow || false) ? 'am-popup-show' : ''}} {{ (propAnimation || true) ? 'animation': '' }}" disable-scroll="{{propDisablescroll}}">
|
||||
<view class="am-popup-mask" qq:if="{{propMask || true}}" bindtap="onMaskTap"></view>
|
||||
<view class="am-popup-content am-popup-{{propPosition || 'bottom'}}">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
60
sourcecode/qq/default/components/popup/popup.qss
Executable file
@ -0,0 +1,60 @@
|
||||
.am-popup-content {
|
||||
position: fixed;
|
||||
background:#fff;
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
.am-popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.am-popup-left {
|
||||
transform: translateX(-100%);
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.am-popup-right {
|
||||
transform: translateX(100%);
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.am-popup-top {
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
.am-popup-bottom {
|
||||
bottom: 0;
|
||||
width: 100vw;
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
.am-popup-show .am-popup-content {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.am-popup-show .am-popup-mask {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.am-popup.animation .am-popup-content {
|
||||
transition: all 0.15s linear;
|
||||
}
|
||||
|
||||
.am-popup.animation .am-popup-mask {
|
||||
transition: all 0.15s linear;
|
||||
}
|
||||
56
sourcecode/qq/default/components/quick-nav/quick-nav.js
Normal file
@ -0,0 +1,56 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
data: {
|
||||
popup_status: false,
|
||||
data_list: [],
|
||||
system: null,
|
||||
x: 0,
|
||||
y: 0,
|
||||
is_first: 1,
|
||||
},
|
||||
pageLifetimes: {
|
||||
// 页面被展示
|
||||
show: function() {
|
||||
this.init_config();
|
||||
|
||||
// 非首次进入则重新初始化配置接口
|
||||
if(this.data.is_first == 0) {
|
||||
app.init_config();
|
||||
}
|
||||
|
||||
// 数据设置
|
||||
var system = app.get_system_info();
|
||||
this.setData({
|
||||
is_first: 0,
|
||||
system: system,
|
||||
x: 5,
|
||||
y: (system.windowHeight || 450)-160,
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if((status || false) == true) {
|
||||
this.setData({ data_list: app.get_config('quick_nav') || [] });
|
||||
} else {
|
||||
app.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 弹层开启
|
||||
quick_open_event(e) {
|
||||
this.setData({popup_status: true, data_list: app.get_config('quick_nav') || []});
|
||||
},
|
||||
|
||||
// 弹层关闭
|
||||
quick_close_event(e) {
|
||||
this.setData({ popup_status: false });
|
||||
},
|
||||
|
||||
// 操作事件
|
||||
navigation_event(e) {
|
||||
app.operation_event(e);
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"component-popup": "/components/popup/popup"
|
||||
}
|
||||
}
|
||||
31
sourcecode/qq/default/components/quick-nav/quick-nav.qml
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- 开启事件 -->
|
||||
<movable-area class="quick-nav-movable-container">
|
||||
<movable-view direction="all" x="{{x}}" y="{{y}}" animation="{{false}}" class="quick-nav-event-submit" bindtap="quick_open_event">
|
||||
<image src="/images/quick-submit-icon.png" mode="widthFix"></image>
|
||||
</movable-view>
|
||||
</movable-area>
|
||||
|
||||
<!-- 弹窗 -->
|
||||
<component-popup prop-show="{{popup_status}}" prop-position="bottom" bindonclose="quick_close_event">
|
||||
<view class="quick-nav-popup-container">
|
||||
<view class="close oh">
|
||||
<view class="icon-right" catchtap="quick_close_event">
|
||||
<icon type="clear" size="20" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="quick-nav-popup-content">
|
||||
<view qq:if="{{data_list.length > 0}}" class="quick-nav-data-list">
|
||||
<view class="items" qq:for="{{data_list}}" qq:key="key">
|
||||
<view class="items-content" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="navigation_event" style="background-color:{{item.bg_color}}">
|
||||
<image src="{{item.images_url}}" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="title">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view qq:else>
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: 0}}"></template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</component-popup>
|
||||
101
sourcecode/qq/default/components/quick-nav/quick-nav.qss
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
.quick-nav-movable-container {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 150rpx;
|
||||
left: 0;
|
||||
background:transparent;
|
||||
pointer-events: none;
|
||||
z-index: 2;
|
||||
}
|
||||
.quick-nav-event-submit {
|
||||
pointer-events: auto;
|
||||
position: fixed;
|
||||
bottom: 150rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
background-color: rgb(210 54 76 / 80%);
|
||||
}
|
||||
.quick-nav-event-submit image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin: 25rpx auto 25rpx auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗
|
||||
*/
|
||||
.quick-nav-popup-container {
|
||||
padding: 20rpx 10rpx 0 10rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.quick-nav-popup-container .close {
|
||||
overflow: hidden;
|
||||
}
|
||||
.quick-nav-popup-container .close .icon-right {
|
||||
float: right;
|
||||
}
|
||||
.quick-nav-popup-content {
|
||||
max-height: 80vh;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
.quick-nav-data-list {
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
.quick-nav-data-list .items {
|
||||
width: calc(25% - 60rpx);
|
||||
float: left;
|
||||
padding: 30rpx;
|
||||
}
|
||||
.quick-nav-data-list .items-content {
|
||||
border-radius: 50%;
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.quick-nav-data-list .items image {
|
||||
width: 60rpx !important;
|
||||
height: 60rpx !important;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
.quick-nav-data-list .items .title {
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx !important;
|
||||
text-align:center;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/*
|
||||
* 没有数据
|
||||
*/
|
||||
.quick-nav-popup-container .no-data-box {
|
||||
padding: 80rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
.quick-nav-popup-container .no-data-box image {
|
||||
width: 160rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.quick-nav-popup-container .no-data-box .no-data-tips {
|
||||
font-size: 28rpx;
|
||||
color: #a6a6a6;
|
||||
}
|
||||
18
sourcecode/qq/default/components/slider/slider.js
Executable file
@ -0,0 +1,18 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
data: {
|
||||
indicator_dots: false,
|
||||
indicator_color: 'rgba(0, 0, 0, .3)',
|
||||
indicator_active_color: '#e31c55',
|
||||
autoplay: true,
|
||||
circular: true,
|
||||
},
|
||||
properties: {
|
||||
propData: Array
|
||||
},
|
||||
methods: {
|
||||
banner_event(e) {
|
||||
app.operation_event(e);
|
||||
},
|
||||
},
|
||||
});
|
||||
3
sourcecode/qq/default/components/slider/slider.json
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
14
sourcecode/qq/default/components/slider/slider.qml
Executable file
@ -0,0 +1,14 @@
|
||||
<swiper
|
||||
indicator-dots="{{propData.length > 0}}"
|
||||
indicator-color="{{indicator_color}}"
|
||||
indicator-active-color="{{indicator_active_color}}"
|
||||
autoplay="{{propData.length > 0}}"
|
||||
circular="{{circular}}"
|
||||
class="banner"
|
||||
qq:if="{{propData.length > 0}}">
|
||||
<block qq:for="{{propData}}" qq:key="key">
|
||||
<swiper-item>
|
||||
<image src="{{item.images_url}}" mode="widthFix" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="banner_event" />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
10
sourcecode/qq/default/components/slider/slider.qss
Executable file
@ -0,0 +1,10 @@
|
||||
.banner {
|
||||
background: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.banner image {
|
||||
min-width: 100%;
|
||||
}
|
||||
.banner, .banner image {
|
||||
height: 320rpx !important;
|
||||
}
|
||||
6
sourcecode/qq/default/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name":"默认主题",
|
||||
"ver":"1.9.1",
|
||||
"author":"Devil",
|
||||
"home":"https://shopxo.net/"
|
||||
}
|
||||
BIN
sourcecode/qq/default/images/buy-address-divider.png
Executable file
|
After Width: | Height: | Size: 203 B |
BIN
sourcecode/qq/default/images/default-bg-loding.gif
Normal file
|
After Width: | Height: | Size: 378 KiB |
BIN
sourcecode/qq/default/images/default-cart-empty.png
Executable file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
sourcecode/qq/default/images/default-cart-icon.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
sourcecode/qq/default/images/default-idcard-back.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
sourcecode/qq/default/images/default-idcard-front.jpg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
sourcecode/qq/default/images/default-round-error-icon.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
sourcecode/qq/default/images/default-round-success-icon.png
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
sourcecode/qq/default/images/default-select-active-icon.png
Executable file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
sourcecode/qq/default/images/default-select-disabled-icon.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
sourcecode/qq/default/images/default-select-icon.png
Executable file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
sourcecode/qq/default/images/default-toast-error.png
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
sourcecode/qq/default/images/default-upload-icon.png
Normal file
|
After Width: | Height: | Size: 822 B |
BIN
sourcecode/qq/default/images/default-user.png
Executable file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
sourcecode/qq/default/images/default-xingxing-icon-active.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
sourcecode/qq/default/images/default-xingxing-icon.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
sourcecode/qq/default/images/empty.png
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
sourcecode/qq/default/images/error.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
sourcecode/qq/default/images/goods-detail-favor-icon-0.png
Executable file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
sourcecode/qq/default/images/goods-detail-favor-icon-1.png
Executable file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
sourcecode/qq/default/images/goods-detail-home-icon.png
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
sourcecode/qq/default/images/goods-detail-share-icon.png
Executable file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
sourcecode/qq/default/images/goods-detail-shop-icon.png
Executable file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
sourcecode/qq/default/images/goods-detail-video-close.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
sourcecode/qq/default/images/goods-detail-video-play.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
sourcecode/qq/default/images/home-consulting-image.jpg
Executable file
|
After Width: | Height: | Size: 66 KiB |
BIN
sourcecode/qq/default/images/limitedtimediscount-nav-icon.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
sourcecode/qq/default/images/nav-icon-cart-active.png
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
sourcecode/qq/default/images/nav-icon-cart.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
sourcecode/qq/default/images/nav-icon-category-active.png
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
sourcecode/qq/default/images/nav-icon-category.png
Executable file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
sourcecode/qq/default/images/nav-icon-home-active.png
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
sourcecode/qq/default/images/nav-icon-home.png
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
sourcecode/qq/default/images/nav-icon-user-active.png
Executable file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
sourcecode/qq/default/images/nav-icon-user.png
Executable file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
sourcecode/qq/default/images/online-service-icon.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
BIN
sourcecode/qq/default/images/preview.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
sourcecode/qq/default/images/quick-submit-icon.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
sourcecode/qq/default/images/search-asc-icon.png
Executable file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
sourcecode/qq/default/images/search-default-icon.png
Executable file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
sourcecode/qq/default/images/search-desc-icon.png
Executable file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
sourcecode/qq/default/images/search-submit-icon.png
Executable file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
sourcecode/qq/default/images/share-friend-icon.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
sourcecode/qq/default/images/share-recomend-icon.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
sourcecode/qq/default/images/share-weixin-icon.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
sourcecode/qq/default/images/tips.png
Executable file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
sourcecode/qq/default/images/upload.png
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
sourcecode/qq/default/images/user-address.png
Executable file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
sourcecode/qq/default/images/user-head-message-icon.png
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
sourcecode/qq/default/images/user-index-nav-order-icon-1.png
Executable file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
sourcecode/qq/default/images/user-index-nav-order-icon-101.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
sourcecode/qq/default/images/user-index-nav-order-icon-2.png
Executable file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
sourcecode/qq/default/images/user-index-nav-order-icon-3.png
Executable file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
sourcecode/qq/default/images/user-index-nav-order-icon-4.png
Executable file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
sourcecode/qq/default/images/user-nav-cache-icon.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
sourcecode/qq/default/images/user-nav-customer-service-icon.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
90
sourcecode/qq/default/pages/answer-form/answer-form.js
Executable file
@ -0,0 +1,90 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '处理错误',
|
||||
form_submit_loading: false,
|
||||
},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
qq.setNavigationBarTitle({title: app.data.common_pages_title.answer_form});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.get_user_info(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
qq.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// 开启表单
|
||||
this.setData({data_list_loding_status: 0});
|
||||
} else {
|
||||
// 提示错误
|
||||
this.setData({data_list_loding_status: 2, data_list_loding_msg: '用户未登录'});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
formSubmit(e)
|
||||
{
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{fields: 'name', msg: '请填写联系人'},
|
||||
{fields: 'tel', msg: '请填写联系电话'},
|
||||
{fields: 'content', msg: '请填写内容'}
|
||||
];
|
||||
if(app.fields_check(e.detail.value, validation))
|
||||
{
|
||||
qq.showLoading({title: '提交中...'});
|
||||
this.setData({form_submit_loading: true});
|
||||
|
||||
// 网络请求
|
||||
qq.request({
|
||||
url: app.get_request_url('add', 'answer'),
|
||||
method: 'POST',
|
||||
data: e.detail.value,
|
||||
dataType: 'json',
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
success: (res) => {
|
||||
qq.hideLoading();
|
||||
|
||||
if(res.data.code == 0)
|
||||
{
|
||||
app.showToast(res.data.msg, "success");
|
||||
setTimeout(function()
|
||||
{
|
||||
qq.redirectTo({
|
||||
url: "/pages/user-answer-list/user-answer-list"
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
this.setData({form_submit_loading: false});
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.hideLoading();
|
||||
this.setData({form_submit_loading: false});
|
||||
|
||||
app.showToast('服务器请求出错');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
3
sourcecode/qq/default/pages/answer-form/answer-form.json
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
20
sourcecode/qq/default/pages/answer-form/answer-form.qml
Executable file
@ -0,0 +1,20 @@
|
||||
<form bindsubmit="formSubmit" qq:if="{{data_list_loding_status == 0}}">
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<input type="text" class="wh-auto" name="name" placeholder="联系人" maxlength="30" />
|
||||
</view>
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<input type="number" class="wh-auto" name="tel" placeholder="联系电话" maxlength="15" />
|
||||
</view>
|
||||
<view class="form-input bg-white spacing-mb">
|
||||
<textarea name="content" class="content-textarea" maxlength="160" placeholder="请详细描述问题,我们将尽快为您解答!" />
|
||||
</view>
|
||||
|
||||
<view class="bottom-btn-box fixed">
|
||||
<button type="default" formType="submit" class="my-btn-default" hover-class="none" bindtap="submit_event" loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}">提交</button>
|
||||
</view>
|
||||
</form>
|
||||
|
||||
<view qq:if="{{data_list_loding_status != 0}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
21
sourcecode/qq/default/pages/answer-form/answer-form.qss
Executable file
@ -0,0 +1,21 @@
|
||||
.content{
|
||||
padding: 10rpx;
|
||||
}
|
||||
.content-textarea {
|
||||
padding-top: 10rpx;
|
||||
min-height: 20vh;
|
||||
}
|
||||
.bottom-btn-box {
|
||||
margin-top: 160rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.form-input input, .form-input textarea {
|
||||
font-size: 30rpx;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
119
sourcecode/qq/default/pages/answer-list/answer-list.js
Executable file
@ -0,0 +1,119 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
qq.setNavigationBarTitle({title: app.data.common_pages_title.answer_list});
|
||||
},
|
||||
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
qq.request({
|
||||
url: app.get_request_url("common", "answer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page
|
||||
},
|
||||
dataType: "json",
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
success: res => {
|
||||
qq.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({ data_page: 1 });
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_data_list = this.data_list;
|
||||
for(var i in temp_data_list)
|
||||
{
|
||||
if(i == index)
|
||||
{
|
||||
temp_data_list[i]['avatar'] = app.data.default_user_head_src
|
||||
}
|
||||
}
|
||||
this.setData({data_list: temp_data_list});
|
||||
},
|
||||
|
||||
});
|
||||
3
sourcecode/qq/default/pages/answer-list/answer-list.json
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
22
sourcecode/qq/default/pages/answer-list/answer-list.qml
Executable file
@ -0,0 +1,22 @@
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view class="item bg-white spacing-mb" qq:if="{{data_list.length > 0}}" qq:for="{{data_list}}">
|
||||
<view class="base">
|
||||
<view class="oh">
|
||||
<image class="avatar fl" src="{{item.avatar}}" mode="widthFix" data-index="{{index}}" binderror="user_avatar_error" />
|
||||
<view class="desc fr tl">{{item.content}}</view>
|
||||
</view>
|
||||
<view class="cr-888 tr">{{item.add_time_time}}</view>
|
||||
</view>
|
||||
<view qq:if="{{(item.reply || null) != null}}" class="answer br-t">
|
||||
<text class="reply-icon bg-main cr-fff">答</text>
|
||||
<text class="reply-content cr-888">{{item.reply}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view qq:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.qml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</scroll-view>
|
||||
22
sourcecode/qq/default/pages/answer-list/answer-list.qss
Executable file
@ -0,0 +1,22 @@
|
||||
.item {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.item .base, .item .content, .item .answer {
|
||||
padding: 15rpx 0;
|
||||
}
|
||||
.item .base .desc {
|
||||
width: calc(100% - 130rpx);
|
||||
}
|
||||
.item .base .avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.item .answer .reply-icon {
|
||||
border-radius: 5px;
|
||||
padding: 0px 3px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.item .answer .reply-content, .item .base .desc {
|
||||
line-height: 42rpx;
|
||||
}
|
||||
386
sourcecode/qq/default/pages/buy/buy.js
Executable file
@ -0,0 +1,386 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
buy_submit_disabled_status: false,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
payment_list: [],
|
||||
goods_list: [],
|
||||
address: null,
|
||||
address_id: null,
|
||||
total_price: 0,
|
||||
user_note_value: '',
|
||||
user_note_status: false,
|
||||
is_first: 1,
|
||||
extension_data: [],
|
||||
payment_id: 0,
|
||||
common_site_type: 0,
|
||||
extraction_address: [],
|
||||
site_model: 0,
|
||||
buy_header_nav: [
|
||||
{ name: "快递邮寄", value: 0 },
|
||||
{ name: "自提点取货", value: 2 }
|
||||
],
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
common_order_is_booking: 0,
|
||||
|
||||
// 优惠劵
|
||||
plugins_coupon_data: null,
|
||||
plugins_use_coupon_ids: [],
|
||||
plugins_choice_coupon_value: [],
|
||||
popup_plugins_coupon_status: false,
|
||||
popup_plugins_coupon_index: null,
|
||||
},
|
||||
onLoad(params) {
|
||||
//params['data'] = '{"buy_type":"goods","goods_id":"1","stock":"1","spec":"[]"}';
|
||||
if((params.data || null) != null && app.get_length(JSON.parse(params.data)) > 0)
|
||||
{
|
||||
this.setData({ params: JSON.parse(params.data)});
|
||||
|
||||
// 删除地址缓存
|
||||
qq.removeStorageSync(app.data.cache_buy_user_address_select_key);
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
qq.setNavigationBarTitle({ title: app.data.common_pages_title.buy });
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
this.setData({ is_first: 0 });
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.get_config('currency_symbol'),
|
||||
common_order_is_booking: app.get_config('config.common_order_is_booking'),
|
||||
});
|
||||
} else {
|
||||
app.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init() {
|
||||
// 订单参数信息是否正确
|
||||
if (this.data.params == null) {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '订单信息有误',
|
||||
});
|
||||
qq.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 本地缓存地址
|
||||
if(this.data.is_first == 0)
|
||||
{
|
||||
var cache_address = qq.getStorageSync(app.data.cache_buy_user_address_select_key);
|
||||
if((cache_address || null) != null)
|
||||
{
|
||||
this.setData({
|
||||
address: cache_address,
|
||||
address_id: cache_address.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
qq.showLoading({title: '加载中...'});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
var data = this.data.params;
|
||||
data['address_id'] = this.data.address_id;
|
||||
data['payment_id'] = this.data.payment_id;
|
||||
data['site_model'] = this.data.site_model;
|
||||
qq.request({
|
||||
url: app.get_request_url("index", "buy"),
|
||||
method: "POST",
|
||||
data: this.request_data_coupon_merge(data),
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
qq.stopPullDownRefresh();
|
||||
qq.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if (data.goods_list.length == 0)
|
||||
{
|
||||
this.setData({data_list_loding_status: 0});
|
||||
} else {
|
||||
this.setData({
|
||||
goods_list: data.goods_list,
|
||||
total_price: data.base.actual_price,
|
||||
extension_data: data.extension_data || [],
|
||||
data_list_loding_status: 3,
|
||||
common_site_type: data.common_site_type || 0,
|
||||
extraction_address: data.base.extraction_address || [],
|
||||
plugins_coupon_data: data.plugins_coupon_data || null,
|
||||
});
|
||||
|
||||
// 优惠劵选择处理
|
||||
if ((data.plugins_coupon_data || null) != null)
|
||||
{
|
||||
var plugins_choice_coupon_value = [];
|
||||
for(var i in data.plugins_coupon_data)
|
||||
{
|
||||
var cupk = data.plugins_coupon_data[i]['warehouse_id'];
|
||||
if((data.plugins_coupon_data[i]['coupon_data']['coupon_choice'] || null) != null)
|
||||
{
|
||||
plugins_choice_coupon_value[cupk] = data.plugins_coupon_data[i]['coupon_data']['coupon_choice']['coupon']['desc'];
|
||||
} else {
|
||||
var coupon_count = (data.plugins_coupon_data[i]['coupon_data']['coupon_list'] || null) != null ? data.plugins_coupon_data[i]['coupon_data'].coupon_list.length : 0;
|
||||
plugins_choice_coupon_value[cupk] = (coupon_count > 0) ? '可选优惠劵' + coupon_count + '张' : '暂无可用优惠劵';
|
||||
}
|
||||
}
|
||||
this.setData({ plugins_choice_coupon_value: plugins_choice_coupon_value });
|
||||
}
|
||||
|
||||
// 地址
|
||||
this.setData({
|
||||
address: data.base.address || null,
|
||||
address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
|
||||
});
|
||||
qq.setStorage({
|
||||
key: app.data.cache_buy_user_address_select_key,
|
||||
data: data.base.address || null,
|
||||
});
|
||||
|
||||
// 支付方式
|
||||
this.payment_list_data(data.payment_list);
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.is_login_check(res.data, this, 'init')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.stopPullDownRefresh();
|
||||
qq.hideLoading();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 请求参数合并优惠券参数
|
||||
request_data_coupon_merge(data) {
|
||||
var coupon_ids = this.data.plugins_use_coupon_ids;
|
||||
if((coupon_ids || null) != null && coupon_ids.length > 0)
|
||||
{
|
||||
for(var i in coupon_ids)
|
||||
{
|
||||
data['coupon_id_'+i] = coupon_ids[i];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 用户留言输入事件
|
||||
bind_user_note_event(e) {
|
||||
this.setData({user_note_value: e.detail.value});
|
||||
},
|
||||
|
||||
// 用户留言点击
|
||||
bind_user_note_tap_event(e) {
|
||||
this.setData({user_note_status: true});
|
||||
},
|
||||
|
||||
// 用户留言失去焦点
|
||||
bind_user_note_blur_event(e) {
|
||||
this.setData({user_note_status: false});
|
||||
},
|
||||
|
||||
// 提交订单
|
||||
buy_submit_event(e) {
|
||||
// 表单数据
|
||||
var data = this.data.params;
|
||||
data['address_id'] = this.data.address_id;
|
||||
data['payment_id'] = this.data.payment_id;
|
||||
data['user_note'] = this.data.user_note_value;
|
||||
data['site_model'] = this.data.site_model;
|
||||
|
||||
// 数据验证
|
||||
var validation = [];
|
||||
if (this.data.common_site_type == 0 || this.data.common_site_type == 2 || this.data.common_site_type == 4)
|
||||
{
|
||||
validation.push({ fields: 'address_id', msg: '请选择地址', is_can_zero: 1 });
|
||||
}
|
||||
if (this.data.common_order_is_booking != 1) {
|
||||
validation.push({ fields: 'payment_id', msg: '请选择支付方式' });
|
||||
}
|
||||
|
||||
if (app.fields_check(data, validation)) {
|
||||
// 加载loding
|
||||
qq.showLoading({title: '提交中...'});
|
||||
this.setData({ buy_submit_disabled_status: true });
|
||||
|
||||
qq.request({
|
||||
url: app.get_request_url("add", "buy"),
|
||||
method: "POST",
|
||||
data: this.request_data_coupon_merge(data),
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
qq.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.order_status == 1) {
|
||||
qq.redirectTo({
|
||||
url: '/pages/user-order/user-order?is_pay=1&order_ids=' + res.data.data.order_ids.join(',')
|
||||
});
|
||||
} else {
|
||||
qq.redirectTo({url: '/pages/user-order/user-order'});
|
||||
}
|
||||
} else {
|
||||
app.showToast(res.data.msg);
|
||||
this.setData({ buy_submit_disabled_status: false });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.hideLoading();
|
||||
this.setData({buy_submit_disabled_status: false});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 支付方式选择
|
||||
payment_event(e) {
|
||||
this.setData({ payment_id: e.currentTarget.dataset.value});
|
||||
this.payment_list_data(this.data.payment_list);
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 支付方式数据处理
|
||||
payment_list_data(data) {
|
||||
if (this.data.payment_id != 0) {
|
||||
for (var i in data) {
|
||||
if (data[i]['id'] == this.data.payment_id) {
|
||||
data[i]['selected'] = 'selected';
|
||||
} else {
|
||||
data[i]['selected'] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({payment_list: data || []});
|
||||
},
|
||||
|
||||
// 优惠劵弹层开启
|
||||
plugins_coupon_open_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
this.setData({
|
||||
popup_plugins_coupon_status: true,
|
||||
popup_plugins_coupon_index: index,
|
||||
});
|
||||
},
|
||||
|
||||
// 优惠劵弹层关闭
|
||||
plugins_coupon_close_event(e) {
|
||||
this.setData({ popup_plugins_coupon_status: false });
|
||||
},
|
||||
|
||||
// 优惠劵选择
|
||||
plugins_coupon_use_event(e) {
|
||||
var wid = e.currentTarget.dataset.wid;
|
||||
var value = e.currentTarget.dataset.value;
|
||||
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_ids: temp,
|
||||
popup_plugins_coupon_status: false,
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 地址选择事件
|
||||
address_event(e) {
|
||||
if (this.data.common_site_type == 0 || (this.data.common_site_type == 4 && this.data.site_model == 0))
|
||||
{
|
||||
qq.navigateTo({
|
||||
url: '/pages/user-address/user-address?is_back=1'
|
||||
});
|
||||
} else if (this.data.common_site_type == 2 || (this.data.common_site_type == 4 && this.data.site_model == 2))
|
||||
{
|
||||
qq.navigateTo({
|
||||
url: '/pages/extraction-address/extraction-address?is_back=1'
|
||||
});
|
||||
} else {
|
||||
app.showToast('当前模式不允许使用地址');
|
||||
}
|
||||
},
|
||||
|
||||
// 销售+自提 模式选择事件
|
||||
buy_header_nav_event(e) {
|
||||
var value = e.currentTarget.dataset.value || 0;
|
||||
if (value != this.data.site_model)
|
||||
{
|
||||
// 数据设置
|
||||
this.setData({
|
||||
address: null,
|
||||
address_id: null,
|
||||
site_model: value,
|
||||
});
|
||||
|
||||
// 删除地址缓存
|
||||
qq.removeStorageSync(app.data.cache_buy_user_address_select_key);
|
||||
|
||||
// 数据初始化
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
||||
// 地图查看
|
||||
map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data.goods_list[index] || null;
|
||||
if (data == null)
|
||||
{
|
||||
app.showToast("地址有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 打开地图
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.open_location(data.lng, data.lat, name, address);
|
||||
},
|
||||
});
|
||||
7
sourcecode/qq/default/pages/buy/buy.json
Executable file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {
|
||||
"component-quick-nav": "/components/quick-nav/quick-nav",
|
||||
"component-popup": "/components/popup/popup"
|
||||
}
|
||||
}
|
||||
157
sourcecode/qq/default/pages/buy/buy.qml
Executable file
@ -0,0 +1,157 @@
|
||||
<block qq:if="{{common_site_type == 1}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: 2, msg: '展示型不允许提交订单'}}"></template>
|
||||
</block>
|
||||
<block qq:else>
|
||||
<view qq:if="{{goods_list.length > 0}}" class="page">
|
||||
<!-- 销售+自提 模式选择 -->
|
||||
<view qq:if="{{common_site_type == 4}}" class="buy-header-nav oh tc">
|
||||
<block qq:for="{{buy_header_nav}}" qq:key="key">
|
||||
<view class="item fl {{site_model == item.value ? 'cr-main' : 'cr-666'}}" data-value="{{item.value}}" bindtap="buy_header_nav_event">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 地址 -->
|
||||
<block qq:if="{{common_site_type == 0 || common_site_type == 2 || common_site_type == 4}}">
|
||||
<view class="address bg-white arrow-right" bindtap="address_event">
|
||||
<view qq:if="{{address != null}}">
|
||||
<view class="address-base oh">
|
||||
<text qq:if="{{(address.alias || null) != null}}" class="address-alias">{{address.alias}}</text>
|
||||
<text>{{address.name}}</text>
|
||||
<text class="fr">{{address.tel}}</text>
|
||||
</view>
|
||||
<view class="address-detail oh">
|
||||
<image class="icon fl" src="/images/user-address.png" mode="widthFix" />
|
||||
<view class="text fr">{{address.province_name || ''}}{{address.city_name || ''}}{{address.county_name || ''}}{{address.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view qq:if="{{address == null}}" class="no-address cr-888">
|
||||
{{(common_site_type == 0 || (common_site_type == 4 && site_model == 0)) ? '请选择收货地址' : '请选择取货地址'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-divider spacing-mb"></view>
|
||||
</block>
|
||||
|
||||
<!-- 商品数据 -->
|
||||
<view class="goods-group-list bg-white spacing-mb" qq:for="{{goods_list}}" qq:for-item="group" qq:key="key">
|
||||
<!-- 仓库分组 -->
|
||||
<view class="goods-group-hd oh br-b">
|
||||
<view class="fl">
|
||||
<text class="goods-group-title">{{group.name}}</text>
|
||||
<text qq:if="{{(group.alias || null) != null}}" class="goods-group-alias">{{group.alias}}</text>
|
||||
</view>
|
||||
<view qq:if="{{(group.lng || null) != null && (group.lat || null) != null}}" class="fr">
|
||||
<view class="goods-group-map-submit br" data-index="{{index}}" bindtap="map_event">查看地图</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品 -->
|
||||
<view qq:for="{{group.goods_items}}" qq:key="keys" class="goods-item oh">
|
||||
<image class="goods-image fl" src="{{item.images}}" mode="aspectFill" />
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}</view>
|
||||
<block qq:if="{{item.spec != null}}">
|
||||
<view class="goods-spec cr-888" qq:for="{{item.spec}}" qq:key="key" qq:for-item="spec">{{spec.type}}:{{spec.value}}
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="oh goods-price">
|
||||
<text class="sales-price">{{currency_symbol}}{{item.price}}
|
||||
</text>
|
||||
<text qq:if="{{item.original_price > 0}}" class="original-price">{{currency_symbol}}{{item.original_price}}
|
||||
</text>
|
||||
<text class="buy-number cr-888">x{{item.stock}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠劵 -->
|
||||
<view qq: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 qq:if="{{group.order_base.extension_data.length > 0}}" class="extension-list spacing-mt">
|
||||
<view qq:for="{{group.order_base.extension_data}}" qq:key="key" class="item oh">
|
||||
<text class="cr-666 fl">{{item.name}}
|
||||
</text>
|
||||
<text class="text-tips fr">{{item.tips}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 小计 -->
|
||||
<view class="oh tr goods-group-footer spacing-mt spacing-mb">
|
||||
<text qq:if="{{group.order_base.total_price != group.order_base.actual_price}}" class="original-price">{{currency_symbol}}{{group.order_base.total_price}}</text>
|
||||
<text class="sales-price">{{currency_symbol}}{{group.order_base.actual_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 留言 -->
|
||||
<view class="content-textarea-container bg-white spacing-mb">
|
||||
<textarea qq:if="{{user_note_status}}" bindblur="bind_user_note_blur_event" bindinput="bind_user_note_event" focus="{{true}}" value="{{user_note_value}}" maxlength="60" placeholder="留言" />
|
||||
<view qq:else bindtap="bind_user_note_tap_event" class="{{(user_note_value || null) == null ? 'cr-888' : ''}}">{{user_note_value || '留言'}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<view qq:if="{{payment_list.length > 0 && common_order_is_booking != 1}}" class="payment-list bg-white oh">
|
||||
<view class="item tc fl" qq:for="{{payment_list}}" qq:key="key">
|
||||
<view class="item-content br {{(item.selected || '')}}" data-value="{{item.id}}" bindtap="payment_event">
|
||||
<image qq:if="{{(item.logo || null) != null}}" class="icon" src="{{item.logo}}" mode="widthFix" />
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{currency_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
<view class="fr nav-submit">
|
||||
<button class="bg-main wh-auto" type="default" bindtap="buy_submit_event" disabled="{{buy_submit_disabled_status}}" hover-class="none">提交订单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view qq:if="{{goods_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
|
||||
<!-- 优惠劵选择 -->
|
||||
<component-popup prop-show="{{popup_plugins_coupon_status}}" prop-position="bottom" bindonclose="plugins_coupon_close_event">
|
||||
<qs src="../../utils/tools.qs" 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 qq: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 data-wid="{{plugins_coupon_data[popup_plugins_coupon_index].warehouse_id}}" bindtap="plugins_coupon_not_use_event">不使用优惠劵</text>
|
||||
</view>
|
||||
<block qq:for="{{plugins_coupon_data[popup_plugins_coupon_index].coupon_data.coupon_list}}" qq: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 qq:if="{{item.coupon.type == 0}}" class="symbol">{{currency_symbol}}</text>
|
||||
<text class="price">{{item.coupon.discount_value}}</text>
|
||||
<text class="unit">{{item.coupon.type_unit}}</text>
|
||||
<text qq:if="{{(item.coupon.desc || null) != null}}" class="desc cr-888">{{item.coupon.desc}}</text>
|
||||
</view>
|
||||
<view qq: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-wid="{{plugins_coupon_data[popup_plugins_coupon_index].warehouse_id}}" data-value="{{item.id}}" bindtap="plugins_coupon_use_event">
|
||||
<text class="circle"></text>
|
||||
<text>{{tools.indexOf(plugins_use_coupon_ids, item.id) ? '已选' : '选择'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</component-popup>
|
||||
</block>
|
||||
|
||||
<!-- 快捷导航 -->
|
||||
<component-quick-nav></component-quick-nav>
|
||||
212
sourcecode/qq/default/pages/buy/buy.qss
Executable file
@ -0,0 +1,212 @@
|
||||
.page {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
.address {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.address-base, .address-detail {
|
||||
padding: 10rpx 35rpx 10rpx 10rpx;
|
||||
}
|
||||
.address-detail .icon {
|
||||
width: 30rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-detail .text {
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.address-divider {
|
||||
height: 4px;
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAECAYAAADWIIyPAAAAkklEQVR42mP4jwR+7tr1/4OzM1Xwt46O/6SA3Yd//HeLeU0V3DXjE0H7GGCMvw8f/v/o5UUVT39KTPz/78cPoj398Omf/75Jb6ji6ZSyd/9//PxHnMdBjvyUlEQVT4MC7++DB0R7GuTIlPJ3VPE0KPAePvlDlL1gj3/r6qJaEv+5YwdJSbxn5meqJfGdh74TbS8A1dn662xhNdIAAAAASUVORK5CYII=");
|
||||
background-repeat-y: no-repeat;
|
||||
}
|
||||
.address-detail .text, .goods-title {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.no-address {
|
||||
height: 85rpx;
|
||||
line-height: 85rpx;
|
||||
}
|
||||
.address-alias {
|
||||
border: 1px solid #d2364c;
|
||||
color: #d2364c;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
.goods-group-list .goods-item:not(:last-child) {
|
||||
border-bottom: 1px dashed #efefef;
|
||||
}
|
||||
.goods-group-list {
|
||||
padding: 0 10rpx 10rpx 10rpx;
|
||||
}
|
||||
.goods-group-hd {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.goods-group-title {
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.goods-group-alias {
|
||||
border: 1px solid #3bb4f2;
|
||||
color: #3bb4f2;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.goods-group-footer .original-price {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.goods-group-map-submit {
|
||||
font-size: 24rpx;
|
||||
padding: 5rpx 20rpx;
|
||||
background: #f0f0f0;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.goods-title, .goods-spec {
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
.goods-item {
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.goods-price {
|
||||
position: relative;
|
||||
}
|
||||
.buy-number {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.goods-base {
|
||||
min-height: 160rpx;
|
||||
margin-left: 180rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航
|
||||
*/
|
||||
.buy-nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.buy-nav, .nav-base, .nav-submit button {
|
||||
height: 100rpx;
|
||||
}
|
||||
.nav-base, .nav-submit button {
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.nav-base {
|
||||
width: calc(60% - 20rpx);
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.nav-submit {
|
||||
width: 40%;
|
||||
}
|
||||
.nav-submit button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
.payment-list .item {
|
||||
width: 50%;
|
||||
}
|
||||
.payment-list .item-content {
|
||||
margin: 20rpx;
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.payment-list .item-content image {
|
||||
width: 50rpx;
|
||||
height: 50rpx !important;
|
||||
vertical-align: middle;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.payment-list .selected {
|
||||
border: 1px solid #d2364c;
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩展数据
|
||||
*/
|
||||
.extension-list {
|
||||
background-color: #ffffeb;
|
||||
border: 1px solid #ffe2cf;
|
||||
}
|
||||
.extension-list .item {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.extension-list .item:not(:last-child) {
|
||||
border-bottom: 1px dashed #ffe2cf;
|
||||
}
|
||||
.extension-list .item .text-tips {
|
||||
color: #ff8f44;
|
||||
}
|
||||
|
||||
/**
|
||||
* 留言
|
||||
*/
|
||||
.content-textarea-container {
|
||||
padding: 5rpx;
|
||||
}
|
||||
.content-textarea-container textarea,
|
||||
.content-textarea-container view {
|
||||
padding: 5rpx 15rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售+自提 模式选择
|
||||
*/
|
||||
.buy-header-nav {
|
||||
background: #e9e9e9;
|
||||
}
|
||||
.buy-header-nav .item {
|
||||
padding: 25rpx 0;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件样式区域
|
||||
*/
|
||||
/**
|
||||
* 优惠劵
|
||||
*/
|
||||
.plugins-coupon {
|
||||
padding: 25rpx 40rpx 25rpx 10rpx;
|
||||
}
|
||||
.plugins-coupon-popup {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.plugins-coupon-popup .close {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.coupon-container {
|
||||
max-height: 80vh;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
.coupon-container .item,
|
||||
.coupon-container .v-right,
|
||||
.coupon-container .v-right .circle {
|
||||
height: 230rpx;
|
||||
}
|
||||
.coupon-container .not-use-tips {
|
||||
color: #f7b240;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
405
sourcecode/qq/default/pages/cart/cart.js
Executable file
@ -0,0 +1,405 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
swipe_index: null,
|
||||
total_price: '0.00',
|
||||
is_selected_all: false,
|
||||
buy_submit_disabled_status: true,
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
common_site_type: 0,
|
||||
common_is_exhibition_mode_btn_text: null,
|
||||
common_app_customer_service_tel: null,
|
||||
},
|
||||
|
||||
onShow() {
|
||||
qq.setNavigationBarTitle({ title: app.data.common_pages_title.cart });
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.get_config('currency_symbol'),
|
||||
common_site_type: app.get_config('config.common_site_type'),
|
||||
common_is_exhibition_mode_btn_text: app.get_config('config.common_is_exhibition_mode_btn_text', '立即咨询'),
|
||||
common_app_customer_service_tel: app.get_config('config.common_app_customer_service_tel'),
|
||||
});
|
||||
} else {
|
||||
app.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init(e) {
|
||||
var user = app.get_user_info(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
qq.showModal({
|
||||
title: '温馨提示',
|
||||
content: '绑定手机号码',
|
||||
confirmText: '确认',
|
||||
cancelText: '暂不',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
qq.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '请绑定手机号码',
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.get_data();
|
||||
}
|
||||
} else {
|
||||
qq.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '请先授权用户信息',
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
total_price: '0.00',
|
||||
is_selected_all: false,
|
||||
buy_submit_disabled_status: true,
|
||||
});
|
||||
|
||||
qq.request({
|
||||
url: app.get_request_url("index", "cart"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
qq.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 数据赋值
|
||||
this.setData({
|
||||
data_list: data.data,
|
||||
data_list_loding_status: data.data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: '购物车空空如也',
|
||||
});
|
||||
|
||||
// 导航购物车处理
|
||||
var cart_total = data.common_cart_total || 0;
|
||||
if (cart_total <= 0) {
|
||||
app.set_tab_bar_badge(2, 0);
|
||||
} else {
|
||||
app.set_tab_bar_badge(2, 1, cart_total);
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.is_login_check(res.data, this, 'get_data')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 数量输入事件
|
||||
goods_buy_number_blur(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var buy_number = parseInt(e.detail.value) || 1;
|
||||
this.goods_buy_number_func(index, buy_number);
|
||||
},
|
||||
|
||||
// 数量操作事件
|
||||
goods_buy_number_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var type = parseInt(e.currentTarget.dataset.type) || 0;
|
||||
var temp_buy_number = parseInt(this.data.data_list[index]['stock']);
|
||||
if (type == 0) {
|
||||
var buy_number = temp_buy_number - 1;
|
||||
} else {
|
||||
var buy_number = temp_buy_number + 1;
|
||||
}
|
||||
this.goods_buy_number_func(index, buy_number);
|
||||
},
|
||||
|
||||
// 数量处理方法
|
||||
goods_buy_number_func(index, buy_number) {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var buy_min_number = parseInt(temp_data_list[index]['buy_min_number']) || 1;
|
||||
var buy_max_number = parseInt(temp_data_list[index]['buy_max_number']) || 0;
|
||||
var inventory = parseInt(temp_data_list[index]['inventory']);
|
||||
var inventory_unit = temp_data_list[index]['inventory_unit'];
|
||||
if (buy_number < buy_min_number) {
|
||||
buy_number = buy_min_number;
|
||||
if (buy_min_number > 1) {
|
||||
app.showToast('起购' + buy_min_number + inventory_unit );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (buy_max_number > 0 && buy_number > buy_max_number) {
|
||||
buy_number = buy_max_number;
|
||||
app.showToast('限购' + buy_max_number + inventory_unit );
|
||||
return false;
|
||||
}
|
||||
if (buy_number > inventory) {
|
||||
buy_number = inventory;
|
||||
app.showToast( '库存数量' + inventory + inventory_unit );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (temp_data_list[index]['stock'] == 1 && buy_number == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 更新数据库
|
||||
qq.request({
|
||||
url: app.get_request_url("stock", "cart"),
|
||||
method: "POST",
|
||||
data: { "id": temp_data_list[index]['id'], "goods_id": temp_data_list[index]['goods_id'], "stock": buy_number},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
qq.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
temp_data_list[index]['stock'] = buy_number;
|
||||
this.setData({ data_list: temp_data_list });
|
||||
|
||||
// 选择处理
|
||||
this.selected_calculate();
|
||||
} else {
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 收藏+删除
|
||||
goods_favor_delete(id, goods_id, type) {
|
||||
qq.request({
|
||||
url: app.get_request_url('favor', 'goods'),
|
||||
method: 'POST',
|
||||
data: { "id": goods_id, "is_mandatory_favor": 1 },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
this.cart_delete(id, type);
|
||||
} else {
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast(res.data.msg);
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 移除操作事件
|
||||
cart_remove_event(e) {
|
||||
var id = e.currentTarget.dataset.id || null;
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var goods_id = e.currentTarget.dataset.goodsid || 0;
|
||||
var self = this;
|
||||
if (id !== null) {
|
||||
self.setData({ swipe_index: index})
|
||||
qq.showActionSheet({
|
||||
itemList: ['加入收藏', '删除'],
|
||||
success(res) {
|
||||
if (res.tapIndex == 0)
|
||||
{
|
||||
self.goods_favor_delete(id, goods_id, 'favor')
|
||||
} else {
|
||||
self.cart_delete(id, 'delete');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
app.showToast("参数有误");
|
||||
}
|
||||
},
|
||||
|
||||
// 购物车删除
|
||||
cart_delete(id, type) {
|
||||
qq.request({
|
||||
url: app.get_request_url('delete', 'cart'),
|
||||
method: 'POST',
|
||||
data: { "id": id },
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data.data_list;
|
||||
temp_data_list.splice(this.data.swipe_index, 1);
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
swipe_index: null,
|
||||
data_list_loding_status: temp_data_list.length == 0 ? 0 : this.data.data_list_loding_status,
|
||||
});
|
||||
|
||||
// 导航购物车处理
|
||||
var cart_total = res.data.data || 0;
|
||||
if (cart_total <= 0) {
|
||||
app.set_tab_bar_badge(2, 0);
|
||||
} else {
|
||||
app.set_tab_bar_badge(2, 1, cart_total);
|
||||
}
|
||||
|
||||
app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
|
||||
} else {
|
||||
if (app.is_login_check(res.data)) {
|
||||
app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
|
||||
} else {
|
||||
app.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 选中处理
|
||||
selected_event(e) {
|
||||
var type = e.currentTarget.dataset.type || null;
|
||||
if (type != null)
|
||||
{
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_is_selected_all = this.data.is_selected_all;
|
||||
switch(type) {
|
||||
// 批量操作
|
||||
case 'all' :
|
||||
temp_is_selected_all = (temp_is_selected_all == true) ? false : true;
|
||||
for (var i in temp_data_list) {
|
||||
if (temp_data_list[i]['is_error'] != 1)
|
||||
{
|
||||
temp_data_list[i]['selected'] = temp_is_selected_all;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 节点操作
|
||||
case 'node' :
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
if (temp_data_list[index]['is_error'] != 1)
|
||||
{
|
||||
temp_data_list[index]['selected'] = (temp_data_list[index]['selected'] == true) ? false : true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
is_selected_all: temp_is_selected_all,
|
||||
});
|
||||
|
||||
// 选择处理
|
||||
this.selected_calculate();
|
||||
}
|
||||
},
|
||||
|
||||
// 选中计算
|
||||
selected_calculate() {
|
||||
var total_price = 0;
|
||||
var data_count = 0;
|
||||
var selected_count = 0;
|
||||
var temp_data_list = this.data.data_list;
|
||||
for (var i in temp_data_list) {
|
||||
if ((temp_data_list[i]['is_error'] || 0) == 0) {
|
||||
data_count++;
|
||||
}
|
||||
if ((temp_data_list[i]['selected'] || false) == true) {
|
||||
total_price += temp_data_list[i]['stock'] * temp_data_list[i]['price'];
|
||||
selected_count++;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
total_price: total_price.toFixed(2),
|
||||
buy_submit_disabled_status: (selected_count <= 0),
|
||||
is_selected_all: (selected_count > 0 && selected_count >= data_count),
|
||||
});
|
||||
},
|
||||
|
||||
// 结算
|
||||
buy_submit_event(e) {
|
||||
var selected_count = 0;
|
||||
var ids = [];
|
||||
var temp_data_list = this.data.data_list;
|
||||
for (var i in temp_data_list) {
|
||||
if ((temp_data_list[i]['selected'] || false) == true) {
|
||||
ids.push(temp_data_list[i]['id']);
|
||||
selected_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (selected_count <= 0) {
|
||||
app.showToast("请选择商品");
|
||||
return false
|
||||
}
|
||||
|
||||
// 进入订单确认页面
|
||||
var data = {
|
||||
"buy_type": "cart",
|
||||
"ids": ids.join(',')
|
||||
};
|
||||
qq.navigateTo({
|
||||
url: '/pages/buy/buy?data=' + JSON.stringify(data)
|
||||
});
|
||||
},
|
||||
|
||||
// 展示型事件
|
||||
exhibition_submit_event(e) {
|
||||
app.call_tel(this.data.common_app_customer_service_tel);
|
||||
},
|
||||
|
||||
});
|
||||
6
sourcecode/qq/default/pages/cart/cart.json
Executable file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {
|
||||
"component-quick-nav": "/components/quick-nav/quick-nav"
|
||||
}
|
||||
}
|
||||
87
sourcecode/qq/default/pages/cart/cart.qml
Executable file
@ -0,0 +1,87 @@
|
||||
<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="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>
|
||||
|
||||
<view class="bg-white items">
|
||||
<!-- 图片/链接 -->
|
||||
<navigator url="/pages/goods-detail/goods-detail?goods_id={{item.goods_id}}">
|
||||
<image class="goods-image fl" src="{{item.images}}" mode="aspectFill" />
|
||||
</navigator>
|
||||
|
||||
<!-- 基础 -->
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}
|
||||
</view>
|
||||
<block qq:if="{{item.spec != null}}">
|
||||
<view class="goods-spec cr-888" qq:for="{{item.spec}}" qq:key="key" qq:for-item="spec">{{spec.type}}:{{spec.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 数量 -->
|
||||
<view class="number-content tc oh">
|
||||
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-index="{{index}}" data-type="0">-</view>
|
||||
<input bindblur="goods_buy_number_blur" class="tc cr-888 fl" type="number" value="{{item.stock}}" data-index="{{index}}" />
|
||||
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-index="{{index}}" data-type="1">+</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view class="oh goods-price">
|
||||
<text class="sales-price">{{currency_symbol}}{{item.price}}</text>
|
||||
<text qq:if="{{item.original_price > 0}}" class="original-price">{{currency_symbol}}{{item.original_price}}</text>
|
||||
<text class="buy-number cr-888">x{{item.stock}}</text>
|
||||
|
||||
<!-- 错误 -->
|
||||
<text qq:if="{{(item.is_error || 0) == 1}}" class="error-msg">{{item.error_msg}}</text>
|
||||
|
||||
<!-- 移除 -->
|
||||
<view class="fr remove" data-id="{{item.id}}" data-goodsid="{{item.goods_id}}" data-index="{{index}}" bindtap="cart_remove_event">移除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作导航 -->
|
||||
<view qq:if="{{data_list.length > 0}}" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block qq:if="{{common_site_type == 1}}">
|
||||
<view class="exhibition-mode">
|
||||
<button class="bg-main wh-auto" type="default" bindtap="exhibition_submit_event" hover-class="none">{{common_is_exhibition_mode_btn_text}}</button>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block qq:else>
|
||||
<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>
|
||||
<view class="fr price">
|
||||
<view class="sales-price single-text fr">{{currency_symbol}}{{total_price}}</view>
|
||||
<view class="fr">合计:</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fr nav-submit">
|
||||
<button class="bg-main wh-auto" type="default" bindtap="buy_submit_event" disabled="{{buy_submit_disabled_status}}" hover-class="none">结算</button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空购物车 -->
|
||||
<view qq:if="{{data_list.length == 0 && data_list_loding_status == 0}}" class="no-data-box tc">
|
||||
<image src="/images/default-cart-empty.png" mode="widthFix" />
|
||||
<view class="no-data-tips">{{data_list_loding_msg || '购物车空空如也'}}</view>
|
||||
<navigator url="/pages/index/index" open-type="switchTab" hover-class="none">
|
||||
<button type="default" class="my-btn-default" hover-class="none">去逛逛</button>
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
<view qq:if="{{data_list.length == 0 && data_list_loding_status != 0}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
|
||||
<!-- 快捷导航 -->
|
||||
<component-quick-nav></component-quick-nav>
|
||||