对接支付功能
This commit is contained in:
209
App.vue
209
App.vue
@@ -2,15 +2,16 @@
|
||||
import base64 from './common/js/lib/base64.js';
|
||||
// 多语言引入并初始化
|
||||
import i18n from './locale/index';
|
||||
const env = process.env.NODE_ENV;
|
||||
export default {
|
||||
globalData: {
|
||||
data: {
|
||||
// 基础配置
|
||||
// 数据接口请求地址
|
||||
request_url:'https://d1.shopxo.vip/',
|
||||
request_url: env == 'development' ? '/api/' : 'https://store.sxczgkj.com/',
|
||||
|
||||
// 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/)
|
||||
static_url:'https://d1.shopxo.vip/',
|
||||
static_url: env == 'development' ? '/api/' : 'https://store.sxczgkj.com/',
|
||||
|
||||
// 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立)
|
||||
system_type: 'default',
|
||||
@@ -40,7 +41,7 @@
|
||||
// 蓝色 blue #1677ff
|
||||
// 棕色 brown #8B4513
|
||||
// 紫色 purple #623cec
|
||||
default_theme: 'red',
|
||||
default_theme: 'orange',
|
||||
|
||||
// 多语言列表
|
||||
// 增加或者减少语言时
|
||||
@@ -49,12 +50,7 @@
|
||||
default_language: 'zh',
|
||||
|
||||
// 系统tabbar
|
||||
system_tabbar: [
|
||||
'/pages/index/index',
|
||||
'/pages/goods-category/goods-category',
|
||||
'/pages/cart/cart',
|
||||
'/pages/user/user'
|
||||
],
|
||||
system_tabbar: ['/pages/index/index', '/pages/goods-category/goods-category', '/pages/cart/cart', '/pages/user/user'],
|
||||
|
||||
// 公共配置
|
||||
// 是否多商户店铺id
|
||||
@@ -139,7 +135,6 @@
|
||||
// 加载动画类型(0logo, 1名称)
|
||||
loading_content_type: 0,
|
||||
|
||||
|
||||
// 数据缓存key
|
||||
// 场景值
|
||||
cache_scene_key: 'cache_scene_key',
|
||||
@@ -347,6 +342,7 @@
|
||||
params = '&' + params;
|
||||
}
|
||||
var url = this.data.request_url + (group || 'api') + '.php?s=' + c + '/' + a + plugins_params;
|
||||
// let url = '/api';
|
||||
return this.request_params_handle(url) + '&ajax=ajax' + params;
|
||||
},
|
||||
|
||||
@@ -375,7 +371,7 @@
|
||||
|
||||
// 拼接标识
|
||||
var join = url.indexOf('?') == -1 ? '?' : '&';
|
||||
return url + join + 'system_type=' + this.data.system_type + '&application=app&application_client_type=' + client_value + '&application_client_brand=' + client_brand + '&token=' + token + '&uuid=' + uuid + referrer_params + user_location_params + '&lang=' + lang+'&theme='+theme;
|
||||
return url + join + 'system_type=' + this.data.system_type + '&application=app&application_client_type=' + client_value + '&application_client_brand=' + client_brand + '&token=' + token + '&uuid=' + uuid + referrer_params + user_location_params + '&lang=' + lang + '&theme=' + theme;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -398,7 +394,7 @@
|
||||
*/
|
||||
user_is_bind_mobile(user, object, method, params, is_to_login = false) {
|
||||
if ((user || null) != null && (user.mobile || null) == null && parseInt(user.is_mandatory_bind_mobile || 0) == 1) {
|
||||
if(is_to_login) {
|
||||
if (is_to_login) {
|
||||
this.login_confirm_tips_modal(this, object, method, params);
|
||||
}
|
||||
return true;
|
||||
@@ -440,7 +436,7 @@
|
||||
return false;
|
||||
} else {
|
||||
// 是否需要绑定手机
|
||||
if(this.user_is_bind_mobile(user, object, method, params, true)) {
|
||||
if (this.user_is_bind_mobile(user, object, method, params, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -576,27 +572,27 @@
|
||||
login_confirm_tips_modal(self, object, method, params) {
|
||||
// 是否tabbar页面
|
||||
var page = self.current_page(false);
|
||||
var is_tabbar = self.is_system_tabbar_pages('/'+page);
|
||||
var is_tabbar = self.is_system_tabbar_pages('/' + page);
|
||||
// 非初始化 并且 非tabbar页面则关闭当前页面并跳转登录页面
|
||||
if(method == 'init' && !is_tabbar) {
|
||||
if (method == 'init' && !is_tabbar) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
// 初始化页面并且是tabbar页面
|
||||
} else if(method == 'init' && is_tabbar) {
|
||||
} else if (method == 'init' && is_tabbar) {
|
||||
var key = this.data.cache_user_no_login_page_status_data_key;
|
||||
var data = uni.getStorageSync(key) || [];
|
||||
if(data.indexOf(page) == -1) {
|
||||
if (data.indexOf(page) == -1) {
|
||||
data.push(page);
|
||||
uni.setStorageSync(key, data);
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
// 非初始化则直接跳转登录页面
|
||||
} else if(method != 'init') {
|
||||
} else if (method != 'init') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -725,7 +721,7 @@
|
||||
var client_type = self.application_client_type();
|
||||
if ((data.is_user_exist || 0) == 1 || client_type == 'weixin') {
|
||||
// 存在数据非微信 或 微信小程序是否强制填写基础信息
|
||||
if(((data.is_user_exist || 0) == 1 && client_type != 'weixin') || !self.is_weixin_force_user_base_handle(self, data, object, method, params)) {
|
||||
if (((data.is_user_exist || 0) == 1 && client_type != 'weixin') || !self.is_weixin_force_user_base_handle(self, data, object, method, params)) {
|
||||
uni.setStorageSync(self.data.cache_user_info_key, data);
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method](params);
|
||||
@@ -766,12 +762,12 @@
|
||||
// 微信小程序是否强制填写基础信息
|
||||
is_weixin_force_user_base_handle(self, data, object, method, params) {
|
||||
var status = parseInt(self.get_config('config.common_app_is_weixin_force_user_base', 0));
|
||||
if(status == 1) {
|
||||
if (status == 1) {
|
||||
var obj = self.get_page_object();
|
||||
if((obj.$vm || null) != null && (obj.$vm.$refs || null) != null && (obj.$vm.$refs.common || null) != null && (obj.$vm.$refs.common.$refs || null) != null && (obj.$vm.$refs.common.$refs.user_base || null) != null) {
|
||||
if ((obj.$vm || null) != null && (obj.$vm.$refs || null) != null && (obj.$vm.$refs.common || null) != null && (obj.$vm.$refs.common.$refs || null) != null && (obj.$vm.$refs.common.$refs.user_base || null) != null) {
|
||||
var user_base = obj.$vm.$refs.common.$refs.user_base;
|
||||
var res = user_base.form_write_field_check_data(data, true);
|
||||
if(res.popup_status) {
|
||||
if (res.popup_status) {
|
||||
user_base.user_base_open(object, method, params);
|
||||
}
|
||||
return res.popup_status;
|
||||
@@ -939,7 +935,7 @@
|
||||
*/
|
||||
get_url_main_part(url) {
|
||||
var value = '';
|
||||
if((url || null) != null) {
|
||||
if ((url || null) != null) {
|
||||
if (url.indexOf('?') == -1) {
|
||||
value = url;
|
||||
} else {
|
||||
@@ -986,9 +982,9 @@
|
||||
app_tabbar_pages() {
|
||||
var temp_tabbar = this.data.system_tabbar;
|
||||
var app_tabbar = this.get_config('app_tabbar') || null;
|
||||
if(app_tabbar != null && (app_tabbar.content || null) != null && (app_tabbar.content.nav_content || null) != null) {
|
||||
temp_tabbar = app_tabbar.content.nav_content.map(function(v) {
|
||||
if((v.link || null) != null && (v.link.page || null) != null) {
|
||||
if (app_tabbar != null && (app_tabbar.content || null) != null && (app_tabbar.content.nav_content || null) != null) {
|
||||
temp_tabbar = app_tabbar.content.nav_content.map(function (v) {
|
||||
if ((v.link || null) != null && (v.link.page || null) != null) {
|
||||
return v.link.page;
|
||||
}
|
||||
});
|
||||
@@ -1000,7 +996,7 @@
|
||||
* 当前地址是否存在底部菜单tabbar中
|
||||
*/
|
||||
is_tabbar_pages(url = null) {
|
||||
var pages = (this.data.is_use_native_tabbar == 1) ? this.data.system_tabbar : this.app_tabbar_pages();
|
||||
var pages = this.data.is_use_native_tabbar == 1 ? this.data.system_tabbar : this.app_tabbar_pages();
|
||||
return this.is_tabbar_pages_handle(pages, url);
|
||||
},
|
||||
|
||||
@@ -1017,15 +1013,15 @@
|
||||
* url url地址
|
||||
*/
|
||||
is_tabbar_pages_handle(pages, url = null) {
|
||||
var value = (url == null) ? '/'+this.current_page() : url;
|
||||
var value = url == null ? '/' + this.current_page() : url;
|
||||
if ((value || null) != null) {
|
||||
if(pages.indexOf(value) != -1) {
|
||||
if (pages.indexOf(value) != -1) {
|
||||
return true;
|
||||
} else {
|
||||
// 存在参数,去掉参数再检索是否存在页面的tabbar
|
||||
if(value.indexOf('?') != -1) {
|
||||
if (value.indexOf('?') != -1) {
|
||||
var temp = value.split('?');
|
||||
if(pages.indexOf(temp[0]) != -1) {
|
||||
if (pages.indexOf(temp[0]) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1040,16 +1036,16 @@
|
||||
*/
|
||||
is_tabbar_home(url = null) {
|
||||
var pages = this.app_tabbar_pages() || [];
|
||||
if(pages.length > 0) {
|
||||
var value = (url == null) ? '/'+this.current_page() : url;
|
||||
if (pages.length > 0) {
|
||||
var value = url == null ? '/' + this.current_page() : url;
|
||||
if ((value || null) != null) {
|
||||
if(pages[0] == value) {
|
||||
if (pages[0] == value) {
|
||||
return true;
|
||||
} else {
|
||||
// 存在参数,去掉参数再检索是否存在页面的tabbar
|
||||
if(value.indexOf('?') != -1) {
|
||||
if (value.indexOf('?') != -1) {
|
||||
var temp = value.split('?');
|
||||
if(pages[0] == temp[0]) {
|
||||
if (pages[0] == temp[0]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1057,7 @@
|
||||
|
||||
// 系统底部菜单隐藏
|
||||
system_hide_tabbar() {
|
||||
if(this.data.is_use_native_tabbar != 1) {
|
||||
if (this.data.is_use_native_tabbar != 1) {
|
||||
uni.hideTabBar();
|
||||
}
|
||||
},
|
||||
@@ -1088,13 +1084,13 @@
|
||||
uni.setStorageSync(this.data.cache_page_tabbar_switch_params, query);
|
||||
}
|
||||
uni.switchTab({
|
||||
url: value
|
||||
url: value,
|
||||
});
|
||||
//隐藏系统tabbar
|
||||
this.system_hide_tabbar();
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: value
|
||||
url: value,
|
||||
});
|
||||
}
|
||||
break;
|
||||
@@ -1128,7 +1124,7 @@
|
||||
*/
|
||||
open_web_view(value, is_redirect = false) {
|
||||
var url = '/pages/web-view/web-view?url=' + encodeURIComponent(value);
|
||||
if(is_redirect) {
|
||||
if (is_redirect) {
|
||||
uni.redirectTo({
|
||||
url: url,
|
||||
});
|
||||
@@ -1261,7 +1257,7 @@
|
||||
*/
|
||||
get_tab_bar_badge(type) {
|
||||
if ((type || null) != null) {
|
||||
return uni.getStorageSync(this.data.cache_tabbar_badge_key+'-'+type) || null;
|
||||
return uni.getStorageSync(this.data.cache_tabbar_badge_key + '-' + type) || null;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -1273,23 +1269,23 @@
|
||||
*/
|
||||
set_tab_bar_badge(type, value = 0) {
|
||||
// 是否使用原生菜单
|
||||
if(this.data.is_use_native_tabbar == 1) {
|
||||
if(type == 'cart') {
|
||||
if (this.data.is_use_native_tabbar == 1) {
|
||||
if (type == 'cart') {
|
||||
if ((value || 0) == 0) {
|
||||
uni.removeTabBarBadge({
|
||||
index: 2
|
||||
index: 2,
|
||||
});
|
||||
} else {
|
||||
uni.setTabBarBadge({
|
||||
index: 2,
|
||||
text: value.toString()
|
||||
text: value.toString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 数据处理
|
||||
if ((type || null) != null) {
|
||||
var key = this.data.cache_tabbar_badge_key+'-'+type;
|
||||
var key = this.data.cache_tabbar_badge_key + '-' + type;
|
||||
if ((value || null) == null) {
|
||||
uni.removeStorageSync(key);
|
||||
} else {
|
||||
@@ -1298,7 +1294,7 @@
|
||||
}
|
||||
// 更新底部菜单数据
|
||||
var obj = this.get_page_object() || null;
|
||||
if(obj != null && (obj.$vm || null) != null && (obj.$vm.$refs || null) != null && (obj.$vm.$refs.common || null) != null) {
|
||||
if (obj != null && (obj.$vm || null) != null && (obj.$vm.$refs || null) != null && (obj.$vm.$refs.common || null) != null) {
|
||||
obj.$vm.$refs.common.footer_init();
|
||||
}
|
||||
}
|
||||
@@ -1424,7 +1420,7 @@
|
||||
if ((data || null) != null) {
|
||||
var arr = key.split('.');
|
||||
if (arr.length == 1) {
|
||||
if(data[key] != undefined) {
|
||||
if (data[key] != undefined) {
|
||||
value = data[key];
|
||||
}
|
||||
} else {
|
||||
@@ -1450,7 +1446,7 @@
|
||||
get_config(key, default_value) {
|
||||
// 获取全部缓存
|
||||
var config = uni.getStorageSync(this.data.cache_config_info_key) || null;
|
||||
if((key || null) == null) {
|
||||
if ((key || null) == null) {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -1503,13 +1499,13 @@
|
||||
if (res.networkType != 'none') {
|
||||
// 获取配置本地缓存
|
||||
var config = self.get_config();
|
||||
if(config != null) {
|
||||
if (config != null) {
|
||||
// 公共配置初始化返回处理
|
||||
self.init_config_result_handle(config, self);
|
||||
}
|
||||
|
||||
// 读取远程配置
|
||||
if(self.data.common_data_loading_status == 0) {
|
||||
if (self.data.common_data_loading_status == 0) {
|
||||
// 赋值在加载状态
|
||||
self.data.common_data_loading_status = 1;
|
||||
uni.request({
|
||||
@@ -1543,7 +1539,7 @@
|
||||
|
||||
// 首次则再次初始化配置、站点关闭状态则不处理
|
||||
if (parseInt(num || 0) <= 20 && self.data.common_data_init_status == 0) {
|
||||
self.init_config(num+1, object, method, params);
|
||||
self.init_config(num + 1, object, method, params);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1552,7 +1548,7 @@
|
||||
self.data.common_data_loading_status = 0;
|
||||
// 首次则再次初始化配置
|
||||
if (parseInt(num || 0) <= 20) {
|
||||
self.init_config(num+1, object, method, params);
|
||||
self.init_config(num + 1, object, method, params);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1721,7 +1717,7 @@
|
||||
|
||||
// 链接地址事件
|
||||
url_event(e) {
|
||||
if((e.currentTarget || null) != null && (e.currentTarget.dataset || null) != null) {
|
||||
if ((e.currentTarget || null) != null && (e.currentTarget.dataset || null) != null) {
|
||||
// 需要打开的url地址
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
|
||||
@@ -1735,9 +1731,9 @@
|
||||
|
||||
// 如果是底部菜单,非系统内置菜单则关闭当前页面并打开
|
||||
var tabbar = this.app_tabbar_pages();
|
||||
if(tabbar.indexOf(value) != -1 && this.data.system_tabbar.indexOf(value) == -1) {
|
||||
if (tabbar.indexOf(value) != -1 && this.data.system_tabbar.indexOf(value) == -1) {
|
||||
var page = this.prev_page();
|
||||
if(page != null && this.data.system_tabbar.indexOf(page) == -1) {
|
||||
if (page != null && this.data.system_tabbar.indexOf(page) == -1) {
|
||||
is_redirect = true;
|
||||
}
|
||||
}
|
||||
@@ -1757,9 +1753,9 @@
|
||||
is_page(value) {
|
||||
var arr = ['/pages', 'pages/'];
|
||||
var status = arr.indexOf(value.substr(0, 6)) != -1;
|
||||
if(!status) {
|
||||
if (!status) {
|
||||
// 是否打开插件地址
|
||||
if(value.substr(0, 17) == 'plugin-private://') {
|
||||
if (value.substr(0, 17) == 'plugin-private://') {
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
@@ -1772,7 +1768,7 @@
|
||||
// #ifdef MP
|
||||
// 小程序最多打开10层页面
|
||||
var pages = getCurrentPages();
|
||||
if(pages.length >= 10) {
|
||||
if (pages.length >= 10) {
|
||||
is_redirect = true;
|
||||
}
|
||||
// #endif
|
||||
@@ -1787,12 +1783,12 @@
|
||||
appId: values[0],
|
||||
path: values[1] || '',
|
||||
extraData: values[2] || '',
|
||||
envVersion: values[3] || 'release'
|
||||
envVersion: values[3] || 'release',
|
||||
});
|
||||
} else if (value.substr(0, 12) == 'shortlink://') {
|
||||
// 小程序分享链接
|
||||
uni.navigateToMiniProgram({
|
||||
shortLink: value.substr(12)
|
||||
shortLink: value.substr(12),
|
||||
});
|
||||
} else if (value.substr(0, 6) == 'map://') {
|
||||
// 地图协议(名称|地址|lng|lat)
|
||||
@@ -1819,23 +1815,23 @@
|
||||
uni.setStorageSync(this.data.cache_page_tabbar_switch_params, query);
|
||||
}
|
||||
uni.switchTab({
|
||||
url: value
|
||||
url: value,
|
||||
});
|
||||
//隐藏系统tabbar
|
||||
this.system_hide_tabbar();
|
||||
} else {
|
||||
if (is_redirect) {
|
||||
uni.redirectTo({
|
||||
url: value
|
||||
url: value,
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: value
|
||||
url: value,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.url_open('/pages/goods-search/goods-search?keywords='+value);
|
||||
this.url_open('/pages/goods-search/goods-search?keywords=' + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1976,7 +1972,7 @@
|
||||
// app客户端品牌
|
||||
application_client_brand(e) {
|
||||
var value = this.get_system_info('brand', null, true);
|
||||
return (value === null) ? '' : value.toLowerCase();
|
||||
return value === null ? '' : value.toLowerCase();
|
||||
},
|
||||
|
||||
// 授权验证
|
||||
@@ -2059,9 +2055,9 @@
|
||||
// 拼接H5地址
|
||||
var host = this.get_config('config.common_app_h5_url', '');
|
||||
// #ifdef H5
|
||||
if(host == '') {
|
||||
if (host == '') {
|
||||
// H5模式下、未指定H5地址则获取当前host
|
||||
host = window.location.href.split('#')[0]+'#/';
|
||||
host = window.location.href.split('#')[0] + '#/';
|
||||
}
|
||||
// #endif
|
||||
// 处理中间拼接的斜杠是否重复
|
||||
@@ -2190,7 +2186,7 @@
|
||||
result['url'] = this.get_page_url();
|
||||
// #ifdef H5 || APP
|
||||
// 是有效的url地址则通过#号分割处理参数
|
||||
if(this.is_url(result['url'])) {
|
||||
if (this.is_url(result['url'])) {
|
||||
result['url'] = this.page_url_protocol(result.url.split('#')[0] + '#' + ((result.path || null) != null && result.path.substr(0, 1) == '/' ? '' : '/') + (result.path || '') + (result.query || ''));
|
||||
}
|
||||
// #endif
|
||||
@@ -2221,7 +2217,7 @@
|
||||
// 调用页面方法
|
||||
get_page_object(page = null) {
|
||||
var pages = getCurrentPages();
|
||||
if(page == null) {
|
||||
if (page == null) {
|
||||
return pages[pages.length - 1];
|
||||
} else {
|
||||
var result = [];
|
||||
@@ -2276,7 +2272,7 @@
|
||||
}
|
||||
|
||||
// 直接获取页面全的路径地址
|
||||
if((page.$page || null) != null && (page.$page.fullPath || null) != null) {
|
||||
if ((page.$page || null) != null && (page.$page.fullPath || null) != null) {
|
||||
var path = page.$page.fullPath;
|
||||
return path.substr(0, 1) == '/' ? path.substr(1) : path;
|
||||
}
|
||||
@@ -2347,7 +2343,7 @@
|
||||
// 当前平台
|
||||
var client_value = this.application_client();
|
||||
// 是否清除用户登录信息
|
||||
if(is_remove_user) {
|
||||
if (is_remove_user) {
|
||||
// 用户登录缓存
|
||||
uni.removeStorageSync(this.data.cache_user_login_key);
|
||||
// 用户信息缓存
|
||||
@@ -2363,7 +2359,7 @@
|
||||
uni.removeStorageSync(this.data.cache_app_star_tips_interval_time_key);
|
||||
|
||||
// 非小程序则两秒后回到首页
|
||||
this.showToast(i18n.t('shopxo-uniapp.app.'+((client_value == 'mp' || !is_remove_user) ? '0gwt7z' : '87yghj')), 'success');
|
||||
this.showToast(i18n.t('shopxo-uniapp.app.' + (client_value == 'mp' || !is_remove_user ? '0gwt7z' : '87yghj')), 'success');
|
||||
},
|
||||
|
||||
// 是否站点变灰
|
||||
@@ -2615,7 +2611,7 @@
|
||||
|
||||
// 底部菜单设置
|
||||
set_tabbar(theme) {
|
||||
if(this.data.is_use_native_tabbar == 1) {
|
||||
if (this.data.is_use_native_tabbar == 1) {
|
||||
// 当前主题
|
||||
if ((theme || null) == null) {
|
||||
theme = this.get_theme_value();
|
||||
@@ -2626,7 +2622,7 @@
|
||||
selectedColor: this.get_theme_color(theme),
|
||||
color: '#333',
|
||||
backgroundColor: '#fff',
|
||||
borderStyle: 'black'
|
||||
borderStyle: 'black',
|
||||
});
|
||||
|
||||
// 菜单
|
||||
@@ -2867,7 +2863,7 @@
|
||||
// 存在数据则改变状态值
|
||||
var key = this.data.cache_userlocation_key;
|
||||
var result = uni.getStorageSync(key) || null;
|
||||
if(result != null) {
|
||||
if (result != null) {
|
||||
result['status'] = 2;
|
||||
uni.setStorageSync(key, result);
|
||||
}
|
||||
@@ -2903,7 +2899,7 @@
|
||||
// 默认名称
|
||||
var default_name = i18n.t('shopxo-uniapp.app.4v6q86');
|
||||
// 位置选择失败的状态,名称和默认名称不一致则认为是成功的
|
||||
if(user_location.status == 3 && user_location.name != default_name) {
|
||||
if (user_location.status == 3 && user_location.name != default_name) {
|
||||
user_location.status = 1;
|
||||
}
|
||||
user_location['text'] = user_location.name || user_location.address || default_name;
|
||||
@@ -2915,10 +2911,10 @@
|
||||
// method 回调方法
|
||||
// is_force 强制获取位置
|
||||
get_user_location(object = null, method = null, is_force = false) {
|
||||
if(this.data.get_user_location_status == 1 || is_force) {
|
||||
if (this.data.get_user_location_status == 1 || is_force) {
|
||||
var cache_key = this.data.cache_userlocation_key;
|
||||
var result = uni.getStorageSync(cache_key) || null;
|
||||
if(result == null) {
|
||||
if (result == null) {
|
||||
// 当前对象
|
||||
var self = this;
|
||||
// 当前平台
|
||||
@@ -2954,14 +2950,14 @@
|
||||
// 是否可以读取位置权限
|
||||
var status = true;
|
||||
// 微信环境、必须先同意隐私权限后再弹出获取用户位置权限
|
||||
if(client_value == 'weixin' && !is_weixin_privacy) {
|
||||
if (client_value == 'weixin' && !is_weixin_privacy) {
|
||||
status = false;
|
||||
}
|
||||
// app环境、必须先初始化完成有网络后再弹出获取用户位置权限
|
||||
if((client_value == 'ios' || client_value == 'android') && !is_network) {
|
||||
if ((client_value == 'ios' || client_value == 'android') && !is_network) {
|
||||
status = false;
|
||||
}
|
||||
if(status) {
|
||||
if (status) {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
@@ -2976,7 +2972,7 @@
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method](address);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
clearInterval(self.data.get_user_location_timer);
|
||||
}
|
||||
@@ -3006,9 +3002,9 @@
|
||||
// 商品访问数据存储缓存
|
||||
goods_data_cache_handle(goods_id, goods_data = null) {
|
||||
var key = this.data.cache_goods_data_key;
|
||||
if((goods_data || null) == null) {
|
||||
if ((goods_data || null) == null) {
|
||||
var res = uni.getStorageSync(key) || null;
|
||||
return (res != null && res.id == goods_id) ? res : null;
|
||||
return res != null && res.id == goods_id ? res : null;
|
||||
} else {
|
||||
uni.setStorageSync(key, goods_data);
|
||||
}
|
||||
@@ -3023,39 +3019,31 @@
|
||||
// 当前页面地址
|
||||
var url = this.current_page(false);
|
||||
// 支付宝平台以下条件不增加标题
|
||||
if(client_value == 'alipay') {
|
||||
if (client_value == 'alipay') {
|
||||
// 自定义头页面
|
||||
var pages_always = [
|
||||
'pages/plugins/realstore/detail/detail',
|
||||
'pages/plugins/seckill/index/index',
|
||||
'pages/plugins/points/index/index',
|
||||
'pages/plugins/coupon/index/index',
|
||||
'pages/plugins/signin/detail/detail',
|
||||
'pages/plugins/membershiplevelvip/index/index',
|
||||
'pages/plugins/ask/index/index',
|
||||
];
|
||||
var pages_always = ['pages/plugins/realstore/detail/detail', 'pages/plugins/seckill/index/index', 'pages/plugins/points/index/index', 'pages/plugins/coupon/index/index', 'pages/plugins/signin/detail/detail', 'pages/plugins/membershiplevelvip/index/index', 'pages/plugins/ask/index/index'];
|
||||
// 当前tab页面
|
||||
if(this.is_system_tabbar_pages('/'+url) != -1 || pages_always.indexOf(url) != -1) {
|
||||
if (this.is_system_tabbar_pages('/' + url) != -1 || pages_always.indexOf(url) != -1) {
|
||||
value = '';
|
||||
}
|
||||
}
|
||||
// 还没有标题则根据页面自动处理
|
||||
if(value === null) {
|
||||
if (value === null) {
|
||||
// 解析处理key
|
||||
var arr = url.split('/');
|
||||
arr = arr.slice(1);
|
||||
arr = arr.slice(0, -1);
|
||||
var key = 'pages.'+arr.join('-');
|
||||
var key = 'pages.' + arr.join('-');
|
||||
// 读取语言
|
||||
var value = i18n.t(key);
|
||||
// 首页则读取当前应用名称
|
||||
if(this.app_tabbar_pages()[0] == '/'+url) {
|
||||
if (this.app_tabbar_pages()[0] == '/' + url) {
|
||||
value = this.get_application_title();
|
||||
}
|
||||
}
|
||||
// 设置标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: value || ''
|
||||
title: value || '',
|
||||
});
|
||||
},
|
||||
|
||||
@@ -3063,11 +3051,9 @@
|
||||
set_navigation_bar_color(is_white = null) {
|
||||
var color = '#000000';
|
||||
var bg_color = '#ffffff';
|
||||
var arr = [
|
||||
'pages/index/index',
|
||||
];
|
||||
var arr = ['pages/index/index'];
|
||||
var page = this.current_page(false);
|
||||
if(is_white === true || (is_white === null && arr.indexOf(page) != -1)) {
|
||||
if (is_white === true || (is_white === null && arr.indexOf(page) != -1)) {
|
||||
color = '#ffffff';
|
||||
bg_color = '#000000';
|
||||
}
|
||||
@@ -3080,13 +3066,12 @@
|
||||
// 底部浮动按钮样式处理
|
||||
bottom_fixed_style_handle() {
|
||||
var obj = this.get_page_object();
|
||||
if(obj != null) {
|
||||
if (obj != null) {
|
||||
// undefined值表示未定义则不处理
|
||||
var temp = obj.bottom_fixed_style == undefined ? ((obj.data || null) == null ? undefined : obj.data.bottom_fixed_style) : '';
|
||||
if(temp !== undefined && this.is_tabbar_pages()) {
|
||||
obj.$vm.setData(
|
||||
{
|
||||
bottom_fixed_style: 'bottom:'+(((this.app_system_tabbar_height_value()-8)*2)+20)+'rpx'
|
||||
if (temp !== undefined && this.is_tabbar_pages()) {
|
||||
obj.$vm.setData({
|
||||
bottom_fixed_style: 'bottom:' + ((this.app_system_tabbar_height_value() - 8) * 2 + 20) + 'rpx',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<component-popup :propShow="popup_view_pay_qrcode_is_show" propPosition="bottom" @onclose="popup_view_pay_qrcode_event_close">
|
||||
<view class="padding-top-xxxl padding-bottom-xxxl padding-left-xxxl padding-right-xxxl tc">
|
||||
<block v-if="(popup_view_pay_data || null) == null || (popup_view_pay_data.qrcode_url || null) == null || (popup_view_pay_data.name || null) == null || (popup_view_pay_data.order_no || null) == null">
|
||||
<text class="cr-grey">{{$t('payment.payment.973g2e')}}</text>
|
||||
<text class="cr-grey">{{ $t('payment.payment.973g2e') }}</text>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="fw-b text-size cr-base margin-bottom-sm">{{ popup_view_pay_data.name }}</view>
|
||||
@@ -12,7 +12,7 @@
|
||||
<view v-if="(popup_view_pay_data.msg || null) != null" class="cr-yellow margin-top-sm">{{ popup_view_pay_data.msg }}</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<view v-if="popup_view_pay_data.pay_url != null" class="margin-top-xl">
|
||||
<a :href="popup_view_pay_data.pay_url" target="_blank" class="dis-inline-block cr-green">{{$t('payment.payment.z3y296')}}</a>
|
||||
<a :href="popup_view_pay_data.pay_url" target="_blank" class="dis-inline-block cr-green">{{ $t('payment.payment.z3y296') }}</a>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</block>
|
||||
@@ -20,8 +20,7 @@
|
||||
</component-popup>
|
||||
<!-- 支付方式 popup -->
|
||||
<component-popup :propShow="is_show_payment_popup" propPosition="bottom" @onclose="payment_popup_event_close">
|
||||
<view class="poupon-title padding-main tc text-size-md pr">{{$t('payment.payment.iu792d')}}<iconfont name="icon-close-o" propClass="pa right-0 margin-right-main margin-top-xs" size="30rpx" color="#999" @tap="payment_popup_event_close"></iconfont>
|
||||
</view>
|
||||
<view class="poupon-title padding-main tc text-size-md pr">{{ $t('payment.payment.iu792d') }}<iconfont name="icon-close-o" propClass="pa right-0 margin-right-main margin-top-xs" size="30rpx" color="#999" @tap="payment_popup_event_close"></iconfont> </view>
|
||||
<view class="payment-price tc padding-top-sm padding-bottom-sm br-b">
|
||||
<text class="text-size-md">{{ propCurrencySymbol }}</text>
|
||||
{{ propPayPrice }}
|
||||
@@ -41,18 +40,18 @@
|
||||
</view>
|
||||
<view class="payment-submit">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="bg-main br-main cr-white round text-size" type="default" hover-class="none" @tap="popup_payment_event" :disabled="submit_disabled_status">{{$t('payment.payment.25r53g')}}</button>
|
||||
<button class="bg-main br-main cr-white round text-size" type="default" hover-class="none" @tap="popup_payment_event" :disabled="submit_disabled_status">{{ $t('payment.payment.25r53g') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="padding-top-xxxl padding-bottom-xxxl oh bg-white tc cr-grey">{{$t('payment.payment.058a46')}}</view>
|
||||
<view v-else class="padding-top-xxxl padding-bottom-xxxl oh bg-white tc cr-grey">{{ $t('payment.payment.058a46') }}</view>
|
||||
</component-popup>
|
||||
|
||||
<!-- 支付html展示 -->
|
||||
<component-popup :propShow="popup_view_pay_html_is_show" propPosition="bottom" @onclose="popup_view_pay_html_event_close">
|
||||
<view class="popup-pay-html-content padding-top-xxxl padding-bottom-xxxl padding-left-xxxl padding-right-xxxl tc">
|
||||
<block v-if="(popup_view_pay_data || null) == null">
|
||||
<text class="cr-grey">{{$t('payment.payment.973g2e')}}</text>
|
||||
<text class="cr-grey">{{ $t('payment.payment.973g2e') }}</text>
|
||||
</block>
|
||||
<block v-else>
|
||||
<mp-html :content="popup_view_pay_data" />
|
||||
@@ -63,10 +62,10 @@
|
||||
<!-- 支付中提示弹窗 -->
|
||||
<view v-if="payment_confirm_modal_status" class="payment-confirm-modal">
|
||||
<view class="content padding-xl margin-xxl tc bg-white border-radius-main">
|
||||
<view class="padding-vertical-xxxxl">{{$t('common.payment_in_text')}}</view>
|
||||
<view class="padding-vertical-xxxxl">{{ $t('common.payment_in_text') }}</view>
|
||||
<view class="margin-top-lg">
|
||||
<button type="default" size="mini" class="bg-white br-black cr-black text-size-sm round margin-right-xxxxl" data-type="0" @tap="payment_confirm_event">{{$t('common.not_have_name')}}</button>
|
||||
<button type="default" size="mini" class="bg-main br-main cr-white text-size-sm round margin-left-xxxxl" data-type="1" @tap="payment_confirm_event">{{$t('order.order.s8g966')}}</button>
|
||||
<button type="default" size="mini" class="bg-white br-black cr-black text-size-sm round margin-right-xxxxl" data-type="0" @tap="payment_confirm_event">{{ $t('common.not_have_name') }}</button>
|
||||
<button type="default" size="mini" class="bg-main br-main cr-white text-size-sm round margin-left-xxxxl" data-type="1" @tap="payment_confirm_event">{{ $t('order.order.s8g966') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -76,6 +75,9 @@
|
||||
const app = getApp();
|
||||
import base64 from '@/common/js/lib/base64.js';
|
||||
import componentPopup from '@/components/popup/popup';
|
||||
|
||||
import wx from 'weixin-js-sdk';
|
||||
|
||||
export default {
|
||||
name: 'pay',
|
||||
data() {
|
||||
@@ -227,7 +229,7 @@
|
||||
submit_disabled_status: bool,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
// 页面被展示
|
||||
created: function () {
|
||||
@@ -278,13 +280,13 @@
|
||||
// 支付方法
|
||||
pay_handle(order_id, payment_id = 0, payment_list = []) {
|
||||
// 没有指定支付方式则使用属性传过来的值
|
||||
if((payment_list || null) != null && payment_list.length > 0) {
|
||||
if ((payment_list || null) != null && payment_list.length > 0) {
|
||||
this.setData({
|
||||
payment_list: payment_list
|
||||
payment_list: payment_list,
|
||||
});
|
||||
}
|
||||
// 没有支付方式
|
||||
if((payment_id || 0) == 0) {
|
||||
if ((payment_id || 0) == 0) {
|
||||
this.pay_handle_event(order_id, payment_id);
|
||||
} else {
|
||||
// 循环匹配支付方式
|
||||
@@ -317,12 +319,12 @@
|
||||
pay_handle_event(order_id, payment_id = 0) {
|
||||
// 没有指定支付方式则不匹配支付标识
|
||||
var payment = null;
|
||||
if((payment_id || 0) != 0) {
|
||||
if ((payment_id || 0) != 0) {
|
||||
// #ifdef H5
|
||||
// 微信环境判断是否已有web_openid、不存在则不继续执行跳转到插件进行授权
|
||||
if (!app.globalData.is_user_weixin_web_openid(order_id, payment_id || this.payment_id, this.propToAppointPage)) {
|
||||
return false;
|
||||
}
|
||||
// if (!app.globalData.is_user_weixin_web_openid(order_id, payment_id || this.payment_id, this.propToAppointPage)) {
|
||||
// return false;
|
||||
// }
|
||||
// #endif
|
||||
// 支付方式
|
||||
for (var i in this.payment_list) {
|
||||
@@ -346,7 +348,7 @@
|
||||
var redirect_url = app.globalData.page_url_protocol(this.propToAppointPage || app.globalData.get_page_url(false));
|
||||
post_data['redirect_url'] = encodeURIComponent(base64.encode(redirect_url));
|
||||
// 存在支付标识、指定支付方式使用respond_url返回地址、移除重定向地址
|
||||
if(payment != null) {
|
||||
if (payment != null) {
|
||||
var respond_arr = ['PayPal', 'UniPayment'];
|
||||
if (respond_arr.indexOf(payment.payment) != -1) {
|
||||
post_data['respond_url'] = post_data['redirect_url'];
|
||||
@@ -357,19 +359,22 @@
|
||||
// 请求支付接口
|
||||
uni.showLoading({
|
||||
title: this.$t('payment.payment.e1f54e'),
|
||||
mask: true
|
||||
mask: true,
|
||||
});
|
||||
if (this.propPayUrl) {
|
||||
uni.request({
|
||||
url: this.propPayUrl,
|
||||
method: 'POST',
|
||||
data: post_data,
|
||||
data: {
|
||||
...post_data,
|
||||
wechat_open_id: localStorage.getItem('web_openid'),
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
pay_response_data: data || {}
|
||||
pay_response_data: data || {},
|
||||
});
|
||||
if (res.data.code == 0) {
|
||||
// 是否直接支付成功
|
||||
@@ -391,7 +396,7 @@
|
||||
// #endif
|
||||
// #ifdef MP-TOUTIAO
|
||||
// 头条是否非普通版本支持
|
||||
if(parseInt(data.data.pay_type || 0) == 1) {
|
||||
if (parseInt(data.data.pay_type || 0) == 1) {
|
||||
this.toutiao_transaction_pay_handle(this, data, order_id);
|
||||
} else {
|
||||
this.mp_pay_handle(this, data, order_id);
|
||||
@@ -462,23 +467,23 @@
|
||||
var arr = {
|
||||
Alipay: 'alipay',
|
||||
Weixin: 'wxpay',
|
||||
PayPal: 'paypal'
|
||||
}
|
||||
PayPal: 'paypal',
|
||||
};
|
||||
var pay_value = arr[data.payment.payment] || null;
|
||||
if(pay_value != null) {
|
||||
if (pay_value != null) {
|
||||
uni.getProvider({
|
||||
service: 'payment',
|
||||
success: function (res) {
|
||||
if(~res.provider.indexOf(pay_value)) {
|
||||
var pay_data = ((data.data.pay_data || null) == null) ? data.data : data.data.pay_data;
|
||||
if (~res.provider.indexOf(pay_value)) {
|
||||
var pay_data = (data.data.pay_data || null) == null ? data.data : data.data.pay_data;
|
||||
uni.requestPayment({
|
||||
provider: pay_value,
|
||||
orderInfo: pay_data,
|
||||
success: function (res) {
|
||||
// 是否需要回调捕获
|
||||
var call_back_url = data.data.call_back_url || null;
|
||||
if(call_back_url != null) {
|
||||
uni.request({url: call_back_url, method: 'GET'});
|
||||
if (call_back_url != null) {
|
||||
uni.request({ url: call_back_url, method: 'GET' });
|
||||
}
|
||||
|
||||
// 成功处理数据
|
||||
@@ -486,39 +491,39 @@
|
||||
},
|
||||
fail: function (err) {
|
||||
self.order_item_pay_fail_handle(data, order_id, self.$t('paytips.paytips.6y488i'));
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
app.globalData.showToast(data.payment.payment+self.$t('payment.payment.bv637f'));
|
||||
}
|
||||
app.globalData.showToast(data.payment.payment + self.$t('payment.payment.bv637f'));
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// 先清除定时任务
|
||||
if(self.open_pay_url_timer != null) {
|
||||
if (self.open_pay_url_timer != null) {
|
||||
clearTimeout(self.open_pay_url_timer);
|
||||
}
|
||||
// 显示加载层
|
||||
uni.showLoading({
|
||||
title: self.$t('common.loading_in_text'),
|
||||
mask: true
|
||||
mask: true,
|
||||
});
|
||||
// 设置打开url状态
|
||||
self.setData({
|
||||
open_pay_url_status: true
|
||||
open_pay_url_status: true,
|
||||
});
|
||||
// 打开url
|
||||
plus.runtime.openURL(data.data, function(error) {
|
||||
plus.runtime.openURL(data.data, function (error) {
|
||||
uni.hideLoading();
|
||||
// 打开url失败、并进入提示失败环节
|
||||
self.setData({
|
||||
open_pay_url_status: false
|
||||
open_pay_url_status: false,
|
||||
});
|
||||
self.order_item_pay_fail_handle(data, order_id, error.message+'('+error.code+')');
|
||||
self.order_item_pay_fail_handle(data, order_id, error.message + '(' + error.code + ')');
|
||||
});
|
||||
// 定时3秒后提示用户确认支付状态
|
||||
self.open_pay_url_timer = setTimeout(function() {
|
||||
if(self.open_pay_url_status) {
|
||||
self.open_pay_url_timer = setTimeout(function () {
|
||||
if (self.open_pay_url_status) {
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
content: self.$t('payment.payment.sdfs31'),
|
||||
@@ -553,7 +558,7 @@
|
||||
},
|
||||
// 头条小程序非普通交易支付处理
|
||||
toutiao_transaction_pay_handle(self, data, order_id) {
|
||||
if(!uni.canIUse('requestOrder') || !uni.canIUse('getOrderPayment')) {
|
||||
if (!uni.canIUse('requestOrder') || !uni.canIUse('getOrderPayment')) {
|
||||
app.globalData.showToast(self.$t('payment.payment.4dszme'));
|
||||
return false;
|
||||
}
|
||||
@@ -569,12 +574,12 @@
|
||||
},
|
||||
fail: (res) => {
|
||||
self.order_item_pay_fail_handle(data, order_id, self.$t('paytips.paytips.6y488i'));
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
app.globalData.showToast(res.errMsg+'('+res.errNo+')');
|
||||
}
|
||||
app.globalData.showToast(res.errMsg + '(' + res.errNo + ')');
|
||||
},
|
||||
});
|
||||
},
|
||||
// 小程序: 微信、支付宝、百度、头条、QQ
|
||||
@@ -596,7 +601,7 @@
|
||||
},
|
||||
fail(res) {
|
||||
app.globalData.showToast(self.$t('paytips.paytips.6y488i'));
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
uni.requestPayment({
|
||||
@@ -671,38 +676,58 @@
|
||||
// 微信jsapi
|
||||
if (data.payment.payment == 'Weixin' && (data.data.appId || null) != null && (data.data.timeStamp || null) != null && (data.data.nonceStr || null) != null && (data.data.package || null) != null && (data.data.signType || null) != null && (data.data.paySign || null) != null) {
|
||||
status = true;
|
||||
|
||||
function onBridgeReady() {
|
||||
WeixinJSBridge.invoke(
|
||||
'getBrandWCPayRequest',
|
||||
{
|
||||
appId: data.data.appId,
|
||||
timeStamp: data.data.timeStamp,
|
||||
// 调用微信支付接口
|
||||
wx.chooseWXPay({
|
||||
timestamp: data.data.timeStamp,
|
||||
nonceStr: data.data.nonceStr,
|
||||
package: data.data.package,
|
||||
signType: data.data.signType,
|
||||
paySign: data.data.paySign,
|
||||
},
|
||||
function (res) {
|
||||
if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
||||
// 数据设置
|
||||
success: (res) => {
|
||||
console.log('支付成功:', res);
|
||||
self.order_item_pay_success_handle(data, order_id);
|
||||
} else {
|
||||
self.order_item_pay_fail_handle(data, order_id, res.err_msg);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (typeof WeixinJSBridge == 'undefined') {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
|
||||
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
|
||||
}
|
||||
} else {
|
||||
onBridgeReady();
|
||||
}
|
||||
},
|
||||
cancel: (res) => {
|
||||
console.log('支付取消:', res);
|
||||
self.order_item_pay_fail_handle(data, order_id, res.errMsg);
|
||||
},
|
||||
fail: (res) => {
|
||||
console.error('支付失败:', res);
|
||||
self.order_item_pay_fail_handle(data, order_id, res.errMsg);
|
||||
},
|
||||
});
|
||||
|
||||
// function onBridgeReady() {
|
||||
// WeixinJSBridge.invoke(
|
||||
// 'getBrandWCPayRequest',
|
||||
// {
|
||||
// appId: data.data.appId,
|
||||
// timeStamp: data.data.timeStamp,
|
||||
// nonceStr: data.data.nonceStr,
|
||||
// package: data.data.package,
|
||||
// signType: data.data.signType,
|
||||
// paySign: data.data.paySign,
|
||||
// },
|
||||
// function (res) {
|
||||
// if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
||||
// // 数据设置
|
||||
// self.order_item_pay_success_handle(data, order_id);
|
||||
// } else {
|
||||
// self.order_item_pay_fail_handle(data, order_id, res.err_msg);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// if (typeof WeixinJSBridge == 'undefined') {
|
||||
// if (document.addEventListener) {
|
||||
// document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
|
||||
// } else if (document.attachEvent) {
|
||||
// document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
|
||||
// document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
|
||||
// }
|
||||
// } else {
|
||||
// onBridgeReady();
|
||||
// }
|
||||
}
|
||||
// 二维码展示
|
||||
if ((data.data.qrcode_url || null) != null && (data.data.name || null) != null && (data.data.order_no || null) != null) {
|
||||
@@ -785,7 +810,7 @@
|
||||
});
|
||||
clearInterval(this.pay_statuc_check_timer);
|
||||
// 回调处理
|
||||
if(parseInt(e.currentTarget.dataset.type || 0) == 1) {
|
||||
if (parseInt(e.currentTarget.dataset.type || 0) == 1) {
|
||||
this.order_item_pay_success_handle(this.pay_response_data, this.order_id);
|
||||
} else {
|
||||
this.order_item_pay_fail_handle(this.pay_response_data, this.order_id, this.$t('paytips.paytips.6y488i'));
|
||||
@@ -835,8 +860,8 @@
|
||||
to_fail_page_event(msg) {
|
||||
let to_fail_page = this.propToFailPage || null;
|
||||
if (to_fail_page != null) {
|
||||
let join = (to_fail_page.indexOf('?') == -1) ? '?' : '&';
|
||||
to_fail_page += join+'msg='+msg;
|
||||
let join = to_fail_page.indexOf('?') == -1 ? '?' : '&';
|
||||
to_fail_page += join + 'msg=' + msg;
|
||||
if (this.propIsFailAlert) {
|
||||
// 现金支付
|
||||
uni.showModal({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "ShopXO",
|
||||
"appid" : "__UNI__50E3C11",
|
||||
"appid" : "__UNI__F095115",
|
||||
"description" : "ShopXO开源商城、MIT协议、可商用、可二次开发、满足99%电商运营需求",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : 100,
|
||||
@@ -186,7 +186,8 @@
|
||||
}
|
||||
},
|
||||
"__usePrivacyCheck__" : true,
|
||||
"plugins" : {
|
||||
"plugins" : {}
|
||||
},
|
||||
// 腾讯地图路线规划插件(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a)
|
||||
// "routePlan" : {
|
||||
// "version" : "1.0.19",
|
||||
@@ -197,8 +198,6 @@
|
||||
// "version" : "1.3.5",
|
||||
// "provider" : "wx2b03c6e691cd7370"
|
||||
// }
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true,
|
||||
"appid" : "2021001173639600"
|
||||
@@ -245,15 +244,36 @@
|
||||
},
|
||||
"devServer" : {
|
||||
"https" : false,
|
||||
"port" : 8082
|
||||
"port" : 8082,
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
// "target": "http://192.168.1.43:7777/",
|
||||
"target" : "https://store.sxczgkj.com/",
|
||||
"changeOrigin" : "true",
|
||||
"pathRewrite" : {
|
||||
"^/api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"router" : {
|
||||
"mode" : "hash",
|
||||
"base" : "./"
|
||||
"mode" : "history",
|
||||
"base" : "/h5_store/"
|
||||
},
|
||||
"title" : "ShopXO",
|
||||
"title" : "czg_shop",
|
||||
"template" : "template.h5.html"
|
||||
},
|
||||
"app" : {
|
||||
"router" : {
|
||||
"mode" : "history"
|
||||
}
|
||||
},
|
||||
"vueVersion" : "2",
|
||||
"locale" : "auto"
|
||||
}
|
||||
// 匹配以 /api 开头的请求
|
||||
// target: 'https://test.invoice.sxczgkj.cn/', // 替换为你的后端 API 域名
|
||||
//192.168.1.43:7777/', // 替换为你的后端 API 域名
|
||||
// 允许跨域
|
||||
// 重写路径,去掉 /api 前缀
|
||||
|
||||
|
||||
21
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/LICENSE
generated
vendored
Normal file
21
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Yanxi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
36
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/README.md
generated
vendored
Normal file
36
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/README.md
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
微信官方 js-sdk
|
||||
----
|
||||
|
||||
说明: 仅将官方 js-sdk 发布到 npm,支持 CommonJS,便于 browserify, webpack 等直接使用,支持 TypeScript。
|
||||
|
||||
|
||||
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
|
||||
|
||||
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
|
||||
|
||||
安装:
|
||||
```shell
|
||||
npm install weixin-js-sdk
|
||||
```
|
||||
|
||||
使用:
|
||||
```javascript
|
||||
// commonjs
|
||||
var wx = require('weixin-js-sdk');
|
||||
|
||||
// es module
|
||||
import wx from 'weixin-js-sdk'
|
||||
```
|
||||
|
||||
### Old versions
|
||||
|
||||
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
|
||||
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
|
||||
|
||||
### 个人主页
|
||||
|
||||
* [https://yanxi123.com/](https://yanxi123.com/)
|
||||
|
||||
### 感谢
|
||||
|
||||
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)
|
||||
601
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/index.d.ts
generated
vendored
Normal file
601
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,601 @@
|
||||
// Type definitions for weixin jssdk 1.6.0
|
||||
// Project: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace wx {
|
||||
type ImageSizeType = "original" | "compressed";
|
||||
type ImageSourceType = "album" | "camera";
|
||||
type VideoSourceType = "album" | "camera";
|
||||
type ApiMethod =
|
||||
| "onMenuShareTimeline"
|
||||
| "onMenuShareAppMessage"
|
||||
| "onMenuShareQQ"
|
||||
| "onMenuShareWeibo"
|
||||
| "onMenuShareQZone"
|
||||
| "updateAppMessageShareData"
|
||||
| "updateTimelineShareData"
|
||||
| "startRecord"
|
||||
| "stopRecord"
|
||||
| "onVoiceRecordEnd"
|
||||
| "playVoice"
|
||||
| "pauseVoice"
|
||||
| "stopVoice"
|
||||
| "onVoicePlayEnd"
|
||||
| "uploadVoice"
|
||||
| "downloadVoice"
|
||||
| "chooseImage"
|
||||
| "previewImage"
|
||||
| "uploadImage"
|
||||
| "downloadImage"
|
||||
| "translateVoice"
|
||||
| "getNetworkType"
|
||||
| "openLocation"
|
||||
| "getLocation"
|
||||
| "hideOptionMenu"
|
||||
| "showOptionMenu"
|
||||
| "hideMenuItems"
|
||||
| "showMenuItems"
|
||||
| "hideAllNonBaseMenuItem"
|
||||
| "showAllNonBaseMenuItem"
|
||||
| "closeWindow"
|
||||
| "scanQRCode"
|
||||
| "chooseWXPay"
|
||||
| "openProductSpecificView"
|
||||
| "addCard"
|
||||
| "chooseCard"
|
||||
| "openCard";
|
||||
// 所有JS接口列表
|
||||
type jsApiList = ApiMethod[];
|
||||
|
||||
// 开放标签列表
|
||||
// https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html
|
||||
type openTag = "wx-open-launch-weapp" | "wx-open-launch-app" | "wx-open-subscribe" | "wx-open-audio"
|
||||
type openTagList = openTag[];
|
||||
|
||||
// 所有菜单项列表
|
||||
// 基本类
|
||||
type menuBase =
|
||||
| "menuItem:exposeArticle" // 举报
|
||||
| "menuItem:setFont" // 调整字体
|
||||
| "menuItem:dayMode" // 日间模式
|
||||
| "menuItem:nightMode" // 夜间模式
|
||||
| "menuItem:refresh" // 刷新
|
||||
| "menuItem:profile" // 查看公众号(已添加)
|
||||
| "menuItem:addContact"; // 查看公众号(未添加)
|
||||
// 传播类
|
||||
type menuShare =
|
||||
| "menuItem:share:appMessage" // 发送给朋友
|
||||
| "menuItem:share:timeline" // 分享到朋友圈
|
||||
| "menuItem:share:qq" // 分享到QQ
|
||||
| "menuItem:share:weiboApp" // 分享到Weibo
|
||||
| "menuItem:favorite" // 收藏
|
||||
| "menuItem:share:facebook" // 分享到FB
|
||||
| "menuItem:share:QZone"; // 分享到 QQ 空间
|
||||
|
||||
// 保护类
|
||||
type menuProtected =
|
||||
| "menuItem:editTag" // 编辑标签
|
||||
| "menuItem:delete" // 删除
|
||||
| "menuItem:copyUrl" // 复制链接
|
||||
| "menuItem:originPage" // 原网页
|
||||
| "menuItem:readMode" // 阅读模式
|
||||
| "menuItem:openWithQQBrowser" // 在QQ浏览器中打开
|
||||
| "menuItem:openWithSafari" // 在Safari中打开
|
||||
| "menuItem:share:email" // 邮件
|
||||
| "menuItem:share:brand"; // 一些特殊公众号
|
||||
|
||||
type menuList = Array<menuBase | menuProtected | menuShare>;
|
||||
|
||||
function config(conf: {
|
||||
debug?: boolean; // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||
appId: string; // 必填,公众号的唯一标识
|
||||
timestamp: number; // 必填,生成签名的时间戳
|
||||
nonceStr: string; // 必填,生成签名的随机串
|
||||
signature: string; // 必填,签名,见附录1
|
||||
jsApiList?: jsApiList; // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
||||
openTagList?: openTagList;
|
||||
}): void;
|
||||
|
||||
interface Resouce {
|
||||
localId: string;
|
||||
}
|
||||
interface BaseParams {
|
||||
success?(...args: any[]): void;
|
||||
/** 接口调用失败的回调函数 */
|
||||
fail?(...args: any[]): void;
|
||||
/** 接口取消调用的回调函数 */
|
||||
cancel?(...args: any[]): void;
|
||||
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
||||
complete?(...args: any[]): void;
|
||||
}
|
||||
function ready(fn: () => void): void;
|
||||
function error(fn: (err: { errMsg: string }) => void): void;
|
||||
|
||||
interface IcheckJsApi extends BaseParams {
|
||||
jsApiList: jsApiList; // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
||||
// 以键值对的形式返回,可用的api值true,不可用为false
|
||||
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
||||
success(res: {
|
||||
checkResult: { [api: string]: boolean };
|
||||
errMsg: string;
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* 判断当前客户端版本是否支持指定JS接口
|
||||
* 备注:checkJsApi接口是客户端6.0.2新引入的一个预留接口,第一期开放的接口均可不使用checkJsApi来检测。
|
||||
*/
|
||||
function checkJsApi(params: IcheckJsApi): void;
|
||||
|
||||
interface IonMenuShareTimeline extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/*=============================基础接口================================*/
|
||||
/**
|
||||
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareTimeline(params: IonMenuShareTimeline): void;
|
||||
|
||||
interface IonMenuShareAppMessage extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
type?: "music" | "video或link" | "link"; // 分享类型,music、video或link,不填默认为link
|
||||
dataUrl?: string; // 如果type是music或video,则要提供数据链接,默认为空
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareAppMessage(params: IonMenuShareAppMessage): void;
|
||||
|
||||
interface IonMenuShareQQ extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到QQ”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareQQ(params: IonMenuShareQQ): void;
|
||||
|
||||
interface IonMenuShareWeibo extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareWeibo(params: IonMenuShareWeibo): void;
|
||||
|
||||
interface IonMenuShareQZone extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareQZone(params: IonMenuShareQZone): void;
|
||||
|
||||
interface IupdateAppMessageShareData extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享给朋友”及“分享到QQ”按钮点击状态及自定义分享内容接口(新)
|
||||
*/
|
||||
function updateAppMessageShareData(params: IupdateAppMessageShareData): void;
|
||||
|
||||
interface IupdateTimelineShareData extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到朋友圈”及“分享到QQ空间”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function updateTimelineShareData(params: IupdateTimelineShareData): void;
|
||||
/*=============================基础接口================================*/
|
||||
|
||||
/*=============================图像接口================================*/
|
||||
interface IchooseImage extends BaseParams {
|
||||
/** 最多可以选择的图片张数,默认9 */
|
||||
count?: number;
|
||||
/** original 原图,compressed 压缩图,默认二者都有 */
|
||||
sizeType?: ImageSizeType[];
|
||||
/** album 从相册选图,camera 使用相机,默认二者都有 */
|
||||
sourceType?: ImageSourceType[];
|
||||
/** 成功则返回图片的本地文件路径列表 tempFilePaths */
|
||||
success(res: {
|
||||
sourceType: string; // weixin album camera
|
||||
localIds: string[];
|
||||
errMsg: string;
|
||||
}): void;
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 从本地相册选择图片或使用相机拍照。
|
||||
*/
|
||||
function chooseImage(params: IchooseImage): void;
|
||||
|
||||
interface IpreviewImage extends BaseParams {
|
||||
current: string; // 当前显示图片的http链接
|
||||
urls: string[]; // 需要预览的图片http链接列表
|
||||
}
|
||||
/**
|
||||
* 预览图片接口
|
||||
*/
|
||||
function previewImage(params: IpreviewImage): void;
|
||||
|
||||
interface IuploadResource extends BaseParams {
|
||||
localId: string; // 需要上传的图片的本地ID,由chooseImage接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
// 返回图片的服务器端ID
|
||||
success(res: { serverId: string }): void;
|
||||
}
|
||||
/**
|
||||
* 上传图片接口
|
||||
*/
|
||||
function uploadImage(params: IuploadResource): void;
|
||||
|
||||
interface IdownloadResource extends BaseParams {
|
||||
serverId: string; // 需要下载的图片的服务器端ID,由uploadImage接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
// 返回图片下载后的本地ID
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 下载图片接口
|
||||
*/
|
||||
function downloadImage(params: IdownloadResource): void;
|
||||
|
||||
interface IgetLocalImgData extends BaseParams {
|
||||
localId: string; // 图片的localID
|
||||
// localData是图片的base64数据,可以用img标签显示
|
||||
success(res: { localData: string }): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地图片接口
|
||||
*/
|
||||
function getLocalImgData(params: IgetLocalImgData): void;
|
||||
/*=============================图像接口================================*/
|
||||
/*=============================音频接口================================*/
|
||||
/**
|
||||
* 开始录音接口
|
||||
*/
|
||||
function startRecord(): void;
|
||||
|
||||
interface IstopRecord extends BaseParams {
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 停止录音接口
|
||||
*/
|
||||
function stopRecord(params: IstopRecord): void;
|
||||
|
||||
interface IonVoiceRecordEnd extends BaseParams {
|
||||
// 录音时间超过一分钟没有停止的时候会执行 complete 回调
|
||||
complete(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 监听录音自动停止接口
|
||||
*/
|
||||
function onVoiceRecordEnd(params: IonVoiceRecordEnd): void;
|
||||
|
||||
interface IplaypausestopVoice extends BaseParams {
|
||||
localId: string; // 需要播放的音频的本地ID,由stopRecord接口获得
|
||||
}
|
||||
/**
|
||||
* 播放语音接口
|
||||
*/
|
||||
function playVoice(params: IplaypausestopVoice): void;
|
||||
|
||||
/**
|
||||
* 暂停播放接口
|
||||
*/
|
||||
function pauseVoice(params: IplaypausestopVoice): void;
|
||||
/**
|
||||
* 停止播放接口
|
||||
*/
|
||||
function stopVoice(params: IplaypausestopVoice): void;
|
||||
|
||||
interface IonVoicePlayEnd extends BaseParams {
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 监听语音播放完毕接口
|
||||
*/
|
||||
function onVoicePlayEnd(params: IonVoicePlayEnd): void;
|
||||
/**
|
||||
* 上传语音接口
|
||||
* 备注:上传语音有效期3天,可用微信多媒体接口下载语音到自己的服务器
|
||||
* ,此处获得的 serverId 即 media_id,参考文档
|
||||
* ../12 / 58bfcfabbd501c7cd77c19bd9cfa8354.html
|
||||
* 目前多媒体文件下载接口的频率限制为10000次/ 天,
|
||||
* 如需要调高频率,请邮件weixin - open@qq.com,
|
||||
* 邮件主题为【申请多媒体接口调用量】,请对你的项目进行简单描述,
|
||||
* 附上产品体验链接,并对用户量和使用量进行说明。
|
||||
*/
|
||||
function uploadVoice(params: IuploadResource): void;
|
||||
/**
|
||||
* 下载语音接口
|
||||
*/
|
||||
function downloadVoice(params: IdownloadResource): void;
|
||||
/*=============================音频接口================================*/
|
||||
/*=============================智能接口================================*/
|
||||
|
||||
interface ItranslateVoice extends BaseParams {
|
||||
localId: string; // 需要识别的音频的本地Id,由录音相关接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
success(res: { translateResult: string }): void;
|
||||
}
|
||||
/**
|
||||
* 识别音频并返回识别结果接口
|
||||
*/
|
||||
function translateVoice(params: ItranslateVoice): void;
|
||||
|
||||
/*=============================智能接口================================*/
|
||||
|
||||
/*=============================设备信息================================*/
|
||||
type networkType = "2g" | "3g" | "4g" | "wifi";
|
||||
interface IgetNetworkType extends BaseParams {
|
||||
success(res: { networkType: networkType }): void;
|
||||
}
|
||||
/**
|
||||
* 获取网络状态接口
|
||||
*/
|
||||
function getNetworkType(params: IgetNetworkType): void;
|
||||
/*=============================设备信息================================*/
|
||||
|
||||
/*=============================地理位置================================*/
|
||||
interface IopenLocation extends BaseParams {
|
||||
latitude: number; // 纬度,浮点数,范围为90 ~ -90
|
||||
longitude: number; // 经度,浮点数,范围为180 ~ -180。
|
||||
name: string; // 位置名
|
||||
address: string; // 地址详情说明
|
||||
scale: number; // 地图缩放级别,整形值,范围从1~28。默认为最大
|
||||
infoUrl: string; // 在查看位置界面底部显示的超链接,可点击跳转
|
||||
}
|
||||
/**
|
||||
* 使用微信内置地图查看位置接口
|
||||
*/
|
||||
function openLocation(params: IopenLocation): void;
|
||||
|
||||
interface IgetLocation extends BaseParams {
|
||||
type: "wgs84" | "gcj02"; // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||
success(res: {
|
||||
latitude: number; // 纬度,浮点数,范围为90 ~ -90
|
||||
longitude: number; // 经度,浮点数,范围为180 ~ -180。
|
||||
speed: number; // 速度,以米/每秒计
|
||||
accuracy: number; // 位置精度
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* 获取地理位置接口
|
||||
*/
|
||||
function getLocation(params: IgetLocation): void;
|
||||
/*=============================地理位置================================*/
|
||||
/*=============================摇一摇周边================================*/
|
||||
interface IstartSearchBeacons extends BaseParams {
|
||||
ticket: string; // 摇周边的业务ticket, 系统自动添加在摇出来的页面链接后面
|
||||
// 开启查找完成后的回调函数
|
||||
complete(argv: any): void;
|
||||
}
|
||||
/**
|
||||
* 开启查找周边ibeacon设备接口
|
||||
* 备注:如需接入摇一摇周边功能,请参考:申请开通摇一摇周边
|
||||
*/
|
||||
function startSearchBeacons(params: IstartSearchBeacons): void;
|
||||
|
||||
interface IstopSearchBeacons extends BaseParams {
|
||||
// 关闭查找完成后的回调函数
|
||||
complete(res: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭查找周边ibeacon设备接口
|
||||
*/
|
||||
function stopSearchBeacons(params: IstopSearchBeacons): void;
|
||||
|
||||
interface IonSearchBeacons extends BaseParams {
|
||||
// 回调函数,可以数组形式取得该商家注册的在周边的相关设备列表
|
||||
complete(argv: any): void;
|
||||
}
|
||||
/**
|
||||
* 监听周边ibeacon设备接口
|
||||
*/
|
||||
function onSearchBeacons(params: IonSearchBeacons): void;
|
||||
/*=============================摇一摇周边================================*/
|
||||
/*=============================界面操作================================*/
|
||||
|
||||
/**
|
||||
* 隐藏右上角菜单接口
|
||||
*/
|
||||
function hideOptionMenu(): void;
|
||||
|
||||
/**
|
||||
* 显示右上角菜单接口
|
||||
*/
|
||||
function showOptionMenu(): void;
|
||||
|
||||
/**
|
||||
* 关闭当前网页窗口接口
|
||||
*/
|
||||
function closeWindow(): void;
|
||||
|
||||
interface IhideMenuItems extends BaseParams {
|
||||
menuList: Array<menuProtected | menuShare>; // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
|
||||
}
|
||||
/**
|
||||
* 批量隐藏功能按钮接口
|
||||
*/
|
||||
function hideMenuItems(params: IhideMenuItems): void;
|
||||
|
||||
interface IshowMenuItems extends BaseParams {
|
||||
menuList: menuList; // 要显示的菜单项,所有menu项见附录3
|
||||
}
|
||||
/**
|
||||
* 批量显示功能按钮接口
|
||||
*/
|
||||
function showMenuItems(params: IshowMenuItems): void;
|
||||
|
||||
/**
|
||||
* 隐藏所有非基础按钮接口
|
||||
* “基本类”按钮详见附录3
|
||||
*/
|
||||
function hideAllNonBaseMenuItem(): void;
|
||||
|
||||
/**
|
||||
* 显示所有功能按钮接口
|
||||
*/
|
||||
function showAllNonBaseMenuItem(): void;
|
||||
/*=============================界面操作================================*/
|
||||
/*=============================微信扫一扫================================*/
|
||||
|
||||
type scanType = "qrCode" | "barCode";
|
||||
|
||||
interface IscanQRCode extends BaseParams {
|
||||
needResult: 0 | 1; // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
||||
scanType: scanType[]; // 可以指定扫二维码还是一维码,默认二者都有
|
||||
// 当needResult 为 1 时,扫码返回的结果
|
||||
success(res: { resultStr: string }): void;
|
||||
}
|
||||
/**
|
||||
* 调起微信扫一扫接口
|
||||
*/
|
||||
function scanQRCode(params: IscanQRCode): void;
|
||||
/*=============================微信扫一扫================================*/
|
||||
/*=============================微信小店================================*/
|
||||
|
||||
interface IopenProductSpecificView extends BaseParams {
|
||||
productId: string; // 商品id
|
||||
viewType: "0" | "1" | "2"; // 0.默认值,普通商品详情页1.扫一扫商品详情页2.小店商品详情页
|
||||
}
|
||||
/**
|
||||
* 跳转微信商品页接口
|
||||
*/
|
||||
function openProductSpecificView(params: IopenProductSpecificView): void;
|
||||
/*=============================微信卡券================================*/
|
||||
|
||||
interface IchooseCard extends BaseParams {
|
||||
shopId: string; // 门店Id
|
||||
cardType: string; // 卡券类型
|
||||
cardId: string; // 卡券Id
|
||||
timestamp: number; // 卡券签名时间戳
|
||||
nonceStr: string; // 卡券签名随机串
|
||||
signType: string; // 签名方式,默认'SHA1'
|
||||
cardSign: string; // 卡券签名
|
||||
success(res: { cardList: string[] }): void;
|
||||
}
|
||||
/**
|
||||
* 拉取适用卡券列表并获取用户选择信息
|
||||
*/
|
||||
function chooseCard(params: IchooseCard): void;
|
||||
|
||||
interface IaddCard extends BaseParams {
|
||||
cardList: Array<{
|
||||
cardId: string;
|
||||
cardExt: string;
|
||||
}>; // 需要添加的卡券列表
|
||||
success(res: { cardList: string[] }): void;
|
||||
}
|
||||
/**
|
||||
* 批量添加卡券接口
|
||||
*/
|
||||
function addCard(): void;
|
||||
|
||||
interface IopenCard extends BaseParams {
|
||||
cardList: Array<{
|
||||
cardId: string;
|
||||
code: string;
|
||||
}>; // 需要打开的卡券列表
|
||||
}
|
||||
/**
|
||||
* 查看微信卡包中的卡券接口
|
||||
*/
|
||||
function openCard(params: IopenCard): void;
|
||||
|
||||
interface IconsumeAndShareCard extends BaseParams {
|
||||
cardId: string;
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* 核销后再次赠送卡券接口
|
||||
*/
|
||||
function consumeAndShareCard(params: IconsumeAndShareCard): void;
|
||||
/*=============================微信卡券================================*/
|
||||
/*=============================微信支付================================*/
|
||||
|
||||
interface IchooseWXPay extends BaseParams {
|
||||
timestamp: number; // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
||||
nonceStr: string; // 支付签名随机串,不长于 32 位
|
||||
package: string; // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
||||
signType: string; // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
||||
paySign: string; // 支付签名
|
||||
// 支付成功后的回调函数
|
||||
success(res: any): void;
|
||||
}
|
||||
/**
|
||||
* 发起一个微信支付请求
|
||||
*/
|
||||
function chooseWXPay(params: IchooseWXPay): void;
|
||||
/*=============================微信支付================================*/
|
||||
/*=============================微信小程序==============================*/
|
||||
interface miniProgramMethodsParams extends BaseParams {
|
||||
url: string;
|
||||
}
|
||||
interface miniProgramMethods {
|
||||
navigateTo(params: miniProgramMethodsParams): void;
|
||||
navigateBack(params: miniProgramMethodsParams): void;
|
||||
switchTab(params: miniProgramMethodsParams): void;
|
||||
reLaunch(params: miniProgramMethodsParams): void;
|
||||
redirectTo(params: miniProgramMethodsParams): void;
|
||||
postMessage(params: { data: any }): void;
|
||||
getEnv(fn: (res: any) => void): void;
|
||||
}
|
||||
const miniProgram: miniProgramMethods;
|
||||
/*=============================微信小程序==============================*/
|
||||
}
|
||||
declare function wx(): void;
|
||||
/*=============================微信内全局变量==============================*/
|
||||
declare global {
|
||||
interface Window {
|
||||
WeixinJSBridge: any;
|
||||
__wxjs_environment: any;
|
||||
}
|
||||
const WeixinJSBridge: any;
|
||||
}
|
||||
export default wx;
|
||||
891
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/index.js
generated
vendored
Normal file
891
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/index.js
generated
vendored
Normal file
@@ -0,0 +1,891 @@
|
||||
!(function (e, n) {
|
||||
module.exports = n(e);
|
||||
})(typeof window === "object" && window, function (r, e) {
|
||||
if (!r) {
|
||||
console.warn("can't use weixin-js-sdk in server side");
|
||||
return;
|
||||
}
|
||||
var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
|
||||
if (!r.jWeixin)
|
||||
return (
|
||||
(a = {
|
||||
config: "preVerifyJSAPI",
|
||||
onMenuShareTimeline: "menu:share:timeline",
|
||||
onMenuShareAppMessage: "menu:share:appmessage",
|
||||
onMenuShareQQ: "menu:share:qq",
|
||||
onMenuShareWeibo: "menu:share:weiboApp",
|
||||
onMenuShareQZone: "menu:share:QZone",
|
||||
previewImage: "imagePreview",
|
||||
getLocation: "geoLocation",
|
||||
openProductSpecificView: "openProductViewWithPid",
|
||||
addCard: "batchAddCard",
|
||||
openCard: "batchViewCard",
|
||||
chooseWXPay: "getBrandWCPayRequest",
|
||||
openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
|
||||
startSearchBeacons: "startMonitoringBeacons",
|
||||
stopSearchBeacons: "stopMonitoringBeacons",
|
||||
onSearchBeacons: "onBeaconsInRange",
|
||||
consumeAndShareCard: "consumedShareCard",
|
||||
openAddress: "editAddress",
|
||||
}),
|
||||
(c = (function () {
|
||||
var e,
|
||||
n = {};
|
||||
for (e in a) n[a[e]] = e;
|
||||
return n;
|
||||
})()),
|
||||
(n = r.document),
|
||||
(i = n.title),
|
||||
(t = navigator.userAgent.toLowerCase()),
|
||||
(f = navigator.platform.toLowerCase()),
|
||||
(o = !(!f.match("mac") && !f.match("win"))),
|
||||
(s = -1 != t.indexOf("wxdebugger")),
|
||||
(d = -1 != t.indexOf("micromessenger")),
|
||||
(l = -1 != t.indexOf("android")),
|
||||
(u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")),
|
||||
(p = (f =
|
||||
t.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
|
||||
t.match(/micromessenger\/(\d+\.\d+)/))
|
||||
? f[1]
|
||||
: ""),
|
||||
(m = {
|
||||
initStartTime: L(),
|
||||
initEndTime: 0,
|
||||
preVerifyStartTime: 0,
|
||||
preVerifyEndTime: 0,
|
||||
}),
|
||||
(g = {
|
||||
version: 1,
|
||||
appId: "",
|
||||
initTime: 0,
|
||||
preVerifyTime: 0,
|
||||
networkType: "",
|
||||
isPreVerifyOk: 1,
|
||||
systemType: u ? 1 : l ? 2 : -1,
|
||||
clientVersion: p,
|
||||
url: encodeURIComponent(location.href),
|
||||
}),
|
||||
(h = {}),
|
||||
(S = { _completes: [] }),
|
||||
(y = { state: 0, data: {} }),
|
||||
O(function () {
|
||||
m.initEndTime = L();
|
||||
}),
|
||||
(I = !1),
|
||||
(v = []),
|
||||
(_ = {
|
||||
config: function (e) {
|
||||
C("config", (h = e));
|
||||
var o = !1 !== h.check;
|
||||
O(function () {
|
||||
if (o)
|
||||
k(
|
||||
a.config,
|
||||
{
|
||||
verifyJsApiList: A(h.jsApiList),
|
||||
verifyOpenTagList: A(h.openTagList),
|
||||
},
|
||||
((S._complete = function (e) {
|
||||
(m.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
|
||||
}),
|
||||
(S.success = function (e) {
|
||||
g.isPreVerifyOk = 0;
|
||||
}),
|
||||
(S.fail = function (e) {
|
||||
S._fail ? S._fail(e) : (y.state = -1);
|
||||
}),
|
||||
(t = S._completes).push(function () {
|
||||
B();
|
||||
}),
|
||||
(S.complete = function (e) {
|
||||
for (var n = 0, i = t.length; n < i; ++n) t[n]();
|
||||
S._completes = [];
|
||||
}),
|
||||
S)
|
||||
),
|
||||
(m.preVerifyStartTime = L());
|
||||
else {
|
||||
y.state = 1;
|
||||
for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
|
||||
e[n]();
|
||||
S._completes = [];
|
||||
}
|
||||
var t;
|
||||
}),
|
||||
_.invoke ||
|
||||
((_.invoke = function (e, n, i) {
|
||||
r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i);
|
||||
}),
|
||||
(_.on = function (e, n) {
|
||||
r.WeixinJSBridge && WeixinJSBridge.on(e, n);
|
||||
}));
|
||||
},
|
||||
ready: function (e) {
|
||||
(0 != y.state || (S._completes.push(e), !d && h.debug)) && e();
|
||||
},
|
||||
error: function (e) {
|
||||
p < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
|
||||
},
|
||||
checkJsApi: function (e) {
|
||||
k(
|
||||
"checkJsApi",
|
||||
{ jsApiList: A(e.jsApiList) },
|
||||
((e._complete = function (e) {
|
||||
l && (i = e.checkResult) && (e.checkResult = JSON.parse(i));
|
||||
var n,
|
||||
i = e,
|
||||
t = i.checkResult;
|
||||
for (n in t) {
|
||||
var o = c[n];
|
||||
o && ((t[o] = t[n]), delete t[n]);
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
onMenuShareTimeline: function (e) {
|
||||
M(
|
||||
a.onMenuShareTimeline,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareTimeline",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.title || i,
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
type: e.type || "link",
|
||||
data_url: e.dataUrl || "",
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareAppMessage: function (n) {
|
||||
M(
|
||||
a.onMenuShareAppMessage,
|
||||
{
|
||||
complete: function (e) {
|
||||
"favorite" === e.scene
|
||||
? k("sendAppMessage", {
|
||||
title: n.title || i,
|
||||
desc: n.desc || "",
|
||||
link: n.link || location.href,
|
||||
img_url: n.imgUrl || "",
|
||||
type: n.type || "link",
|
||||
data_url: n.dataUrl || "",
|
||||
})
|
||||
: k(
|
||||
"sendAppMessage",
|
||||
{
|
||||
title: n.title || i,
|
||||
desc: n.desc || "",
|
||||
link: n.link || location.href,
|
||||
img_url: n.imgUrl || "",
|
||||
type: n.type || "link",
|
||||
data_url: n.dataUrl || "",
|
||||
},
|
||||
n
|
||||
);
|
||||
},
|
||||
},
|
||||
n
|
||||
);
|
||||
},
|
||||
onMenuShareQQ: function (e) {
|
||||
M(
|
||||
a.onMenuShareQQ,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareQQ",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareWeibo: function (e) {
|
||||
M(
|
||||
a.onMenuShareWeibo,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareWeiboApp",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareQZone: function (e) {
|
||||
M(
|
||||
a.onMenuShareQZone,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareQZone",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
updateTimelineShareData: function (e) {
|
||||
k(
|
||||
"updateTimelineShareData",
|
||||
{ title: e.title, link: e.link, imgUrl: e.imgUrl },
|
||||
e
|
||||
);
|
||||
},
|
||||
updateAppMessageShareData: function (e) {
|
||||
k(
|
||||
"updateAppMessageShareData",
|
||||
{ title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
|
||||
e
|
||||
);
|
||||
},
|
||||
startRecord: function (e) {
|
||||
k("startRecord", {}, e);
|
||||
},
|
||||
stopRecord: function (e) {
|
||||
k("stopRecord", {}, e);
|
||||
},
|
||||
onVoiceRecordEnd: function (e) {
|
||||
M("onVoiceRecordEnd", e);
|
||||
},
|
||||
playVoice: function (e) {
|
||||
k("playVoice", { localId: e.localId }, e);
|
||||
},
|
||||
pauseVoice: function (e) {
|
||||
k("pauseVoice", { localId: e.localId }, e);
|
||||
},
|
||||
stopVoice: function (e) {
|
||||
k("stopVoice", { localId: e.localId }, e);
|
||||
},
|
||||
onVoicePlayEnd: function (e) {
|
||||
M("onVoicePlayEnd", e);
|
||||
},
|
||||
uploadVoice: function (e) {
|
||||
k(
|
||||
"uploadVoice",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
downloadVoice: function (e) {
|
||||
k(
|
||||
"downloadVoice",
|
||||
{
|
||||
serverId: e.serverId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
translateVoice: function (e) {
|
||||
k(
|
||||
"translateVoice",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
chooseImage: function (e) {
|
||||
k(
|
||||
"chooseImage",
|
||||
{
|
||||
scene: "1|2",
|
||||
count: e.count || 9,
|
||||
sizeType: e.sizeType || ["original", "compressed"],
|
||||
sourceType: e.sourceType || ["album", "camera"],
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
if (l) {
|
||||
var n = e.localIds;
|
||||
try {
|
||||
n && (e.localIds = JSON.parse(n));
|
||||
} catch (e) {}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
getLocation: function (e) {
|
||||
(e = e || {}),
|
||||
k(
|
||||
a.getLocation,
|
||||
{ type: e.type || "wgs84" },
|
||||
((e._complete = function (e) {
|
||||
delete e.type;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
previewImage: function (e) {
|
||||
k(a.previewImage, { current: e.current, urls: e.urls }, e);
|
||||
},
|
||||
uploadImage: function (e) {
|
||||
k(
|
||||
"uploadImage",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
downloadImage: function (e) {
|
||||
k(
|
||||
"downloadImage",
|
||||
{
|
||||
serverId: e.serverId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
getLocalImgData: function (e) {
|
||||
!1 === I
|
||||
? ((I = !0),
|
||||
k(
|
||||
"getLocalImgData",
|
||||
{ localId: e.localId },
|
||||
((e._complete = function (e) {
|
||||
var n;
|
||||
(I = !1),
|
||||
0 < v.length && ((n = v.shift()), wx.getLocalImgData(n));
|
||||
}),
|
||||
e)
|
||||
))
|
||||
: v.push(e);
|
||||
},
|
||||
getNetworkType: function (e) {
|
||||
k(
|
||||
"getNetworkType",
|
||||
{},
|
||||
((e._complete = function (e) {
|
||||
var n = e,
|
||||
e = n.errMsg,
|
||||
i = ((n.errMsg = "getNetworkType:ok"), n.subtype);
|
||||
if ((delete n.subtype, i)) n.networkType = i;
|
||||
else {
|
||||
var i = e.indexOf(":"),
|
||||
t = e.substring(i + 1);
|
||||
switch (t) {
|
||||
case "wifi":
|
||||
case "edge":
|
||||
case "wwan":
|
||||
n.networkType = t;
|
||||
break;
|
||||
default:
|
||||
n.errMsg = "getNetworkType:fail";
|
||||
}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openLocation: function (e) {
|
||||
k(
|
||||
"openLocation",
|
||||
{
|
||||
latitude: e.latitude,
|
||||
longitude: e.longitude,
|
||||
name: e.name || "",
|
||||
address: e.address || "",
|
||||
scale: e.scale || 28,
|
||||
infoUrl: e.infoUrl || "",
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
hideOptionMenu: function (e) {
|
||||
k("hideOptionMenu", {}, e);
|
||||
},
|
||||
showOptionMenu: function (e) {
|
||||
k("showOptionMenu", {}, e);
|
||||
},
|
||||
closeWindow: function (e) {
|
||||
k("closeWindow", {}, (e = e || {}));
|
||||
},
|
||||
hideMenuItems: function (e) {
|
||||
k("hideMenuItems", { menuList: e.menuList }, e);
|
||||
},
|
||||
showMenuItems: function (e) {
|
||||
k("showMenuItems", { menuList: e.menuList }, e);
|
||||
},
|
||||
hideAllNonBaseMenuItem: function (e) {
|
||||
k("hideAllNonBaseMenuItem", {}, e);
|
||||
},
|
||||
showAllNonBaseMenuItem: function (e) {
|
||||
k("showAllNonBaseMenuItem", {}, e);
|
||||
},
|
||||
scanQRCode: function (e) {
|
||||
k(
|
||||
"scanQRCode",
|
||||
{
|
||||
needResult: (e = e || {}).needResult || 0,
|
||||
scanType: e.scanType || ["qrCode", "barCode"],
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
var n;
|
||||
u &&
|
||||
(n = e.resultStr) &&
|
||||
((n = JSON.parse(n)),
|
||||
(e.resultStr = n && n.scan_code && n.scan_code.scan_result));
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openAddress: function (e) {
|
||||
k(
|
||||
a.openAddress,
|
||||
{},
|
||||
((e._complete = function (e) {
|
||||
((e = e).postalCode = e.addressPostalCode),
|
||||
delete e.addressPostalCode,
|
||||
(e.provinceName = e.proviceFirstStageName),
|
||||
delete e.proviceFirstStageName,
|
||||
(e.cityName = e.addressCitySecondStageName),
|
||||
delete e.addressCitySecondStageName,
|
||||
(e.countryName = e.addressCountiesThirdStageName),
|
||||
delete e.addressCountiesThirdStageName,
|
||||
(e.detailInfo = e.addressDetailInfo),
|
||||
delete e.addressDetailInfo;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openProductSpecificView: function (e) {
|
||||
k(
|
||||
a.openProductSpecificView,
|
||||
{
|
||||
pid: e.productId,
|
||||
view_type: e.viewType || 0,
|
||||
ext_info: e.extInfo,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
addCard: function (e) {
|
||||
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
|
||||
var r = n[t],
|
||||
r = { card_id: r.cardId, card_ext: r.cardExt };
|
||||
i.push(r);
|
||||
}
|
||||
k(
|
||||
a.addCard,
|
||||
{ card_list: i },
|
||||
((e._complete = function (e) {
|
||||
if ((n = e.card_list)) {
|
||||
for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
|
||||
var o = n[i];
|
||||
(o.cardId = o.card_id),
|
||||
(o.cardExt = o.card_ext),
|
||||
(o.isSuccess = !!o.is_succ),
|
||||
delete o.card_id,
|
||||
delete o.card_ext,
|
||||
delete o.is_succ;
|
||||
}
|
||||
(e.cardList = n), delete e.card_list;
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
chooseCard: function (e) {
|
||||
k(
|
||||
"chooseCard",
|
||||
{
|
||||
app_id: h.appId,
|
||||
location_id: e.shopId || "",
|
||||
sign_type: e.signType || "SHA1",
|
||||
card_id: e.cardId || "",
|
||||
card_type: e.cardType || "",
|
||||
card_sign: e.cardSign,
|
||||
time_stamp: e.timestamp + "",
|
||||
nonce_str: e.nonceStr,
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
(e.cardList = e.choose_card_info), delete e.choose_card_info;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openCard: function (e) {
|
||||
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
|
||||
var r = n[t],
|
||||
r = { card_id: r.cardId, code: r.code };
|
||||
i.push(r);
|
||||
}
|
||||
k(a.openCard, { card_list: i }, e);
|
||||
},
|
||||
consumeAndShareCard: function (e) {
|
||||
k(
|
||||
a.consumeAndShareCard,
|
||||
{ consumedCardId: e.cardId, consumedCode: e.code },
|
||||
e
|
||||
);
|
||||
},
|
||||
chooseWXPay: function (e) {
|
||||
k(a.chooseWXPay, x(e), e), B({ jsApiName: "chooseWXPay" });
|
||||
},
|
||||
openEnterpriseRedPacket: function (e) {
|
||||
k(a.openEnterpriseRedPacket, x(e), e);
|
||||
},
|
||||
startSearchBeacons: function (e) {
|
||||
k(a.startSearchBeacons, { ticket: e.ticket }, e);
|
||||
},
|
||||
stopSearchBeacons: function (e) {
|
||||
k(a.stopSearchBeacons, {}, e);
|
||||
},
|
||||
onSearchBeacons: function (e) {
|
||||
M(a.onSearchBeacons, e);
|
||||
},
|
||||
openEnterpriseChat: function (e) {
|
||||
k(
|
||||
"openEnterpriseChat",
|
||||
{ useridlist: e.userIds, chatname: e.groupName },
|
||||
e
|
||||
);
|
||||
},
|
||||
launchMiniProgram: function (e) {
|
||||
k(
|
||||
"launchMiniProgram",
|
||||
{
|
||||
targetAppId: e.targetAppId,
|
||||
path: (function (e) {
|
||||
var n;
|
||||
if ("string" == typeof e && 0 < e.length)
|
||||
return (
|
||||
(n = e.split("?")[0]),
|
||||
(n += ".html"),
|
||||
void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n
|
||||
);
|
||||
})(e.path),
|
||||
envVersion: e.envVersion,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
openBusinessView: function (e) {
|
||||
k(
|
||||
"openBusinessView",
|
||||
{
|
||||
businessType: e.businessType,
|
||||
queryString: e.queryString || "",
|
||||
envVersion: e.envVersion,
|
||||
},
|
||||
((e._complete = function (n) {
|
||||
if (l) {
|
||||
var e = n.extraData;
|
||||
if (e)
|
||||
try {
|
||||
n.extraData = JSON.parse(e);
|
||||
} catch (e) {
|
||||
n.extraData = {};
|
||||
}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
miniProgram: {
|
||||
navigateBack: function (e) {
|
||||
(e = e || {}),
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "navigateBack", arg: { delta: e.delta || 1 } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
navigateTo: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "navigateTo", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
redirectTo: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "redirectTo", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
switchTab: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "switchTab", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
reLaunch: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "reLaunch", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
postMessage: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "postMessage", arg: e.data || {} },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
getEnv: function (e) {
|
||||
O(function () {
|
||||
e({ miniprogram: "miniprogram" === r.__wxjs_environment });
|
||||
});
|
||||
},
|
||||
},
|
||||
}),
|
||||
(w = 1),
|
||||
(T = {}),
|
||||
n.addEventListener(
|
||||
"error",
|
||||
function (e) {
|
||||
var n, i, t;
|
||||
l ||
|
||||
((t = (n = e.target).tagName),
|
||||
(i = n.src),
|
||||
"IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) ||
|
||||
(-1 != i.indexOf("wxlocalresource://") &&
|
||||
(e.preventDefault(),
|
||||
e.stopPropagation(),
|
||||
(t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)),
|
||||
T[t] ||
|
||||
((T[t] = !0),
|
||||
wx.ready(function () {
|
||||
wx.getLocalImgData({
|
||||
localId: i,
|
||||
success: function (e) {
|
||||
n.src = e.localData;
|
||||
},
|
||||
});
|
||||
}))));
|
||||
},
|
||||
!0
|
||||
),
|
||||
n.addEventListener(
|
||||
"load",
|
||||
function (e) {
|
||||
var n;
|
||||
l ||
|
||||
((n = (e = e.target).tagName),
|
||||
e.src,
|
||||
"IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) ||
|
||||
((n = e["wx-id"]) && (T[n] = !1));
|
||||
},
|
||||
!0
|
||||
),
|
||||
e && (r.wx = r.jWeixin = _),
|
||||
_
|
||||
);
|
||||
else return r.jWeixin;
|
||||
function k(n, e, i) {
|
||||
r.WeixinJSBridge
|
||||
? WeixinJSBridge.invoke(n, P(e), function (e) {
|
||||
V(n, e, i);
|
||||
})
|
||||
: C(n, i);
|
||||
}
|
||||
function M(n, i, t) {
|
||||
r.WeixinJSBridge
|
||||
? WeixinJSBridge.on(n, function (e) {
|
||||
t && t.trigger && t.trigger(e), V(n, e, i);
|
||||
})
|
||||
: C(n, t || i);
|
||||
}
|
||||
function P(e) {
|
||||
return (
|
||||
((e = e || {}).appId = h.appId),
|
||||
(e.verifyAppId = h.appId),
|
||||
(e.verifySignType = "sha1"),
|
||||
(e.verifyTimestamp = h.timestamp + ""),
|
||||
(e.verifyNonceStr = h.nonceStr),
|
||||
(e.verifySignature = h.signature),
|
||||
e
|
||||
);
|
||||
}
|
||||
function x(e) {
|
||||
return {
|
||||
timeStamp: e.timestamp + "",
|
||||
nonceStr: e.nonceStr,
|
||||
package: e.package,
|
||||
paySign: e.paySign,
|
||||
signType: e.signType || "SHA1",
|
||||
};
|
||||
}
|
||||
function V(e, n, i) {
|
||||
("openEnterpriseChat" != e && "openBusinessView" !== e) ||
|
||||
(n.errCode = n.err_code),
|
||||
delete n.err_code,
|
||||
delete n.err_desc,
|
||||
delete n.err_detail;
|
||||
var t = n.errMsg,
|
||||
e =
|
||||
(t ||
|
||||
((t = n.err_msg),
|
||||
delete n.err_msg,
|
||||
(t = (function (e, n) {
|
||||
var i = c[e];
|
||||
i && (e = i);
|
||||
i = "ok";
|
||||
{
|
||||
var t;
|
||||
n &&
|
||||
((t = n.indexOf(":")),
|
||||
("access denied" !=
|
||||
(i = (i = (i =
|
||||
-1 !=
|
||||
(i =
|
||||
-1 !=
|
||||
(i =
|
||||
"failed" ==
|
||||
(i = "confirm" == (i = n.substring(t + 1)) ? "ok" : i)
|
||||
? "fail"
|
||||
: i).indexOf("failed_")
|
||||
? i.substring(7)
|
||||
: i).indexOf("fail_")
|
||||
? i.substring(5)
|
||||
: i).replace(/_/g, " ")).toLowerCase()) &&
|
||||
"no permission to execute" != i) ||
|
||||
(i = "permission denied"),
|
||||
"" ==
|
||||
(i =
|
||||
"config" == e && "function not exist" == i ? "ok" : i)) &&
|
||||
(i = "fail");
|
||||
}
|
||||
return (n = e + ":" + i);
|
||||
})(e, t)),
|
||||
(n.errMsg = t)),
|
||||
(i = i || {})._complete && (i._complete(n), delete i._complete),
|
||||
(t = n.errMsg || ""),
|
||||
h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)),
|
||||
t.indexOf(":"));
|
||||
switch (t.substring(e + 1)) {
|
||||
case "ok":
|
||||
i.success && i.success(n);
|
||||
break;
|
||||
case "cancel":
|
||||
i.cancel && i.cancel(n);
|
||||
break;
|
||||
default:
|
||||
i.fail && i.fail(n);
|
||||
}
|
||||
i.complete && i.complete(n);
|
||||
}
|
||||
function A(e) {
|
||||
if (e) {
|
||||
for (var n = 0, i = e.length; n < i; ++n) {
|
||||
var t = e[n],
|
||||
t = a[t];
|
||||
t && (e[n] = t);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
}
|
||||
function C(e, n) {
|
||||
var i;
|
||||
!h.debug ||
|
||||
(n && n.isInnerInvoke) ||
|
||||
((i = c[e]) && (e = i),
|
||||
n && n._complete && delete n._complete,
|
||||
console.log('"' + e + '",', n || ""));
|
||||
}
|
||||
function B(n) {
|
||||
var i;
|
||||
o ||
|
||||
s ||
|
||||
h.debug ||
|
||||
p < "6.0.2" ||
|
||||
g.systemType < 0 ||
|
||||
((i = new Image()),
|
||||
(g.appId = h.appId),
|
||||
(g.initTime = m.initEndTime - m.initStartTime),
|
||||
(g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime),
|
||||
_.getNetworkType({
|
||||
isInnerInvoke: !0,
|
||||
success: function (e) {
|
||||
g.networkType = e.networkType;
|
||||
e =
|
||||
"https://open.weixin.qq.com/sdk/report?v=" +
|
||||
g.version +
|
||||
"&o=" +
|
||||
g.isPreVerifyOk +
|
||||
"&s=" +
|
||||
g.systemType +
|
||||
"&c=" +
|
||||
g.clientVersion +
|
||||
"&a=" +
|
||||
g.appId +
|
||||
"&n=" +
|
||||
g.networkType +
|
||||
"&i=" +
|
||||
g.initTime +
|
||||
"&p=" +
|
||||
g.preVerifyTime +
|
||||
"&u=" +
|
||||
g.url +
|
||||
"&jsapi_name=" +
|
||||
(n ? n.jsApiName : "");
|
||||
i.src = e;
|
||||
},
|
||||
}));
|
||||
}
|
||||
function L() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
function O(e) {
|
||||
d &&
|
||||
(r.WeixinJSBridge
|
||||
? e()
|
||||
: n.addEventListener &&
|
||||
n.addEventListener("WeixinJSBridgeReady", e, !1));
|
||||
}
|
||||
});
|
||||
15
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/package.json
generated
vendored
Normal file
15
node_modules/.store/weixin-js-sdk@1.6.5/node_modules/weixin-js-sdk/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "weixin-js-sdk",
|
||||
"version": "1.6.5",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
|
||||
},
|
||||
"homepage": "https://yanxi123.com/",
|
||||
"__npminstall_done": true,
|
||||
"_from": "weixin-js-sdk@1.6.5",
|
||||
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
|
||||
}
|
||||
21
node_modules/weixin-js-sdk/LICENSE
generated
vendored
Normal file
21
node_modules/weixin-js-sdk/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Yanxi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
36
node_modules/weixin-js-sdk/README.md
generated
vendored
Normal file
36
node_modules/weixin-js-sdk/README.md
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
微信官方 js-sdk
|
||||
----
|
||||
|
||||
说明: 仅将官方 js-sdk 发布到 npm,支持 CommonJS,便于 browserify, webpack 等直接使用,支持 TypeScript。
|
||||
|
||||
|
||||
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
|
||||
|
||||
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
|
||||
|
||||
安装:
|
||||
```shell
|
||||
npm install weixin-js-sdk
|
||||
```
|
||||
|
||||
使用:
|
||||
```javascript
|
||||
// commonjs
|
||||
var wx = require('weixin-js-sdk');
|
||||
|
||||
// es module
|
||||
import wx from 'weixin-js-sdk'
|
||||
```
|
||||
|
||||
### Old versions
|
||||
|
||||
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
|
||||
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
|
||||
|
||||
### 个人主页
|
||||
|
||||
* [https://yanxi123.com/](https://yanxi123.com/)
|
||||
|
||||
### 感谢
|
||||
|
||||
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)
|
||||
601
node_modules/weixin-js-sdk/index.d.ts
generated
vendored
Normal file
601
node_modules/weixin-js-sdk/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,601 @@
|
||||
// Type definitions for weixin jssdk 1.6.0
|
||||
// Project: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace wx {
|
||||
type ImageSizeType = "original" | "compressed";
|
||||
type ImageSourceType = "album" | "camera";
|
||||
type VideoSourceType = "album" | "camera";
|
||||
type ApiMethod =
|
||||
| "onMenuShareTimeline"
|
||||
| "onMenuShareAppMessage"
|
||||
| "onMenuShareQQ"
|
||||
| "onMenuShareWeibo"
|
||||
| "onMenuShareQZone"
|
||||
| "updateAppMessageShareData"
|
||||
| "updateTimelineShareData"
|
||||
| "startRecord"
|
||||
| "stopRecord"
|
||||
| "onVoiceRecordEnd"
|
||||
| "playVoice"
|
||||
| "pauseVoice"
|
||||
| "stopVoice"
|
||||
| "onVoicePlayEnd"
|
||||
| "uploadVoice"
|
||||
| "downloadVoice"
|
||||
| "chooseImage"
|
||||
| "previewImage"
|
||||
| "uploadImage"
|
||||
| "downloadImage"
|
||||
| "translateVoice"
|
||||
| "getNetworkType"
|
||||
| "openLocation"
|
||||
| "getLocation"
|
||||
| "hideOptionMenu"
|
||||
| "showOptionMenu"
|
||||
| "hideMenuItems"
|
||||
| "showMenuItems"
|
||||
| "hideAllNonBaseMenuItem"
|
||||
| "showAllNonBaseMenuItem"
|
||||
| "closeWindow"
|
||||
| "scanQRCode"
|
||||
| "chooseWXPay"
|
||||
| "openProductSpecificView"
|
||||
| "addCard"
|
||||
| "chooseCard"
|
||||
| "openCard";
|
||||
// 所有JS接口列表
|
||||
type jsApiList = ApiMethod[];
|
||||
|
||||
// 开放标签列表
|
||||
// https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html
|
||||
type openTag = "wx-open-launch-weapp" | "wx-open-launch-app" | "wx-open-subscribe" | "wx-open-audio"
|
||||
type openTagList = openTag[];
|
||||
|
||||
// 所有菜单项列表
|
||||
// 基本类
|
||||
type menuBase =
|
||||
| "menuItem:exposeArticle" // 举报
|
||||
| "menuItem:setFont" // 调整字体
|
||||
| "menuItem:dayMode" // 日间模式
|
||||
| "menuItem:nightMode" // 夜间模式
|
||||
| "menuItem:refresh" // 刷新
|
||||
| "menuItem:profile" // 查看公众号(已添加)
|
||||
| "menuItem:addContact"; // 查看公众号(未添加)
|
||||
// 传播类
|
||||
type menuShare =
|
||||
| "menuItem:share:appMessage" // 发送给朋友
|
||||
| "menuItem:share:timeline" // 分享到朋友圈
|
||||
| "menuItem:share:qq" // 分享到QQ
|
||||
| "menuItem:share:weiboApp" // 分享到Weibo
|
||||
| "menuItem:favorite" // 收藏
|
||||
| "menuItem:share:facebook" // 分享到FB
|
||||
| "menuItem:share:QZone"; // 分享到 QQ 空间
|
||||
|
||||
// 保护类
|
||||
type menuProtected =
|
||||
| "menuItem:editTag" // 编辑标签
|
||||
| "menuItem:delete" // 删除
|
||||
| "menuItem:copyUrl" // 复制链接
|
||||
| "menuItem:originPage" // 原网页
|
||||
| "menuItem:readMode" // 阅读模式
|
||||
| "menuItem:openWithQQBrowser" // 在QQ浏览器中打开
|
||||
| "menuItem:openWithSafari" // 在Safari中打开
|
||||
| "menuItem:share:email" // 邮件
|
||||
| "menuItem:share:brand"; // 一些特殊公众号
|
||||
|
||||
type menuList = Array<menuBase | menuProtected | menuShare>;
|
||||
|
||||
function config(conf: {
|
||||
debug?: boolean; // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||
appId: string; // 必填,公众号的唯一标识
|
||||
timestamp: number; // 必填,生成签名的时间戳
|
||||
nonceStr: string; // 必填,生成签名的随机串
|
||||
signature: string; // 必填,签名,见附录1
|
||||
jsApiList?: jsApiList; // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
||||
openTagList?: openTagList;
|
||||
}): void;
|
||||
|
||||
interface Resouce {
|
||||
localId: string;
|
||||
}
|
||||
interface BaseParams {
|
||||
success?(...args: any[]): void;
|
||||
/** 接口调用失败的回调函数 */
|
||||
fail?(...args: any[]): void;
|
||||
/** 接口取消调用的回调函数 */
|
||||
cancel?(...args: any[]): void;
|
||||
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
||||
complete?(...args: any[]): void;
|
||||
}
|
||||
function ready(fn: () => void): void;
|
||||
function error(fn: (err: { errMsg: string }) => void): void;
|
||||
|
||||
interface IcheckJsApi extends BaseParams {
|
||||
jsApiList: jsApiList; // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
||||
// 以键值对的形式返回,可用的api值true,不可用为false
|
||||
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
||||
success(res: {
|
||||
checkResult: { [api: string]: boolean };
|
||||
errMsg: string;
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* 判断当前客户端版本是否支持指定JS接口
|
||||
* 备注:checkJsApi接口是客户端6.0.2新引入的一个预留接口,第一期开放的接口均可不使用checkJsApi来检测。
|
||||
*/
|
||||
function checkJsApi(params: IcheckJsApi): void;
|
||||
|
||||
interface IonMenuShareTimeline extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/*=============================基础接口================================*/
|
||||
/**
|
||||
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareTimeline(params: IonMenuShareTimeline): void;
|
||||
|
||||
interface IonMenuShareAppMessage extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
type?: "music" | "video或link" | "link"; // 分享类型,music、video或link,不填默认为link
|
||||
dataUrl?: string; // 如果type是music或video,则要提供数据链接,默认为空
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareAppMessage(params: IonMenuShareAppMessage): void;
|
||||
|
||||
interface IonMenuShareQQ extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到QQ”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareQQ(params: IonMenuShareQQ): void;
|
||||
|
||||
interface IonMenuShareWeibo extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareWeibo(params: IonMenuShareWeibo): void;
|
||||
|
||||
interface IonMenuShareQZone extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
// 用户取消分享后执行的回调函数
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function onMenuShareQZone(params: IonMenuShareQZone): void;
|
||||
|
||||
interface IupdateAppMessageShareData extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
desc: string; // 分享描述
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享给朋友”及“分享到QQ”按钮点击状态及自定义分享内容接口(新)
|
||||
*/
|
||||
function updateAppMessageShareData(params: IupdateAppMessageShareData): void;
|
||||
|
||||
interface IupdateTimelineShareData extends BaseParams {
|
||||
title: string; // 分享标题
|
||||
link: string; // 分享链接
|
||||
imgUrl: string; // 分享图标
|
||||
// 用户确认分享后执行的回调函数
|
||||
success(): void;
|
||||
}
|
||||
/**
|
||||
* 获取“分享到朋友圈”及“分享到QQ空间”按钮点击状态及自定义分享内容接口
|
||||
*/
|
||||
function updateTimelineShareData(params: IupdateTimelineShareData): void;
|
||||
/*=============================基础接口================================*/
|
||||
|
||||
/*=============================图像接口================================*/
|
||||
interface IchooseImage extends BaseParams {
|
||||
/** 最多可以选择的图片张数,默认9 */
|
||||
count?: number;
|
||||
/** original 原图,compressed 压缩图,默认二者都有 */
|
||||
sizeType?: ImageSizeType[];
|
||||
/** album 从相册选图,camera 使用相机,默认二者都有 */
|
||||
sourceType?: ImageSourceType[];
|
||||
/** 成功则返回图片的本地文件路径列表 tempFilePaths */
|
||||
success(res: {
|
||||
sourceType: string; // weixin album camera
|
||||
localIds: string[];
|
||||
errMsg: string;
|
||||
}): void;
|
||||
cancel(): void;
|
||||
}
|
||||
/**
|
||||
* 从本地相册选择图片或使用相机拍照。
|
||||
*/
|
||||
function chooseImage(params: IchooseImage): void;
|
||||
|
||||
interface IpreviewImage extends BaseParams {
|
||||
current: string; // 当前显示图片的http链接
|
||||
urls: string[]; // 需要预览的图片http链接列表
|
||||
}
|
||||
/**
|
||||
* 预览图片接口
|
||||
*/
|
||||
function previewImage(params: IpreviewImage): void;
|
||||
|
||||
interface IuploadResource extends BaseParams {
|
||||
localId: string; // 需要上传的图片的本地ID,由chooseImage接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
// 返回图片的服务器端ID
|
||||
success(res: { serverId: string }): void;
|
||||
}
|
||||
/**
|
||||
* 上传图片接口
|
||||
*/
|
||||
function uploadImage(params: IuploadResource): void;
|
||||
|
||||
interface IdownloadResource extends BaseParams {
|
||||
serverId: string; // 需要下载的图片的服务器端ID,由uploadImage接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
// 返回图片下载后的本地ID
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 下载图片接口
|
||||
*/
|
||||
function downloadImage(params: IdownloadResource): void;
|
||||
|
||||
interface IgetLocalImgData extends BaseParams {
|
||||
localId: string; // 图片的localID
|
||||
// localData是图片的base64数据,可以用img标签显示
|
||||
success(res: { localData: string }): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地图片接口
|
||||
*/
|
||||
function getLocalImgData(params: IgetLocalImgData): void;
|
||||
/*=============================图像接口================================*/
|
||||
/*=============================音频接口================================*/
|
||||
/**
|
||||
* 开始录音接口
|
||||
*/
|
||||
function startRecord(): void;
|
||||
|
||||
interface IstopRecord extends BaseParams {
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 停止录音接口
|
||||
*/
|
||||
function stopRecord(params: IstopRecord): void;
|
||||
|
||||
interface IonVoiceRecordEnd extends BaseParams {
|
||||
// 录音时间超过一分钟没有停止的时候会执行 complete 回调
|
||||
complete(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 监听录音自动停止接口
|
||||
*/
|
||||
function onVoiceRecordEnd(params: IonVoiceRecordEnd): void;
|
||||
|
||||
interface IplaypausestopVoice extends BaseParams {
|
||||
localId: string; // 需要播放的音频的本地ID,由stopRecord接口获得
|
||||
}
|
||||
/**
|
||||
* 播放语音接口
|
||||
*/
|
||||
function playVoice(params: IplaypausestopVoice): void;
|
||||
|
||||
/**
|
||||
* 暂停播放接口
|
||||
*/
|
||||
function pauseVoice(params: IplaypausestopVoice): void;
|
||||
/**
|
||||
* 停止播放接口
|
||||
*/
|
||||
function stopVoice(params: IplaypausestopVoice): void;
|
||||
|
||||
interface IonVoicePlayEnd extends BaseParams {
|
||||
success(res: Resouce): void;
|
||||
}
|
||||
/**
|
||||
* 监听语音播放完毕接口
|
||||
*/
|
||||
function onVoicePlayEnd(params: IonVoicePlayEnd): void;
|
||||
/**
|
||||
* 上传语音接口
|
||||
* 备注:上传语音有效期3天,可用微信多媒体接口下载语音到自己的服务器
|
||||
* ,此处获得的 serverId 即 media_id,参考文档
|
||||
* ../12 / 58bfcfabbd501c7cd77c19bd9cfa8354.html
|
||||
* 目前多媒体文件下载接口的频率限制为10000次/ 天,
|
||||
* 如需要调高频率,请邮件weixin - open@qq.com,
|
||||
* 邮件主题为【申请多媒体接口调用量】,请对你的项目进行简单描述,
|
||||
* 附上产品体验链接,并对用户量和使用量进行说明。
|
||||
*/
|
||||
function uploadVoice(params: IuploadResource): void;
|
||||
/**
|
||||
* 下载语音接口
|
||||
*/
|
||||
function downloadVoice(params: IdownloadResource): void;
|
||||
/*=============================音频接口================================*/
|
||||
/*=============================智能接口================================*/
|
||||
|
||||
interface ItranslateVoice extends BaseParams {
|
||||
localId: string; // 需要识别的音频的本地Id,由录音相关接口获得
|
||||
isShowProgressTips: number; // 默认为1,显示进度提示
|
||||
success(res: { translateResult: string }): void;
|
||||
}
|
||||
/**
|
||||
* 识别音频并返回识别结果接口
|
||||
*/
|
||||
function translateVoice(params: ItranslateVoice): void;
|
||||
|
||||
/*=============================智能接口================================*/
|
||||
|
||||
/*=============================设备信息================================*/
|
||||
type networkType = "2g" | "3g" | "4g" | "wifi";
|
||||
interface IgetNetworkType extends BaseParams {
|
||||
success(res: { networkType: networkType }): void;
|
||||
}
|
||||
/**
|
||||
* 获取网络状态接口
|
||||
*/
|
||||
function getNetworkType(params: IgetNetworkType): void;
|
||||
/*=============================设备信息================================*/
|
||||
|
||||
/*=============================地理位置================================*/
|
||||
interface IopenLocation extends BaseParams {
|
||||
latitude: number; // 纬度,浮点数,范围为90 ~ -90
|
||||
longitude: number; // 经度,浮点数,范围为180 ~ -180。
|
||||
name: string; // 位置名
|
||||
address: string; // 地址详情说明
|
||||
scale: number; // 地图缩放级别,整形值,范围从1~28。默认为最大
|
||||
infoUrl: string; // 在查看位置界面底部显示的超链接,可点击跳转
|
||||
}
|
||||
/**
|
||||
* 使用微信内置地图查看位置接口
|
||||
*/
|
||||
function openLocation(params: IopenLocation): void;
|
||||
|
||||
interface IgetLocation extends BaseParams {
|
||||
type: "wgs84" | "gcj02"; // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||
success(res: {
|
||||
latitude: number; // 纬度,浮点数,范围为90 ~ -90
|
||||
longitude: number; // 经度,浮点数,范围为180 ~ -180。
|
||||
speed: number; // 速度,以米/每秒计
|
||||
accuracy: number; // 位置精度
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* 获取地理位置接口
|
||||
*/
|
||||
function getLocation(params: IgetLocation): void;
|
||||
/*=============================地理位置================================*/
|
||||
/*=============================摇一摇周边================================*/
|
||||
interface IstartSearchBeacons extends BaseParams {
|
||||
ticket: string; // 摇周边的业务ticket, 系统自动添加在摇出来的页面链接后面
|
||||
// 开启查找完成后的回调函数
|
||||
complete(argv: any): void;
|
||||
}
|
||||
/**
|
||||
* 开启查找周边ibeacon设备接口
|
||||
* 备注:如需接入摇一摇周边功能,请参考:申请开通摇一摇周边
|
||||
*/
|
||||
function startSearchBeacons(params: IstartSearchBeacons): void;
|
||||
|
||||
interface IstopSearchBeacons extends BaseParams {
|
||||
// 关闭查找完成后的回调函数
|
||||
complete(res: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭查找周边ibeacon设备接口
|
||||
*/
|
||||
function stopSearchBeacons(params: IstopSearchBeacons): void;
|
||||
|
||||
interface IonSearchBeacons extends BaseParams {
|
||||
// 回调函数,可以数组形式取得该商家注册的在周边的相关设备列表
|
||||
complete(argv: any): void;
|
||||
}
|
||||
/**
|
||||
* 监听周边ibeacon设备接口
|
||||
*/
|
||||
function onSearchBeacons(params: IonSearchBeacons): void;
|
||||
/*=============================摇一摇周边================================*/
|
||||
/*=============================界面操作================================*/
|
||||
|
||||
/**
|
||||
* 隐藏右上角菜单接口
|
||||
*/
|
||||
function hideOptionMenu(): void;
|
||||
|
||||
/**
|
||||
* 显示右上角菜单接口
|
||||
*/
|
||||
function showOptionMenu(): void;
|
||||
|
||||
/**
|
||||
* 关闭当前网页窗口接口
|
||||
*/
|
||||
function closeWindow(): void;
|
||||
|
||||
interface IhideMenuItems extends BaseParams {
|
||||
menuList: Array<menuProtected | menuShare>; // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
|
||||
}
|
||||
/**
|
||||
* 批量隐藏功能按钮接口
|
||||
*/
|
||||
function hideMenuItems(params: IhideMenuItems): void;
|
||||
|
||||
interface IshowMenuItems extends BaseParams {
|
||||
menuList: menuList; // 要显示的菜单项,所有menu项见附录3
|
||||
}
|
||||
/**
|
||||
* 批量显示功能按钮接口
|
||||
*/
|
||||
function showMenuItems(params: IshowMenuItems): void;
|
||||
|
||||
/**
|
||||
* 隐藏所有非基础按钮接口
|
||||
* “基本类”按钮详见附录3
|
||||
*/
|
||||
function hideAllNonBaseMenuItem(): void;
|
||||
|
||||
/**
|
||||
* 显示所有功能按钮接口
|
||||
*/
|
||||
function showAllNonBaseMenuItem(): void;
|
||||
/*=============================界面操作================================*/
|
||||
/*=============================微信扫一扫================================*/
|
||||
|
||||
type scanType = "qrCode" | "barCode";
|
||||
|
||||
interface IscanQRCode extends BaseParams {
|
||||
needResult: 0 | 1; // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
||||
scanType: scanType[]; // 可以指定扫二维码还是一维码,默认二者都有
|
||||
// 当needResult 为 1 时,扫码返回的结果
|
||||
success(res: { resultStr: string }): void;
|
||||
}
|
||||
/**
|
||||
* 调起微信扫一扫接口
|
||||
*/
|
||||
function scanQRCode(params: IscanQRCode): void;
|
||||
/*=============================微信扫一扫================================*/
|
||||
/*=============================微信小店================================*/
|
||||
|
||||
interface IopenProductSpecificView extends BaseParams {
|
||||
productId: string; // 商品id
|
||||
viewType: "0" | "1" | "2"; // 0.默认值,普通商品详情页1.扫一扫商品详情页2.小店商品详情页
|
||||
}
|
||||
/**
|
||||
* 跳转微信商品页接口
|
||||
*/
|
||||
function openProductSpecificView(params: IopenProductSpecificView): void;
|
||||
/*=============================微信卡券================================*/
|
||||
|
||||
interface IchooseCard extends BaseParams {
|
||||
shopId: string; // 门店Id
|
||||
cardType: string; // 卡券类型
|
||||
cardId: string; // 卡券Id
|
||||
timestamp: number; // 卡券签名时间戳
|
||||
nonceStr: string; // 卡券签名随机串
|
||||
signType: string; // 签名方式,默认'SHA1'
|
||||
cardSign: string; // 卡券签名
|
||||
success(res: { cardList: string[] }): void;
|
||||
}
|
||||
/**
|
||||
* 拉取适用卡券列表并获取用户选择信息
|
||||
*/
|
||||
function chooseCard(params: IchooseCard): void;
|
||||
|
||||
interface IaddCard extends BaseParams {
|
||||
cardList: Array<{
|
||||
cardId: string;
|
||||
cardExt: string;
|
||||
}>; // 需要添加的卡券列表
|
||||
success(res: { cardList: string[] }): void;
|
||||
}
|
||||
/**
|
||||
* 批量添加卡券接口
|
||||
*/
|
||||
function addCard(): void;
|
||||
|
||||
interface IopenCard extends BaseParams {
|
||||
cardList: Array<{
|
||||
cardId: string;
|
||||
code: string;
|
||||
}>; // 需要打开的卡券列表
|
||||
}
|
||||
/**
|
||||
* 查看微信卡包中的卡券接口
|
||||
*/
|
||||
function openCard(params: IopenCard): void;
|
||||
|
||||
interface IconsumeAndShareCard extends BaseParams {
|
||||
cardId: string;
|
||||
code: string;
|
||||
}
|
||||
/**
|
||||
* 核销后再次赠送卡券接口
|
||||
*/
|
||||
function consumeAndShareCard(params: IconsumeAndShareCard): void;
|
||||
/*=============================微信卡券================================*/
|
||||
/*=============================微信支付================================*/
|
||||
|
||||
interface IchooseWXPay extends BaseParams {
|
||||
timestamp: number; // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
||||
nonceStr: string; // 支付签名随机串,不长于 32 位
|
||||
package: string; // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
||||
signType: string; // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
||||
paySign: string; // 支付签名
|
||||
// 支付成功后的回调函数
|
||||
success(res: any): void;
|
||||
}
|
||||
/**
|
||||
* 发起一个微信支付请求
|
||||
*/
|
||||
function chooseWXPay(params: IchooseWXPay): void;
|
||||
/*=============================微信支付================================*/
|
||||
/*=============================微信小程序==============================*/
|
||||
interface miniProgramMethodsParams extends BaseParams {
|
||||
url: string;
|
||||
}
|
||||
interface miniProgramMethods {
|
||||
navigateTo(params: miniProgramMethodsParams): void;
|
||||
navigateBack(params: miniProgramMethodsParams): void;
|
||||
switchTab(params: miniProgramMethodsParams): void;
|
||||
reLaunch(params: miniProgramMethodsParams): void;
|
||||
redirectTo(params: miniProgramMethodsParams): void;
|
||||
postMessage(params: { data: any }): void;
|
||||
getEnv(fn: (res: any) => void): void;
|
||||
}
|
||||
const miniProgram: miniProgramMethods;
|
||||
/*=============================微信小程序==============================*/
|
||||
}
|
||||
declare function wx(): void;
|
||||
/*=============================微信内全局变量==============================*/
|
||||
declare global {
|
||||
interface Window {
|
||||
WeixinJSBridge: any;
|
||||
__wxjs_environment: any;
|
||||
}
|
||||
const WeixinJSBridge: any;
|
||||
}
|
||||
export default wx;
|
||||
891
node_modules/weixin-js-sdk/index.js
generated
vendored
Normal file
891
node_modules/weixin-js-sdk/index.js
generated
vendored
Normal file
@@ -0,0 +1,891 @@
|
||||
!(function (e, n) {
|
||||
module.exports = n(e);
|
||||
})(typeof window === "object" && window, function (r, e) {
|
||||
if (!r) {
|
||||
console.warn("can't use weixin-js-sdk in server side");
|
||||
return;
|
||||
}
|
||||
var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
|
||||
if (!r.jWeixin)
|
||||
return (
|
||||
(a = {
|
||||
config: "preVerifyJSAPI",
|
||||
onMenuShareTimeline: "menu:share:timeline",
|
||||
onMenuShareAppMessage: "menu:share:appmessage",
|
||||
onMenuShareQQ: "menu:share:qq",
|
||||
onMenuShareWeibo: "menu:share:weiboApp",
|
||||
onMenuShareQZone: "menu:share:QZone",
|
||||
previewImage: "imagePreview",
|
||||
getLocation: "geoLocation",
|
||||
openProductSpecificView: "openProductViewWithPid",
|
||||
addCard: "batchAddCard",
|
||||
openCard: "batchViewCard",
|
||||
chooseWXPay: "getBrandWCPayRequest",
|
||||
openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
|
||||
startSearchBeacons: "startMonitoringBeacons",
|
||||
stopSearchBeacons: "stopMonitoringBeacons",
|
||||
onSearchBeacons: "onBeaconsInRange",
|
||||
consumeAndShareCard: "consumedShareCard",
|
||||
openAddress: "editAddress",
|
||||
}),
|
||||
(c = (function () {
|
||||
var e,
|
||||
n = {};
|
||||
for (e in a) n[a[e]] = e;
|
||||
return n;
|
||||
})()),
|
||||
(n = r.document),
|
||||
(i = n.title),
|
||||
(t = navigator.userAgent.toLowerCase()),
|
||||
(f = navigator.platform.toLowerCase()),
|
||||
(o = !(!f.match("mac") && !f.match("win"))),
|
||||
(s = -1 != t.indexOf("wxdebugger")),
|
||||
(d = -1 != t.indexOf("micromessenger")),
|
||||
(l = -1 != t.indexOf("android")),
|
||||
(u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")),
|
||||
(p = (f =
|
||||
t.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
|
||||
t.match(/micromessenger\/(\d+\.\d+)/))
|
||||
? f[1]
|
||||
: ""),
|
||||
(m = {
|
||||
initStartTime: L(),
|
||||
initEndTime: 0,
|
||||
preVerifyStartTime: 0,
|
||||
preVerifyEndTime: 0,
|
||||
}),
|
||||
(g = {
|
||||
version: 1,
|
||||
appId: "",
|
||||
initTime: 0,
|
||||
preVerifyTime: 0,
|
||||
networkType: "",
|
||||
isPreVerifyOk: 1,
|
||||
systemType: u ? 1 : l ? 2 : -1,
|
||||
clientVersion: p,
|
||||
url: encodeURIComponent(location.href),
|
||||
}),
|
||||
(h = {}),
|
||||
(S = { _completes: [] }),
|
||||
(y = { state: 0, data: {} }),
|
||||
O(function () {
|
||||
m.initEndTime = L();
|
||||
}),
|
||||
(I = !1),
|
||||
(v = []),
|
||||
(_ = {
|
||||
config: function (e) {
|
||||
C("config", (h = e));
|
||||
var o = !1 !== h.check;
|
||||
O(function () {
|
||||
if (o)
|
||||
k(
|
||||
a.config,
|
||||
{
|
||||
verifyJsApiList: A(h.jsApiList),
|
||||
verifyOpenTagList: A(h.openTagList),
|
||||
},
|
||||
((S._complete = function (e) {
|
||||
(m.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
|
||||
}),
|
||||
(S.success = function (e) {
|
||||
g.isPreVerifyOk = 0;
|
||||
}),
|
||||
(S.fail = function (e) {
|
||||
S._fail ? S._fail(e) : (y.state = -1);
|
||||
}),
|
||||
(t = S._completes).push(function () {
|
||||
B();
|
||||
}),
|
||||
(S.complete = function (e) {
|
||||
for (var n = 0, i = t.length; n < i; ++n) t[n]();
|
||||
S._completes = [];
|
||||
}),
|
||||
S)
|
||||
),
|
||||
(m.preVerifyStartTime = L());
|
||||
else {
|
||||
y.state = 1;
|
||||
for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
|
||||
e[n]();
|
||||
S._completes = [];
|
||||
}
|
||||
var t;
|
||||
}),
|
||||
_.invoke ||
|
||||
((_.invoke = function (e, n, i) {
|
||||
r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i);
|
||||
}),
|
||||
(_.on = function (e, n) {
|
||||
r.WeixinJSBridge && WeixinJSBridge.on(e, n);
|
||||
}));
|
||||
},
|
||||
ready: function (e) {
|
||||
(0 != y.state || (S._completes.push(e), !d && h.debug)) && e();
|
||||
},
|
||||
error: function (e) {
|
||||
p < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
|
||||
},
|
||||
checkJsApi: function (e) {
|
||||
k(
|
||||
"checkJsApi",
|
||||
{ jsApiList: A(e.jsApiList) },
|
||||
((e._complete = function (e) {
|
||||
l && (i = e.checkResult) && (e.checkResult = JSON.parse(i));
|
||||
var n,
|
||||
i = e,
|
||||
t = i.checkResult;
|
||||
for (n in t) {
|
||||
var o = c[n];
|
||||
o && ((t[o] = t[n]), delete t[n]);
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
onMenuShareTimeline: function (e) {
|
||||
M(
|
||||
a.onMenuShareTimeline,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareTimeline",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.title || i,
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
type: e.type || "link",
|
||||
data_url: e.dataUrl || "",
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareAppMessage: function (n) {
|
||||
M(
|
||||
a.onMenuShareAppMessage,
|
||||
{
|
||||
complete: function (e) {
|
||||
"favorite" === e.scene
|
||||
? k("sendAppMessage", {
|
||||
title: n.title || i,
|
||||
desc: n.desc || "",
|
||||
link: n.link || location.href,
|
||||
img_url: n.imgUrl || "",
|
||||
type: n.type || "link",
|
||||
data_url: n.dataUrl || "",
|
||||
})
|
||||
: k(
|
||||
"sendAppMessage",
|
||||
{
|
||||
title: n.title || i,
|
||||
desc: n.desc || "",
|
||||
link: n.link || location.href,
|
||||
img_url: n.imgUrl || "",
|
||||
type: n.type || "link",
|
||||
data_url: n.dataUrl || "",
|
||||
},
|
||||
n
|
||||
);
|
||||
},
|
||||
},
|
||||
n
|
||||
);
|
||||
},
|
||||
onMenuShareQQ: function (e) {
|
||||
M(
|
||||
a.onMenuShareQQ,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareQQ",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareWeibo: function (e) {
|
||||
M(
|
||||
a.onMenuShareWeibo,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareWeiboApp",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
onMenuShareQZone: function (e) {
|
||||
M(
|
||||
a.onMenuShareQZone,
|
||||
{
|
||||
complete: function () {
|
||||
k(
|
||||
"shareQZone",
|
||||
{
|
||||
title: e.title || i,
|
||||
desc: e.desc || "",
|
||||
img_url: e.imgUrl || "",
|
||||
link: e.link || location.href,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
updateTimelineShareData: function (e) {
|
||||
k(
|
||||
"updateTimelineShareData",
|
||||
{ title: e.title, link: e.link, imgUrl: e.imgUrl },
|
||||
e
|
||||
);
|
||||
},
|
||||
updateAppMessageShareData: function (e) {
|
||||
k(
|
||||
"updateAppMessageShareData",
|
||||
{ title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
|
||||
e
|
||||
);
|
||||
},
|
||||
startRecord: function (e) {
|
||||
k("startRecord", {}, e);
|
||||
},
|
||||
stopRecord: function (e) {
|
||||
k("stopRecord", {}, e);
|
||||
},
|
||||
onVoiceRecordEnd: function (e) {
|
||||
M("onVoiceRecordEnd", e);
|
||||
},
|
||||
playVoice: function (e) {
|
||||
k("playVoice", { localId: e.localId }, e);
|
||||
},
|
||||
pauseVoice: function (e) {
|
||||
k("pauseVoice", { localId: e.localId }, e);
|
||||
},
|
||||
stopVoice: function (e) {
|
||||
k("stopVoice", { localId: e.localId }, e);
|
||||
},
|
||||
onVoicePlayEnd: function (e) {
|
||||
M("onVoicePlayEnd", e);
|
||||
},
|
||||
uploadVoice: function (e) {
|
||||
k(
|
||||
"uploadVoice",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
downloadVoice: function (e) {
|
||||
k(
|
||||
"downloadVoice",
|
||||
{
|
||||
serverId: e.serverId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
translateVoice: function (e) {
|
||||
k(
|
||||
"translateVoice",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
chooseImage: function (e) {
|
||||
k(
|
||||
"chooseImage",
|
||||
{
|
||||
scene: "1|2",
|
||||
count: e.count || 9,
|
||||
sizeType: e.sizeType || ["original", "compressed"],
|
||||
sourceType: e.sourceType || ["album", "camera"],
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
if (l) {
|
||||
var n = e.localIds;
|
||||
try {
|
||||
n && (e.localIds = JSON.parse(n));
|
||||
} catch (e) {}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
getLocation: function (e) {
|
||||
(e = e || {}),
|
||||
k(
|
||||
a.getLocation,
|
||||
{ type: e.type || "wgs84" },
|
||||
((e._complete = function (e) {
|
||||
delete e.type;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
previewImage: function (e) {
|
||||
k(a.previewImage, { current: e.current, urls: e.urls }, e);
|
||||
},
|
||||
uploadImage: function (e) {
|
||||
k(
|
||||
"uploadImage",
|
||||
{
|
||||
localId: e.localId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
downloadImage: function (e) {
|
||||
k(
|
||||
"downloadImage",
|
||||
{
|
||||
serverId: e.serverId,
|
||||
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
getLocalImgData: function (e) {
|
||||
!1 === I
|
||||
? ((I = !0),
|
||||
k(
|
||||
"getLocalImgData",
|
||||
{ localId: e.localId },
|
||||
((e._complete = function (e) {
|
||||
var n;
|
||||
(I = !1),
|
||||
0 < v.length && ((n = v.shift()), wx.getLocalImgData(n));
|
||||
}),
|
||||
e)
|
||||
))
|
||||
: v.push(e);
|
||||
},
|
||||
getNetworkType: function (e) {
|
||||
k(
|
||||
"getNetworkType",
|
||||
{},
|
||||
((e._complete = function (e) {
|
||||
var n = e,
|
||||
e = n.errMsg,
|
||||
i = ((n.errMsg = "getNetworkType:ok"), n.subtype);
|
||||
if ((delete n.subtype, i)) n.networkType = i;
|
||||
else {
|
||||
var i = e.indexOf(":"),
|
||||
t = e.substring(i + 1);
|
||||
switch (t) {
|
||||
case "wifi":
|
||||
case "edge":
|
||||
case "wwan":
|
||||
n.networkType = t;
|
||||
break;
|
||||
default:
|
||||
n.errMsg = "getNetworkType:fail";
|
||||
}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openLocation: function (e) {
|
||||
k(
|
||||
"openLocation",
|
||||
{
|
||||
latitude: e.latitude,
|
||||
longitude: e.longitude,
|
||||
name: e.name || "",
|
||||
address: e.address || "",
|
||||
scale: e.scale || 28,
|
||||
infoUrl: e.infoUrl || "",
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
hideOptionMenu: function (e) {
|
||||
k("hideOptionMenu", {}, e);
|
||||
},
|
||||
showOptionMenu: function (e) {
|
||||
k("showOptionMenu", {}, e);
|
||||
},
|
||||
closeWindow: function (e) {
|
||||
k("closeWindow", {}, (e = e || {}));
|
||||
},
|
||||
hideMenuItems: function (e) {
|
||||
k("hideMenuItems", { menuList: e.menuList }, e);
|
||||
},
|
||||
showMenuItems: function (e) {
|
||||
k("showMenuItems", { menuList: e.menuList }, e);
|
||||
},
|
||||
hideAllNonBaseMenuItem: function (e) {
|
||||
k("hideAllNonBaseMenuItem", {}, e);
|
||||
},
|
||||
showAllNonBaseMenuItem: function (e) {
|
||||
k("showAllNonBaseMenuItem", {}, e);
|
||||
},
|
||||
scanQRCode: function (e) {
|
||||
k(
|
||||
"scanQRCode",
|
||||
{
|
||||
needResult: (e = e || {}).needResult || 0,
|
||||
scanType: e.scanType || ["qrCode", "barCode"],
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
var n;
|
||||
u &&
|
||||
(n = e.resultStr) &&
|
||||
((n = JSON.parse(n)),
|
||||
(e.resultStr = n && n.scan_code && n.scan_code.scan_result));
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openAddress: function (e) {
|
||||
k(
|
||||
a.openAddress,
|
||||
{},
|
||||
((e._complete = function (e) {
|
||||
((e = e).postalCode = e.addressPostalCode),
|
||||
delete e.addressPostalCode,
|
||||
(e.provinceName = e.proviceFirstStageName),
|
||||
delete e.proviceFirstStageName,
|
||||
(e.cityName = e.addressCitySecondStageName),
|
||||
delete e.addressCitySecondStageName,
|
||||
(e.countryName = e.addressCountiesThirdStageName),
|
||||
delete e.addressCountiesThirdStageName,
|
||||
(e.detailInfo = e.addressDetailInfo),
|
||||
delete e.addressDetailInfo;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openProductSpecificView: function (e) {
|
||||
k(
|
||||
a.openProductSpecificView,
|
||||
{
|
||||
pid: e.productId,
|
||||
view_type: e.viewType || 0,
|
||||
ext_info: e.extInfo,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
addCard: function (e) {
|
||||
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
|
||||
var r = n[t],
|
||||
r = { card_id: r.cardId, card_ext: r.cardExt };
|
||||
i.push(r);
|
||||
}
|
||||
k(
|
||||
a.addCard,
|
||||
{ card_list: i },
|
||||
((e._complete = function (e) {
|
||||
if ((n = e.card_list)) {
|
||||
for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
|
||||
var o = n[i];
|
||||
(o.cardId = o.card_id),
|
||||
(o.cardExt = o.card_ext),
|
||||
(o.isSuccess = !!o.is_succ),
|
||||
delete o.card_id,
|
||||
delete o.card_ext,
|
||||
delete o.is_succ;
|
||||
}
|
||||
(e.cardList = n), delete e.card_list;
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
chooseCard: function (e) {
|
||||
k(
|
||||
"chooseCard",
|
||||
{
|
||||
app_id: h.appId,
|
||||
location_id: e.shopId || "",
|
||||
sign_type: e.signType || "SHA1",
|
||||
card_id: e.cardId || "",
|
||||
card_type: e.cardType || "",
|
||||
card_sign: e.cardSign,
|
||||
time_stamp: e.timestamp + "",
|
||||
nonce_str: e.nonceStr,
|
||||
},
|
||||
((e._complete = function (e) {
|
||||
(e.cardList = e.choose_card_info), delete e.choose_card_info;
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
openCard: function (e) {
|
||||
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
|
||||
var r = n[t],
|
||||
r = { card_id: r.cardId, code: r.code };
|
||||
i.push(r);
|
||||
}
|
||||
k(a.openCard, { card_list: i }, e);
|
||||
},
|
||||
consumeAndShareCard: function (e) {
|
||||
k(
|
||||
a.consumeAndShareCard,
|
||||
{ consumedCardId: e.cardId, consumedCode: e.code },
|
||||
e
|
||||
);
|
||||
},
|
||||
chooseWXPay: function (e) {
|
||||
k(a.chooseWXPay, x(e), e), B({ jsApiName: "chooseWXPay" });
|
||||
},
|
||||
openEnterpriseRedPacket: function (e) {
|
||||
k(a.openEnterpriseRedPacket, x(e), e);
|
||||
},
|
||||
startSearchBeacons: function (e) {
|
||||
k(a.startSearchBeacons, { ticket: e.ticket }, e);
|
||||
},
|
||||
stopSearchBeacons: function (e) {
|
||||
k(a.stopSearchBeacons, {}, e);
|
||||
},
|
||||
onSearchBeacons: function (e) {
|
||||
M(a.onSearchBeacons, e);
|
||||
},
|
||||
openEnterpriseChat: function (e) {
|
||||
k(
|
||||
"openEnterpriseChat",
|
||||
{ useridlist: e.userIds, chatname: e.groupName },
|
||||
e
|
||||
);
|
||||
},
|
||||
launchMiniProgram: function (e) {
|
||||
k(
|
||||
"launchMiniProgram",
|
||||
{
|
||||
targetAppId: e.targetAppId,
|
||||
path: (function (e) {
|
||||
var n;
|
||||
if ("string" == typeof e && 0 < e.length)
|
||||
return (
|
||||
(n = e.split("?")[0]),
|
||||
(n += ".html"),
|
||||
void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n
|
||||
);
|
||||
})(e.path),
|
||||
envVersion: e.envVersion,
|
||||
},
|
||||
e
|
||||
);
|
||||
},
|
||||
openBusinessView: function (e) {
|
||||
k(
|
||||
"openBusinessView",
|
||||
{
|
||||
businessType: e.businessType,
|
||||
queryString: e.queryString || "",
|
||||
envVersion: e.envVersion,
|
||||
},
|
||||
((e._complete = function (n) {
|
||||
if (l) {
|
||||
var e = n.extraData;
|
||||
if (e)
|
||||
try {
|
||||
n.extraData = JSON.parse(e);
|
||||
} catch (e) {
|
||||
n.extraData = {};
|
||||
}
|
||||
}
|
||||
}),
|
||||
e)
|
||||
);
|
||||
},
|
||||
miniProgram: {
|
||||
navigateBack: function (e) {
|
||||
(e = e || {}),
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "navigateBack", arg: { delta: e.delta || 1 } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
navigateTo: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "navigateTo", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
redirectTo: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "redirectTo", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
switchTab: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "switchTab", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
reLaunch: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "reLaunch", arg: { url: e.url } },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
postMessage: function (e) {
|
||||
O(function () {
|
||||
k(
|
||||
"invokeMiniProgramAPI",
|
||||
{ name: "postMessage", arg: e.data || {} },
|
||||
e
|
||||
);
|
||||
});
|
||||
},
|
||||
getEnv: function (e) {
|
||||
O(function () {
|
||||
e({ miniprogram: "miniprogram" === r.__wxjs_environment });
|
||||
});
|
||||
},
|
||||
},
|
||||
}),
|
||||
(w = 1),
|
||||
(T = {}),
|
||||
n.addEventListener(
|
||||
"error",
|
||||
function (e) {
|
||||
var n, i, t;
|
||||
l ||
|
||||
((t = (n = e.target).tagName),
|
||||
(i = n.src),
|
||||
"IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) ||
|
||||
(-1 != i.indexOf("wxlocalresource://") &&
|
||||
(e.preventDefault(),
|
||||
e.stopPropagation(),
|
||||
(t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)),
|
||||
T[t] ||
|
||||
((T[t] = !0),
|
||||
wx.ready(function () {
|
||||
wx.getLocalImgData({
|
||||
localId: i,
|
||||
success: function (e) {
|
||||
n.src = e.localData;
|
||||
},
|
||||
});
|
||||
}))));
|
||||
},
|
||||
!0
|
||||
),
|
||||
n.addEventListener(
|
||||
"load",
|
||||
function (e) {
|
||||
var n;
|
||||
l ||
|
||||
((n = (e = e.target).tagName),
|
||||
e.src,
|
||||
"IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) ||
|
||||
((n = e["wx-id"]) && (T[n] = !1));
|
||||
},
|
||||
!0
|
||||
),
|
||||
e && (r.wx = r.jWeixin = _),
|
||||
_
|
||||
);
|
||||
else return r.jWeixin;
|
||||
function k(n, e, i) {
|
||||
r.WeixinJSBridge
|
||||
? WeixinJSBridge.invoke(n, P(e), function (e) {
|
||||
V(n, e, i);
|
||||
})
|
||||
: C(n, i);
|
||||
}
|
||||
function M(n, i, t) {
|
||||
r.WeixinJSBridge
|
||||
? WeixinJSBridge.on(n, function (e) {
|
||||
t && t.trigger && t.trigger(e), V(n, e, i);
|
||||
})
|
||||
: C(n, t || i);
|
||||
}
|
||||
function P(e) {
|
||||
return (
|
||||
((e = e || {}).appId = h.appId),
|
||||
(e.verifyAppId = h.appId),
|
||||
(e.verifySignType = "sha1"),
|
||||
(e.verifyTimestamp = h.timestamp + ""),
|
||||
(e.verifyNonceStr = h.nonceStr),
|
||||
(e.verifySignature = h.signature),
|
||||
e
|
||||
);
|
||||
}
|
||||
function x(e) {
|
||||
return {
|
||||
timeStamp: e.timestamp + "",
|
||||
nonceStr: e.nonceStr,
|
||||
package: e.package,
|
||||
paySign: e.paySign,
|
||||
signType: e.signType || "SHA1",
|
||||
};
|
||||
}
|
||||
function V(e, n, i) {
|
||||
("openEnterpriseChat" != e && "openBusinessView" !== e) ||
|
||||
(n.errCode = n.err_code),
|
||||
delete n.err_code,
|
||||
delete n.err_desc,
|
||||
delete n.err_detail;
|
||||
var t = n.errMsg,
|
||||
e =
|
||||
(t ||
|
||||
((t = n.err_msg),
|
||||
delete n.err_msg,
|
||||
(t = (function (e, n) {
|
||||
var i = c[e];
|
||||
i && (e = i);
|
||||
i = "ok";
|
||||
{
|
||||
var t;
|
||||
n &&
|
||||
((t = n.indexOf(":")),
|
||||
("access denied" !=
|
||||
(i = (i = (i =
|
||||
-1 !=
|
||||
(i =
|
||||
-1 !=
|
||||
(i =
|
||||
"failed" ==
|
||||
(i = "confirm" == (i = n.substring(t + 1)) ? "ok" : i)
|
||||
? "fail"
|
||||
: i).indexOf("failed_")
|
||||
? i.substring(7)
|
||||
: i).indexOf("fail_")
|
||||
? i.substring(5)
|
||||
: i).replace(/_/g, " ")).toLowerCase()) &&
|
||||
"no permission to execute" != i) ||
|
||||
(i = "permission denied"),
|
||||
"" ==
|
||||
(i =
|
||||
"config" == e && "function not exist" == i ? "ok" : i)) &&
|
||||
(i = "fail");
|
||||
}
|
||||
return (n = e + ":" + i);
|
||||
})(e, t)),
|
||||
(n.errMsg = t)),
|
||||
(i = i || {})._complete && (i._complete(n), delete i._complete),
|
||||
(t = n.errMsg || ""),
|
||||
h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)),
|
||||
t.indexOf(":"));
|
||||
switch (t.substring(e + 1)) {
|
||||
case "ok":
|
||||
i.success && i.success(n);
|
||||
break;
|
||||
case "cancel":
|
||||
i.cancel && i.cancel(n);
|
||||
break;
|
||||
default:
|
||||
i.fail && i.fail(n);
|
||||
}
|
||||
i.complete && i.complete(n);
|
||||
}
|
||||
function A(e) {
|
||||
if (e) {
|
||||
for (var n = 0, i = e.length; n < i; ++n) {
|
||||
var t = e[n],
|
||||
t = a[t];
|
||||
t && (e[n] = t);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
}
|
||||
function C(e, n) {
|
||||
var i;
|
||||
!h.debug ||
|
||||
(n && n.isInnerInvoke) ||
|
||||
((i = c[e]) && (e = i),
|
||||
n && n._complete && delete n._complete,
|
||||
console.log('"' + e + '",', n || ""));
|
||||
}
|
||||
function B(n) {
|
||||
var i;
|
||||
o ||
|
||||
s ||
|
||||
h.debug ||
|
||||
p < "6.0.2" ||
|
||||
g.systemType < 0 ||
|
||||
((i = new Image()),
|
||||
(g.appId = h.appId),
|
||||
(g.initTime = m.initEndTime - m.initStartTime),
|
||||
(g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime),
|
||||
_.getNetworkType({
|
||||
isInnerInvoke: !0,
|
||||
success: function (e) {
|
||||
g.networkType = e.networkType;
|
||||
e =
|
||||
"https://open.weixin.qq.com/sdk/report?v=" +
|
||||
g.version +
|
||||
"&o=" +
|
||||
g.isPreVerifyOk +
|
||||
"&s=" +
|
||||
g.systemType +
|
||||
"&c=" +
|
||||
g.clientVersion +
|
||||
"&a=" +
|
||||
g.appId +
|
||||
"&n=" +
|
||||
g.networkType +
|
||||
"&i=" +
|
||||
g.initTime +
|
||||
"&p=" +
|
||||
g.preVerifyTime +
|
||||
"&u=" +
|
||||
g.url +
|
||||
"&jsapi_name=" +
|
||||
(n ? n.jsApiName : "");
|
||||
i.src = e;
|
||||
},
|
||||
}));
|
||||
}
|
||||
function L() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
function O(e) {
|
||||
d &&
|
||||
(r.WeixinJSBridge
|
||||
? e()
|
||||
: n.addEventListener &&
|
||||
n.addEventListener("WeixinJSBridgeReady", e, !1));
|
||||
}
|
||||
});
|
||||
15
node_modules/weixin-js-sdk/package.json
generated
vendored
Normal file
15
node_modules/weixin-js-sdk/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "weixin-js-sdk",
|
||||
"version": "1.6.5",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
|
||||
},
|
||||
"homepage": "https://yanxi123.com/",
|
||||
"__npminstall_done": true,
|
||||
"_from": "weixin-js-sdk@1.6.5",
|
||||
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
|
||||
}
|
||||
5
package.json
Normal file
5
package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"weixin-js-sdk": "^1.6.5"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<block v-else>
|
||||
<view v-if="goods_list.length > 0" class="page-bottom-fixed">
|
||||
<!-- 模式选择,站点类型选择 销售+自提 -->
|
||||
<view v-if="buy_site_model_list.length > 1" class="buy-site-model bg-white oh tc" :class="'count-'+buy_site_model_list.length">
|
||||
<view v-if="buy_site_model_list.length > 1" class="buy-site-model bg-white oh tc" :class="'count-' + buy_site_model_list.length">
|
||||
<block v-for="(item, index) in buy_site_model_list" :key="index">
|
||||
<view :class="'item fl cp ' + (buy_site_model_active_index == index ? 'nav-active-line cr-main' : 'cr-base')" :data-index="index" :data-value="item.value" @tap="buy_site_model_event">{{ item.name }}</view>
|
||||
</block>
|
||||
@@ -30,7 +30,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="padding-top-xl padding-bottom-xxxl cr-grey">
|
||||
{{ (buy_site_model_value == 2) ? $t('buy.buy.wq7gnb') : $t('buy.buy.6rk813') }}
|
||||
{{ buy_site_model_value == 2 ? $t('buy.buy.wq7gnb') : $t('buy.buy.6rk813') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-divider spacing-mb"></view>
|
||||
@@ -54,11 +54,11 @@
|
||||
<!-- 自提客户名称和电话 -->
|
||||
<block v-if="(buy_extraction_contact_info || null) != null && (buy_extraction_contact_info.is_write || false) == true">
|
||||
<view class="form-gorup row padding-horizontal-0 padding-top-0">
|
||||
<view class="form-gorup-title margin-right">{{$t('buy.buy.df3raf')}}</view>
|
||||
<view class="form-gorup-title margin-right">{{ $t('buy.buy.df3raf') }}</view>
|
||||
<input type="text" name="extraction_contact_name" :value="buy_extraction_contact_info.name" data-value="name" @input="extraction_contact_event" maxlength="30" placeholder-class="cr-grey-9" class="cr-base br-b-f9" :placeholder="$t('user-address-save.user-address-save.65507o')" />
|
||||
</view>
|
||||
<view class="form-gorup row padding-horizontal-0 padding-top-0">
|
||||
<view class="form-gorup-title margin-right">{{$t('buy.buy.hjwerf')}}</view>
|
||||
<view class="form-gorup-title margin-right">{{ $t('buy.buy.hjwerf') }}</view>
|
||||
<input type="text" name="extraction_contact_tel" :value="buy_extraction_contact_info.tel" data-value="tel" @input="extraction_contact_event" maxlength="30" placeholder-class="cr-grey-9" class="cr-base br-b-f9" :placeholder="$t('user-address-save.user-address-save.65507o')" />
|
||||
</view>
|
||||
</block>
|
||||
@@ -234,7 +234,7 @@
|
||||
</block>
|
||||
</block>
|
||||
<!-- 支付方式 -->
|
||||
<view v-if="common_order_is_booking != 1 && payment_list.length > 0" :class="(plugins_coin_is_valid ? 'br-t-f9' : '')">
|
||||
<view v-if="common_order_is_booking != 1 && payment_list.length > 0" :class="plugins_coin_is_valid ? 'br-t-f9' : ''">
|
||||
<view v-for="(item, index) in payment_list" :key="index">
|
||||
<view class="item flex-row jc-sb align-c" :data-value="item.id" :data-index="index" @tap="payment_event">
|
||||
<view class="item-content pr flex-1 flex-width">
|
||||
@@ -253,7 +253,7 @@
|
||||
<!-- 底部说明 - 智能工具箱插件 -->
|
||||
<view v-if="(plugins_intellectstools_data || null) != null && (plugins_intellectstools_data.bottom_desc || null) != null && plugins_intellectstools_data.bottom_desc.length > 0" class="border-radius-main padding-main bg-white oh cr-orange spacing-mb">
|
||||
<view v-for="(item, index) in plugins_intellectstools_data.bottom_desc" :key="index">
|
||||
<view :class="index > 0 ? 'margin-top' : ''">{{item}}</view>
|
||||
<view :class="index > 0 ? 'margin-top' : ''">{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -355,6 +355,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import wx from 'weixin-js-sdk';
|
||||
const app = getApp();
|
||||
import base64 from '@/common/js/lib/base64.js';
|
||||
import componentCommon from '@/components/common/common';
|
||||
@@ -441,6 +442,7 @@
|
||||
to_fail_page: '/pages/user-order/user-order',
|
||||
// 现金--跳转指定页面
|
||||
to_appoint_page: '/pages/user-order/user-order',
|
||||
wx_appid: '',
|
||||
};
|
||||
},
|
||||
|
||||
@@ -472,12 +474,15 @@
|
||||
params: params,
|
||||
is_realstore_model: (params.realstore_id || null) != null,
|
||||
plugins_points_status: app.globalData.get_config('plugins_base.points.data.is_default_use_points', null) == 1,
|
||||
pay_url: app.globalData.get_request_url('pay', 'order'),
|
||||
// pay_url: app.globalData.get_request_url('pay', 'order'),
|
||||
pay_url: app.globalData.get_request_url('getpayment', 'xo'),
|
||||
qrcode_url: app.globalData.get_request_url('paycheck', 'order'),
|
||||
});
|
||||
|
||||
// 删除地址缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
|
||||
this.initWechatSdk();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
@@ -505,6 +510,103 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化微信 JS-SDK
|
||||
initWechatSdk(config) {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('getconfigwx', 'xo'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
console.log('initWechatSdk', res);
|
||||
if (res.data.code == 0) {
|
||||
let data = res.data.data;
|
||||
this.wx_appid = data.appId;
|
||||
wx.config({
|
||||
debug: data.debug,
|
||||
appId: data.appId,
|
||||
timestamp: data.timestamp,
|
||||
nonceStr: data.nonceStr,
|
||||
signature: data.signature,
|
||||
jsApiList: data.jsApiList,
|
||||
});
|
||||
|
||||
wx.ready(() => {
|
||||
console.log('微信 JS-SDK 初始化成功');
|
||||
});
|
||||
|
||||
wx.error((res) => {
|
||||
console.error('微信 JS-SDK 初始化失败:', res);
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 处理授权登录
|
||||
handleAuthLogin() {
|
||||
if (this.wx_appid) {
|
||||
const appId = this.wx_appid; // 替换为你的微信公众号 appId
|
||||
const redirectUri = encodeURIComponent(window.location.href);
|
||||
const scope = 'snsapi_userinfo';
|
||||
const state = 'STATE';
|
||||
const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`;
|
||||
window.location.replace(authUrl);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '微信初始化失败',
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取授权码 code
|
||||
getCodeFromUrl() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
return urlParams.get('code');
|
||||
},
|
||||
// 发起支付请求
|
||||
async onPay(order_id, payment_id = 0, payment_list) {
|
||||
let web_openid = localStorage.getItem('web_openid');
|
||||
console.log('onPay.web_openid===', web_openid);
|
||||
if (!web_openid) {
|
||||
// 获取code换取web_openid
|
||||
const code = this.getCodeFromUrl();
|
||||
console.log('code===', code);
|
||||
if (!code) {
|
||||
this.handleAuthLogin();
|
||||
return;
|
||||
}
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('getwechatuserinfo', 'xo'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
code: code,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
console.log('获取微信web_openid===', res.data);
|
||||
if (res.data.code == 0) {
|
||||
let data = res.data.data;
|
||||
localStorage.setItem('web_openid', data.openid);
|
||||
|
||||
this.$refs.payment.pay_handle(order_id, payment_id, payment_list);
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// 直接走支付流程
|
||||
this.$refs.payment.pay_handle(order_id, payment_id, payment_list);
|
||||
}
|
||||
},
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
@@ -521,7 +623,7 @@
|
||||
// 获取数据
|
||||
init() {
|
||||
// 订单是否已经提交进入支付
|
||||
if(this.is_order_submit_payment == 1) {
|
||||
if (this.is_order_submit_payment == 1) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
@@ -562,7 +664,7 @@
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
if(this.is_first == 0) {
|
||||
if (this.is_first == 0) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.loading_in_text'),
|
||||
});
|
||||
@@ -581,7 +683,7 @@
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if(this.is_first == 0) {
|
||||
if (this.is_first == 0) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
if (res.data.code == 0) {
|
||||
@@ -594,14 +696,16 @@
|
||||
});
|
||||
|
||||
// 首次
|
||||
if(this.is_first == 1) {
|
||||
if (this.is_first == 1) {
|
||||
// 赋值默认支付方式
|
||||
var default_payment_id = parseInt(data.default_payment_id || 0);
|
||||
if(this.payment_list.length > 0 && default_payment_id > 0) {
|
||||
var temp_payment_ids = this.payment_list.map(function(item){return item.id;});
|
||||
if(temp_payment_ids.indexOf(default_payment_id) != -1) {
|
||||
var default_payment_id = parseInt(data.payment_list[0].id);
|
||||
if (this.payment_list.length > 0 && default_payment_id > 0) {
|
||||
var temp_payment_ids = this.payment_list.map(function (item) {
|
||||
return item.id;
|
||||
});
|
||||
if (temp_payment_ids.indexOf(default_payment_id) != -1) {
|
||||
this.setData({
|
||||
payment_id: default_payment_id
|
||||
payment_id: default_payment_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -640,7 +744,7 @@
|
||||
// 天结束时间
|
||||
time_end: temp_dt.time_end || '',
|
||||
// 随机类型(区间还是固定时间, 0或1)
|
||||
range_type: (temp_dt.range_type == undefined || parseInt(temp_dt.range_type || 0) == 1),
|
||||
range_type: temp_dt.range_type == undefined || parseInt(temp_dt.range_type || 0) == 1,
|
||||
// 可选最大天数
|
||||
range_day: parseInt(temp_dt.range_day || 2),
|
||||
// 禁止选择的时间
|
||||
@@ -702,12 +806,12 @@
|
||||
});
|
||||
|
||||
// 非门店模式则赋值指定的类型模式
|
||||
if(this.is_first == 1) {
|
||||
if (this.is_first == 1) {
|
||||
if (this.buy_site_model_list.length > 0) {
|
||||
for(var i in this.buy_site_model_list) {
|
||||
if(this.buy_site_model_list[i]['value'] == this.buy_site_model_value) {
|
||||
for (var i in this.buy_site_model_list) {
|
||||
if (this.buy_site_model_list[i]['value'] == this.buy_site_model_value) {
|
||||
this.setData({
|
||||
buy_site_model_active_index: i
|
||||
buy_site_model_active_index: i,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -767,7 +871,7 @@
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
if(this.is_first == 0) {
|
||||
if (this.is_first == 0) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
this.setData({
|
||||
@@ -980,24 +1084,28 @@
|
||||
app.globalData.url_open(self.to_appoint_page, true);
|
||||
},
|
||||
});
|
||||
} else if(res.data.order_status == 2) {
|
||||
} else if (res.data.order_status == 2) {
|
||||
// 线下支付(开启线下订单正常进入流程)
|
||||
app.globalData.url_open(this.to_appoint_page, true);
|
||||
|
||||
} else {
|
||||
// 调起支付
|
||||
this.$refs.payment.pay_handle(res.data.order_ids.join(','), res.data.payment_id, this.payment_list);
|
||||
// 支付方法
|
||||
|
||||
// 其他页面的支付方法 pay_handle(order_id, payment_id = 0, payment_list = [])
|
||||
|
||||
// this.$refs.payment.pay_handle(res.data.order_ids.join(','), res.data.payment_id, this.payment_list);
|
||||
|
||||
this.onPay(res.data.order_ids.join(','), res.data.payment_id, this.payment_list);
|
||||
}
|
||||
this.setData({
|
||||
is_order_submit_payment: 1
|
||||
is_order_submit_payment: 1,
|
||||
});
|
||||
},
|
||||
|
||||
// 支付方式选择
|
||||
payment_event(e) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
this.setData({
|
||||
payment_id: (this.payment_id == value) ? 0 : value,
|
||||
payment_id: this.payment_id == value ? 0 : value,
|
||||
plugins_coin_payment_id: 0,
|
||||
});
|
||||
this.init();
|
||||
@@ -1007,7 +1115,7 @@
|
||||
plugins_coin_payment_event(e) {
|
||||
var value = e.currentTarget.dataset.value;
|
||||
this.setData({
|
||||
plugins_coin_payment_id: (this.plugins_coin_payment_id == value) ? 0 : value,
|
||||
plugins_coin_payment_id: this.plugins_coin_payment_id == value ? 0 : value,
|
||||
payment_id: 0,
|
||||
});
|
||||
this.init();
|
||||
@@ -1139,7 +1247,7 @@
|
||||
// 是否门店模式下
|
||||
if (this.is_realstore_model) {
|
||||
// 覆盖选择的门店下单类型参数索引值
|
||||
upd_data['params'] = {...this.params, ...{buy_use_type_data_index: this.buy_site_model_list[index]['index']}};
|
||||
upd_data['params'] = { ...this.params, ...{ buy_use_type_data_index: this.buy_site_model_list[index]['index'] } };
|
||||
}
|
||||
this.setData(upd_data);
|
||||
|
||||
|
||||
336
pages/index/goods-category.css
Normal file
336
pages/index/goods-category.css
Normal file
@@ -0,0 +1,336 @@
|
||||
/**
|
||||
* 头部背景
|
||||
*/
|
||||
.goods-top-bg {
|
||||
height: calc(320rpx + var(--status-bar-height) + 5px);
|
||||
/* #ifdef H5 */
|
||||
height: 286rpx;
|
||||
/* #endif */
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.goods-top-search-bg {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航搜索、内容区域
|
||||
*/
|
||||
.nav-search {
|
||||
padding-right: 250rpx;
|
||||
/* #ifdef MP-ALIPAY */
|
||||
padding-right: 255rpx;
|
||||
padding-left: 80rpx;
|
||||
/* #endif */
|
||||
/* #ifdef H5 || MP-TOUTIAO || APP */
|
||||
padding-right: 20rpx;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
padding-top: 20rpx !important;
|
||||
/* #endif */
|
||||
padding-bottom: 20rpx;
|
||||
height: 64rpx;
|
||||
z-index: 5;
|
||||
display: flex;
|
||||
}
|
||||
.nav-more-top {
|
||||
/* #ifdef H5 || APP */
|
||||
top: 135rpx !important;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/**
|
||||
* 左侧导航
|
||||
*/
|
||||
.left-nav {
|
||||
width: 200rpx;
|
||||
background-color: #f5f5f5;
|
||||
height: 100%;
|
||||
}
|
||||
.left-nav .item {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 10rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
.left-nav .nav-active {
|
||||
background: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* 右侧内容
|
||||
*/
|
||||
.right-container {
|
||||
width: calc(100% - 200rpx);
|
||||
height: 100%;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
.content-item {
|
||||
width: calc(100% / 3);
|
||||
}
|
||||
.content-item .content {
|
||||
padding: 28rpx;
|
||||
}
|
||||
.content-item .text {
|
||||
font-weight: 600;
|
||||
}
|
||||
.content-item .icon {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
}
|
||||
.content-item.two-img .icon {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
}
|
||||
.content-item.two-img .content {
|
||||
padding: 26rpx 0;
|
||||
}
|
||||
.model-one .content-item:nth-child(3n) {
|
||||
border-right: 0;
|
||||
}
|
||||
.model-one .content .desc {
|
||||
min-height: 52rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
.model-one .content {
|
||||
height: 240rpx;
|
||||
}
|
||||
.one-content image {
|
||||
height: 120rpx;
|
||||
}
|
||||
.text-random-1,
|
||||
.text-random-2,
|
||||
.text-random-3,
|
||||
.text-random-4,
|
||||
.text-random-5,
|
||||
.text-random-6,
|
||||
.text-random-7,
|
||||
.text-random-8,
|
||||
.text-random-9 {
|
||||
position: relative;
|
||||
}
|
||||
.text-random-1::before,
|
||||
.text-random-2::before,
|
||||
.text-random-3::before,
|
||||
.text-random-4::before,
|
||||
.text-random-5::before,
|
||||
.text-random-6::before,
|
||||
.text-random-7::before,
|
||||
.text-random-8::before,
|
||||
.text-random-9::before {
|
||||
content: '';
|
||||
width: 126rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.text-random-1::before {
|
||||
background: linear-gradient(90deg, #F2C3A5 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-2::before {
|
||||
background: linear-gradient(90deg, #FF9BBB 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-3::before {
|
||||
background: linear-gradient(90deg, #EAC5A9 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-4::before {
|
||||
background: linear-gradient(90deg, #F7BEBE 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-5::before {
|
||||
background: linear-gradient(90deg, #F2DC86 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-6::before {
|
||||
background: linear-gradient(90deg, #98B7E8 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-7::before {
|
||||
background: linear-gradient(90deg, #CD92F3 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-8::before {
|
||||
background: linear-gradient(90deg, #5EEA7C 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
.text-random-9::before {
|
||||
background: linear-gradient(90deg, #E67A7A 0%, rgba(255, 255, 255, 0) 100%);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品列表模式
|
||||
*/
|
||||
.category-content {
|
||||
height: 100vh;
|
||||
/* #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || MP-ALIPAY || APP */
|
||||
height: calc(100vh - 134rpx - var(--window-bottom));
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - 104rpx - var(--window-bottom));
|
||||
/* #endif */
|
||||
}
|
||||
.category-content.goods-model {
|
||||
padding-top: 182rpx;
|
||||
}
|
||||
.top-nav {
|
||||
height: 182rpx;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.top-nav-scroll {
|
||||
width: calc(100% - 70rpx);
|
||||
}
|
||||
.top-nav .icon-content {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
padding: 1px;
|
||||
}
|
||||
.top-nav-scroll .item:first-of-type {
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
.top-nav .item {
|
||||
padding: 20rpx 4rpx;
|
||||
}
|
||||
.nav-list-more {
|
||||
width: 100%;
|
||||
max-height: 550rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.nav-list-more image {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.nav-list-more .item {
|
||||
width: 20%;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.goods-right-content {
|
||||
width: calc(100% - 200rpx);
|
||||
height: calc(100% - 182rpx);
|
||||
top: 182rpx;
|
||||
right: 0;
|
||||
}
|
||||
.right-content-actual .item {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.right-content-actual .item:not(:last-of-type) {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.right-content-actual .item .plugins-label-img {
|
||||
border-top-left-radius: 10rpx;
|
||||
}
|
||||
.goods-right-content.category-one-subset-content {
|
||||
width: 100%;
|
||||
}
|
||||
.goods-list-top-nav {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
}
|
||||
.nav-sort-content .sort-item {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
width: 20%;
|
||||
}
|
||||
.nav-sort-content .sort-item .sort-icon {
|
||||
width: 26rpx;
|
||||
height: 26rpx !important;
|
||||
}
|
||||
.goods-list .goods-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.goods-list .goods-base {
|
||||
width: calc(100% - 200rpx);
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
.goods-list .goods-base-content {
|
||||
min-height: 100rpx;
|
||||
}
|
||||
.goods-list .goods-base .simple-desc {
|
||||
line-height: 30rpx;
|
||||
min-height: 30rpx;
|
||||
max-height: 58rpx;
|
||||
}
|
||||
.goods-list .goods-base .sales-price {
|
||||
width: calc(100% - 140rpx);
|
||||
}
|
||||
.goods-list .goods-base .buy-number {
|
||||
min-width: 32rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部导航
|
||||
*/
|
||||
.botton-nav {
|
||||
width: calc(100% - 60rpx);
|
||||
left: auto;
|
||||
bottom: 20rpx;
|
||||
z-index: 2;
|
||||
margin-left: 20rpx;
|
||||
box-shadow: 0rpx 4rpx 8rpx 0px rgba(0, 0, 0, 0.16);
|
||||
line-height: 84rpx;
|
||||
height: 84rpx;
|
||||
}
|
||||
.botton-nav .btn {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
.botton-nav .cart .badge-icon {
|
||||
top: -20rpx;
|
||||
right: -2rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*/
|
||||
.cart-mask {
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: rgb(0, 0, 0, 0.6);
|
||||
z-index: 5;
|
||||
}
|
||||
.cart-content {
|
||||
left: auto;
|
||||
bottom: 150rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
z-index: 6;
|
||||
max-width: calc(800px - 40rpx);
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.cart-content .cart-list {
|
||||
max-height: 60vh;
|
||||
}
|
||||
.cart-content .cart-list .goods-img {
|
||||
width: 132rpx;
|
||||
height: 132rpx !important;
|
||||
}
|
||||
.cart-content .cart-list .goods-base {
|
||||
padding-right: 0;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
.cart-content .cart-list .goods-base-content {
|
||||
min-height: 60rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 无数据
|
||||
*/
|
||||
.no-data {
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
/*
|
||||
* 隐藏滚动条
|
||||
*/
|
||||
scroll-view ::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
665
pages/index/index1.vue
Normal file
665
pages/index/index1.vue
Normal file
@@ -0,0 +1,665 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view :class="(plugins_mourning_data_is_app ? ' grayscale' : '') + (is_single_page == 1 ? ' single-page-top' : '')">
|
||||
<!-- diy模式 -->
|
||||
<block v-if="data_mode == 3">
|
||||
<block v-if="(data_list || null) != null && (data_list.config || null) != null">
|
||||
<componentDiy :propValue="data_list.config" :propDataId="data_list.id" :propKey="random_value" @onLocationBack="user_back_choice_location">
|
||||
<!-- 底部内容 -->
|
||||
<template slot="diy-bottom-content">
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
<!-- 版权信息 -->
|
||||
<component-copyright></component-copyright>
|
||||
</template>
|
||||
<!-- 底部公共 -->
|
||||
<template slot="diy-bottom-common">
|
||||
<component-common ref="common" :propIsGrayscale="plugins_mourning_data_is_app"></component-common>
|
||||
</template>
|
||||
</componentDiy>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-no-data propStatus="0" propPage="home"></component-no-data>
|
||||
</block>
|
||||
</block>
|
||||
<!-- 自动和手动模式 -->
|
||||
<block v-else>
|
||||
<!-- 顶部内容、如果没有轮播和导航则使用矮的浮动导航背景样式,则使用高的背景样式 -->
|
||||
<view v-if="load_status == 1" class="home-top-nav-content pr" :style="(banner_list.length > 0 || navigation.length > 0 ? top_content_bg_color : top_content_search_bg_color) + top_content_style">
|
||||
<!-- 顶部背景图片 -->
|
||||
<view class="pa top-0 left-0 right-0">
|
||||
<image class="bg-img wh-auto" mode="widthFix" :src="static_url + 'nav-top.png'"></image>
|
||||
</view>
|
||||
|
||||
<!-- 搜索 -->
|
||||
<view v-if="common_app_is_header_nav_fixed == 1" :class="'search-fixed-seat ' + (common_app_is_enable_search == 1 ? 'nav-enable-search' : '')"></view>
|
||||
<view :class="'pr ' + (common_app_is_header_nav_fixed == 1 ? 'search-content-fixed' : '')" :style="common_app_is_header_nav_fixed == 1 ? top_content_search_bg_color : ''">
|
||||
<view :class="'search-content-fixed-content ' + (common_app_is_enable_search == 1 ? 'nav-enable-search' : '')" :style="(common_app_is_header_nav_fixed == 1 ? top_content_style : '') + (common_app_is_header_nav_fixed == 1 ? top_content_search_content_style : '')">
|
||||
<view class="home-top-nav margin-bottom-sm pr padding-right-main">
|
||||
<!-- 定位 -->
|
||||
<view v-if="is_home_location_choice == 1" class="home-top-nav-location dis-inline-block va-m single-text cr-white pr bs-bb padding-left-main padding-right-lg">
|
||||
<component-choice-location @onBack="user_back_choice_location"></component-choice-location>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- logo/标题 -->
|
||||
<view class="home-top-nav-logo dis-inline-block va-m padding-left-main">
|
||||
<block v-if="is_home_logo_use_text == 0 && (application_logo || null) != null">
|
||||
<image :src="application_logo" mode="heightFix" class="home-top-nav-logo-image"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view v-if="(application_title || null) != null" class="home-top-nav-logo-title cr-white single-text">{{ application_title }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<!-- #ifdef H5 || APP -->
|
||||
<!-- 右上角icon列表 -->
|
||||
<view v-if="(right_icon_list || null) != null && right_icon_list.length > 0" class="nav-top-right-icon fr">
|
||||
<block v-for="(item, index) in right_icon_list">
|
||||
<view class="item dis-inline-block cp pr" :data-value="item.url || ''" @tap="url_event">
|
||||
<iconfont :name="item.icon" size="38rpx" color="#fff"></iconfont>
|
||||
<view v-if="(item.badge || null) != null" class="badge-icon pa">
|
||||
<component-badge :propNumber="item.badge"></component-badge>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view v-if="common_app_is_enable_search == 1" class="search-content-input padding-horizontal-main">
|
||||
<!-- 是否开启搜索框前面icon扫一扫 -->
|
||||
<block v-if="is_home_search_scan == 1">
|
||||
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"
|
||||
<!-- #ifndef H5 -->
|
||||
@onicon="search_icon_event" propIcon="icon-scan" :propIsIconOnEvent="true"
|
||||
<!-- #endif -->
|
||||
></component-search>
|
||||
</block>
|
||||
<block v-else>
|
||||
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"></component-search>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 轮播 -->
|
||||
<view class="banner-content padding-horizontal-main margin-top-xs" v-if="banner_list.length > 0">
|
||||
<component-banner :propData="banner_list" @changeBanner="change_banner"></component-banner>
|
||||
</view>
|
||||
<!-- 导航 -->
|
||||
<view v-if="navigation.length > 0" class="spacing-mt" :class="load_status == 1 && (common_shop_notice || null) != null ? '' : ' spacing-mb'">
|
||||
<view class="padding-horizontal-main">
|
||||
<view class="bg-white border-radius-main">
|
||||
<component-icon-nav :propData="{ ...{ data: navigation }, ...{ random: random_value } }"></component-icon-nav>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容 -->
|
||||
<view class="content padding-horizontal-main pr">
|
||||
<!-- 商城公告 -->
|
||||
<view v-if="load_status == 1 && (common_shop_notice || null) != null" class="notice">
|
||||
<uni-notice-bar show-icon scrollable :text="common_shop_notice" background-color="transparent" color="#666" />
|
||||
</view>
|
||||
<!-- 推荐文章 -->
|
||||
<view v-if="article_list.length > 0" class="article-list padding-main border-radius-main oh bg-white spacing-mb">
|
||||
<view mode="aspectFit" class="new-icon va-m fl cp pr divider-r" data-value="/pages/article-category/article-category" @tap="url_event">
|
||||
<text>{{ $t('index.index.t8bll8') }}</text
|
||||
><text class="cr-red">{{ $t('index.index.t8bll9') }}</text>
|
||||
</view>
|
||||
<view class="right-content fr va-m">
|
||||
<swiper :vertical="true" :autoplay="true" :circular="true" display-multiple-items="1" interval="3000">
|
||||
<block v-for="(item, index) in article_list" :key="index">
|
||||
<swiper-item class="single-text">
|
||||
<text class="cr-base text-size-sm cp" :data-value="item.category_url" @tap="url_event">[{{ item.article_category_name }}]</text>
|
||||
<text class="cr-base text-size-sm margin-left-xs cp" :style="(item.title_color || null) != null ? 'color:' + item.title_color + ' !important;' : ''" :data-value="item.url" @tap="url_event">{{ item.title }}</text>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 按照插件顺序渲染插件数据 -->
|
||||
<block v-if="plugins_sort_list.length > 0">
|
||||
<block v-for="(pv, pi) in plugins_sort_list" :key="pi">
|
||||
<!-- 首页中间广告 - 插件 -->
|
||||
<view v-if="pv.plugins == 'homemiddleadv' && (plugins_homemiddleadv_data || null) != null && plugins_homemiddleadv_data.length > 0" class="plugins-homemiddleadv oh spacing-mb">
|
||||
<view v-for="(item, index) in plugins_homemiddleadv_data" :key="index" class="item border-radius-main oh cp" :data-value="item.url || ''" @tap="url_event">
|
||||
<image class="dis-block wh-auto border-radius-main" :src="item.images" mode="widthFix"> </image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 限时秒杀 - 插件 -->
|
||||
<view v-if="pv.plugins == 'seckill' && (plugins_seckill_data || null) != null && (plugins_seckill_data.data || null) != null && (plugins_seckill_data.data.goods || null) != null && plugins_seckill_data.data.goods.length > 0" class="plugins-seckill-data border-radius-main spacing-mb bg-white" :style="'background-image: url(' + seckill_static_url + 'seckill-bg.png);'">
|
||||
<view class="flex-row jc-sb align-c padding-top-main padding-horizontal-main">
|
||||
<view class="flex-1">
|
||||
<image class="dis-inline-block va-m icon" :src="plugins_seckill_data.data.home_title_icon" mode="widthFix"></image>
|
||||
<view class="dis-inline-block va-m margin-left-sm">
|
||||
<component-countdown :propHour="plugins_seckill_data.data.time.hours" :propMinute="plugins_seckill_data.data.time.minutes" :propSecond="plugins_seckill_data.data.time.seconds"></component-countdown>
|
||||
</view>
|
||||
</view>
|
||||
<text data-value="/pages/plugins/seckill/index/index" @tap="url_event" class="arrow-right padding-right cr-grey text-size-xs cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-goods-list :propData="{ style_type: 2, goods_list: plugins_seckill_data.data.goods }" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index" :propOpenCart="false"></component-goods-list>
|
||||
</view>
|
||||
|
||||
<!-- 活动配置-楼层顶部 - 插件 -->
|
||||
<view v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
|
||||
<component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="0" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index"></component-activity-list>
|
||||
</view>
|
||||
|
||||
<!-- 门店 - 插件 -->
|
||||
<view v-if="pv.plugins == 'realstore' && (plugins_realstore_data || null) != null">
|
||||
<view v-if="(plugins_realstore_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_realstore_data.base.home_data_list_title }}</text>
|
||||
<text data-value="/pages/plugins/realstore/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-realstore-list :propData="{ ...{ data: plugins_realstore_data.data }, ...{ random: random_value } }"></component-realstore-list>
|
||||
</view>
|
||||
|
||||
<!-- 多商户 - 插件 -->
|
||||
<view v-if="pv.plugins == 'shop' && (plugins_shop_data || null) != null">
|
||||
<view v-if="(plugins_shop_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_shop_data.base.home_data_list_title }}</text>
|
||||
<text data-value="/pages/plugins/shop/index/index" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-shop-list :propConfig="plugins_shop_data.base" :propData="{ ...{ data: plugins_shop_data.data }, ...{ random: random_value } }"></component-shop-list>
|
||||
</view>
|
||||
|
||||
<!-- 组合搭配 - 插件 -->
|
||||
<view v-if="pv.plugins == 'binding' && (plugins_binding_data || null) != null">
|
||||
<view v-if="(plugins_binding_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_binding_data.base.home_data_list_title }}</text>
|
||||
<text data-value="/pages/plugins/binding/index/index" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<component-binding-list :propConfig="plugins_binding_data.base" :propData="{ ...{ data: plugins_binding_data.data }, ...{ random: random_value } }" :propCurrencySymbol="currency_symbol"></component-binding-list>
|
||||
</view>
|
||||
|
||||
<!-- 博客-楼层顶部 - 插件 -->
|
||||
<view v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
|
||||
<component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="0"></component-blog-list>
|
||||
</view>
|
||||
|
||||
<!-- 魔方 - 插件 -->
|
||||
<view v-if="pv.plugins == 'magic' && (plugins_magic_data || null) != null">
|
||||
<component-magic-list :propData="{ ...plugins_magic_data, ...{ random: random_value } }" :propCurrencySymbol="currency_symbol" :propLabel="plugins_label_data"></component-magic-list>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 楼层数据 -->
|
||||
<block v-if="(data_list || null) != null && data_list.length > 0">
|
||||
<!-- 数据模式0,1自动+手动、2拖拽 -->
|
||||
<block v-if="data_mode == 2">
|
||||
<!-- 引入拖拽数据模块 -->
|
||||
<component-layout :propData="data_list"></component-layout>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 自动+手动 -->
|
||||
<view v-for="(floor, index) in data_list" :key="index" class="floor">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<view class="title-left">
|
||||
<text class="text-wrapper title-left-border" :style="'color:' + (floor.bg_color || '#333') + ';'">{{ floor.name }}</text>
|
||||
<text v-if="(floor.describe || null) != null" class="vice-name margin-left-lg cr-grey">{{ floor.describe }}</text>
|
||||
</view>
|
||||
<text :data-value="'/pages/goods-search/goods-search?category_id=' + floor.id" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
|
||||
</view>
|
||||
<view class="floor-list wh-auto oh pr">
|
||||
<block v-if="(floor.goods || null) != null && floor.goods.length > 0">
|
||||
<component-goods-list :propData="{ style_type: 1, goods_list: floor.goods }" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index"></component-goods-list>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 按照插件顺序渲染插件数据 -->
|
||||
<block v-if="plugins_sort_list.length > 0">
|
||||
<block v-for="(pv, pi) in plugins_sort_list" :key="pi">
|
||||
<!-- 活动配置-楼层底部 - 插件 -->
|
||||
<view v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
|
||||
<component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="1" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" propSource="index" :propOpenCart="false"></component-activity-list>
|
||||
</view>
|
||||
|
||||
<!-- 博客-楼层底部 - 插件 -->
|
||||
<view v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
|
||||
<component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="1"></component-blog-list>
|
||||
</view>
|
||||
|
||||
<!--- 底部购买记录 - 插件 -->
|
||||
<view v-if="pv.plugins == 'salerecords' && (plugins_salerecords_data || null) != null && (plugins_salerecords_data.data || null) != null && plugins_salerecords_data.data.length > 0" class="plugins-salerecords bg-white border-radius-main padding-main spacing-mb">
|
||||
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
|
||||
<view class="title-left">
|
||||
<text class="text-wrapper">{{ plugins_salerecords_data.base.home_bottom_title || $t('index.index.s5r784') }}</text>
|
||||
<text v-if="(plugins_salerecords_data.base || null) != null && (plugins_salerecords_data.base.home_bottom_desc || null) != null" class="vice-name margin-left-sm cr-grey-9">{{ plugins_salerecords_data.base.home_bottom_desc }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="oh">
|
||||
<swiper :vertical="true" :autoplay="true" :circular="true" :display-multiple-items="plugins_salerecords_data.data.length < 6 ? plugins_salerecords_data.data.length : 6" interval="3000" :style="plugins_salerecords_data.data.length < 6 ? 'height:' + plugins_salerecords_data.data.length * 84.33 + 'rpx;' : ''">
|
||||
<block v-for="(item, index) in plugins_salerecords_data.data" :key="index">
|
||||
<swiper-item>
|
||||
<view class="item oh padding-vertical-main">
|
||||
<view class="item-content single-text fl">
|
||||
<image mode="widthFix" :src="item.user.avatar" class="va-m br"> </image>
|
||||
<text class="margin-left-sm">{{ item.user.user_name_view }}</text>
|
||||
<text v-if="(item.user.province || null) != null"><text class="padding-left-xs padding-right-xs">-</text>{{ item.user.province }}</text>
|
||||
</view>
|
||||
<view class="item-content fl">
|
||||
<view :data-value="item.goods_url" @tap="url_event" class="cp single-text">
|
||||
<image mode="widthFix" :src="item.images" class="va-m br"> </image>
|
||||
<text class="margin-left-sm single-text">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-content single-text fr tr cr-grey padding-top-xs">
|
||||
{{ item.add_time }}
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<block v-if="load_status == 0">
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg" propPage="home" :propIsHeader="true"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 页面已加载、模式 -->
|
||||
<block v-if="load_status == 1 && data_mode != 3">
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<!-- 版权信息 -->
|
||||
<component-copyright></component-copyright>
|
||||
|
||||
<!-- 在线客服 -->
|
||||
<component-online-service :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data_is_app"></component-online-service>
|
||||
|
||||
<!-- 快捷导航 -->
|
||||
<component-quick-nav :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data_is_app"></component-quick-nav>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common" :propIsGrayscale="plugins_mourning_data_is_app"></component-common>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentSearch from '@/components/search/search';
|
||||
import componentQuickNav from '@/components/quick-nav/quick-nav';
|
||||
import componentIconNav from '@/components/icon-nav/icon-nav';
|
||||
import componentBanner from '@/components/slider/slider';
|
||||
import componentCountdown from '@/components/countdown/countdown';
|
||||
import componentLayout from '@/components/layout/layout';
|
||||
import componentBadge from '@/components/badge/badge';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentCopyright from '@/components/copyright/copyright';
|
||||
import componentOnlineService from '@/components/online-service/online-service';
|
||||
import componentActivityList from '@/components/activity-list/activity-list';
|
||||
import componentBlogList from '@/components/blog-list/blog-list';
|
||||
import componentRealstoreList from '@/components/realstore-list/realstore-list';
|
||||
import componentShopList from '@/components/shop-list/shop-list';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
import componentBindingList from '@/components/binding-list/binding-list';
|
||||
import componentMagicList from '@/components/magic-list/magic-list';
|
||||
import componentDiy from '@/components/diy/diy';
|
||||
import componentChoiceLocation from '@/components/choice-location/choice-location';
|
||||
|
||||
// 状态栏高度
|
||||
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
|
||||
// #ifdef MP-TOUTIAO
|
||||
bar_height = 0;
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: '',
|
||||
theme_color: '',
|
||||
common_static_url: '',
|
||||
seckill_static_url: '',
|
||||
static_url: '',
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
load_status: 0,
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
is_home_search_scan: app.globalData.data.is_home_search_scan,
|
||||
data_list: [],
|
||||
banner_list: [],
|
||||
navigation: [],
|
||||
article_list: [],
|
||||
cart_total: 0,
|
||||
message_total: 0,
|
||||
right_icon_list: [],
|
||||
// 首页数据模式
|
||||
data_mode: 0,
|
||||
// 增加随机数,避免无法监听数据列表内部数据更新
|
||||
random_value: 0,
|
||||
// 基础配置
|
||||
common_shop_notice: null,
|
||||
common_app_is_enable_search: 0,
|
||||
common_app_is_header_nav_fixed: 0,
|
||||
common_app_is_online_service: 0,
|
||||
// 顶部导航、名称、logo、定位
|
||||
application_title: app.globalData.data.application_title,
|
||||
application_logo: app.globalData.data.application_logo,
|
||||
is_home_logo_use_text: app.globalData.data.is_home_logo_use_text,
|
||||
is_home_location_choice: app.globalData.data.is_home_location_choice,
|
||||
// 顶部+搜索样式配置
|
||||
top_content_bg_color: '',
|
||||
top_content_search_bg_color: '',
|
||||
top_content_search_content_style: '',
|
||||
// #ifdef MP
|
||||
top_content_style: 'padding-top:' + (bar_height + 10) + 'px;',
|
||||
// #endif
|
||||
// #ifdef H5 || MP-TOUTIAO
|
||||
top_content_style: 'padding-top:' + (bar_height + 14) + 'px;',
|
||||
// #endif
|
||||
// #ifdef APP
|
||||
top_content_style: 'padding-top:' + bar_height + 'px;',
|
||||
// #endif
|
||||
// 是否单页预览
|
||||
is_single_page: app.globalData.is_current_single_page() || 0,
|
||||
// 轮播滚动时,背景色替换
|
||||
slider_bg: null,
|
||||
// 插件顺序列表
|
||||
plugins_sort_list: [],
|
||||
// 限时秒杀插件
|
||||
plugins_seckill_data: null,
|
||||
// 购买记录插件
|
||||
plugins_salerecords_data: null,
|
||||
// 活动配置插件
|
||||
plugins_activity_data: null,
|
||||
// 标签插件
|
||||
plugins_label_data: null,
|
||||
// 首页中间广告插件
|
||||
plugins_homemiddleadv_data: null,
|
||||
// 哀悼灰度插件
|
||||
plugins_mourning_data_is_app: app.globalData.is_app_mourning(),
|
||||
// 标签插件
|
||||
plugins_blog_data: null,
|
||||
// 门店插件
|
||||
plugins_realstore_data: null,
|
||||
// 多商户插件
|
||||
plugins_shop_data: null,
|
||||
// 组合搭配插件
|
||||
plugins_binding_data: null,
|
||||
// 魔方插件
|
||||
plugins_magic_data: null,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentSearch,
|
||||
componentQuickNav,
|
||||
componentIconNav,
|
||||
componentBanner,
|
||||
componentCountdown,
|
||||
componentLayout,
|
||||
componentBadge,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentCopyright,
|
||||
componentOnlineService,
|
||||
componentActivityList,
|
||||
componentBlogList,
|
||||
componentRealstoreList,
|
||||
componentShopList,
|
||||
componentGoodsList,
|
||||
componentBindingList,
|
||||
componentMagicList,
|
||||
componentDiy,
|
||||
componentChoiceLocation,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show({object: this, method: 'init'});
|
||||
}
|
||||
|
||||
// 设置顶部导航的默认颜色
|
||||
this.set_navigation_bar_color();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
if (this.data_list_loding_status === 1) {
|
||||
uni.stopPullDownRefresh();
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
common_shop_notice: app.globalData.get_config('config.common_shop_notice'),
|
||||
common_app_is_enable_search: app.globalData.get_config('config.common_app_is_enable_search'),
|
||||
common_app_is_header_nav_fixed: app.globalData.get_config('config.common_app_is_header_nav_fixed'),
|
||||
common_app_is_online_service: app.globalData.get_config('config.common_app_is_online_service'),
|
||||
application_title: app.globalData.get_application_title(),
|
||||
application_logo: app.globalData.get_application_logo(),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init(params = {}) {
|
||||
// 还没有数据则读取缓存
|
||||
var cache_key = app.globalData.data.cache_index_data_key;
|
||||
if (this.load_status == 0) {
|
||||
// 本地缓存数据
|
||||
var upd_data = uni.getStorageSync(cache_key) || null;
|
||||
if (upd_data != null) {
|
||||
// 先使用缓存数据展示
|
||||
this.setData(upd_data);
|
||||
|
||||
// 初始化返回公共处理
|
||||
this.init_result_common_handle();
|
||||
|
||||
// 已有本地缓存则直接取远程有效数据(默认首次取的是远程缓存数据)
|
||||
params['is_cache'] = 0;
|
||||
|
||||
// 设置顶部导航的默认颜色
|
||||
this.set_navigation_bar_color();
|
||||
}
|
||||
} else {
|
||||
// 已有本地缓存则直接取远程有效数据(默认首次取的是远程缓存数据)
|
||||
params['is_cache'] = 0;
|
||||
}
|
||||
|
||||
// 网络检查
|
||||
if ((params || null) == null || (params.loading || 0) == 0) {
|
||||
app.globalData.network_type_handle(this, 'init', params);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 没有缓存数据则开启加载层
|
||||
if (upd_data == null) {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
}
|
||||
// 请求远程数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index'),
|
||||
method: 'POST',
|
||||
data: params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
// 数据处理
|
||||
var data = res.data.data;
|
||||
if (res.data.code == 0) {
|
||||
var data_list = data.data_list || null;
|
||||
var upd_data = {
|
||||
random_value: Math.random(),
|
||||
data_bottom_line_status: true,
|
||||
banner_list: data.banner_list || [],
|
||||
navigation: data.navigation || [],
|
||||
article_list: data.article_list || [],
|
||||
data_mode: data.data_mode || 0,
|
||||
data_list: data_list,
|
||||
cart_total: data.cart_total.buy_number || 0,
|
||||
message_total: parseInt(data.message_total || 0),
|
||||
right_icon_list: data.right_icon_list || [],
|
||||
data_list_loding_status: data_list == null || data_list.length == 0 ? 0 : 3,
|
||||
plugins_sort_list: data.plugins_sort_list || [],
|
||||
plugins_seckill_data: data.plugins_seckill_data || null,
|
||||
plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data,
|
||||
plugins_activity_data: (data.plugins_activity_data || null) == null || data.plugins_activity_data.length <= 0 ? null : data.plugins_activity_data,
|
||||
plugins_label_data: (data.plugins_label_data || null) == null || (data.plugins_label_data.base || null) == null || (data.plugins_label_data.data || null) == null || data.plugins_label_data.data.length <= 0 ? null : data.plugins_label_data,
|
||||
plugins_homemiddleadv_data: (data.plugins_homemiddleadv_data || null) == null || data.plugins_homemiddleadv_data.length <= 0 ? null : data.plugins_homemiddleadv_data,
|
||||
plugins_mourning_data_is_app: parseInt(data.plugins_mourning_data || 0) == 1,
|
||||
plugins_blog_data: data.plugins_blog_data || null,
|
||||
plugins_realstore_data: data.plugins_realstore_data || null,
|
||||
plugins_shop_data: data.plugins_shop_data || null,
|
||||
plugins_binding_data: data.plugins_binding_data || null,
|
||||
plugins_magic_data: data.plugins_magic_data || null,
|
||||
};
|
||||
// 如果开启了哀悼灰色则不固定导航
|
||||
if (upd_data.plugins_mourning_data_is_app == 1) {
|
||||
upd_data['common_app_is_header_nav_fixed'] = 0;
|
||||
}
|
||||
this.setData(upd_data);
|
||||
|
||||
// 存储缓存
|
||||
uni.setStorageSync(cache_key, upd_data);
|
||||
|
||||
// 设置顶部导航的默认颜色
|
||||
this.set_navigation_bar_color();
|
||||
|
||||
// 是否需要重新加载数据
|
||||
if (parseInt(data.is_result_data_cache || 0) == 1) {
|
||||
this.init({ is_cache: 0 });
|
||||
} else {
|
||||
// 购物车导航角标
|
||||
app.globalData.set_tab_bar_badge('cart', this.cart_total);
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化返回公共处理
|
||||
this.init_result_common_handle();
|
||||
},
|
||||
fail: () => {
|
||||
// 轮播数据处理
|
||||
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
|
||||
this.change_banner(app.globalData.get_theme_color());
|
||||
}
|
||||
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
data_bottom_line_status: true,
|
||||
load_status: 1,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 设置顶部导航的默认颜色
|
||||
set_navigation_bar_color() {
|
||||
if(this.data_mode == 3) {
|
||||
app.globalData.set_navigation_bar_color(parseInt(app.globalData.get_key_data(this.data_list, 'config.header.com_data.style.function_buttons_type', 0)) == 1);
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化返回公共处理
|
||||
init_result_common_handle() {
|
||||
var theme_view = app.globalData.get_theme_value_view();
|
||||
var theme_color = app.globalData.get_theme_color();
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
var seckill_static_url = app.globalData.get_static_url('seckill', true) + 'app/';
|
||||
var static_url = app.globalData.get_static_url('home');
|
||||
|
||||
// 轮播数据处理
|
||||
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
|
||||
var color = this.banner_list && this.banner_list.length > 0 && (this.banner_list[0]['bg_color'] || null) != null ? this.banner_list[0]['bg_color'] : theme_color;
|
||||
this.change_banner(color);
|
||||
}
|
||||
|
||||
// 公共数据
|
||||
this.setData({
|
||||
top_content_search_content_style: 'background-image: url("' + static_url + 'nav-top.png");',
|
||||
theme_view: theme_view,
|
||||
theme_color: theme_color,
|
||||
common_static_url: common_static_url,
|
||||
seckill_static_url: seckill_static_url,
|
||||
static_url: static_url,
|
||||
load_status: 1,
|
||||
});
|
||||
|
||||
// 分享菜单处理、延时执行,确保基础数据已加载完成
|
||||
setTimeout(function () {
|
||||
app.globalData.page_share_handle();
|
||||
}, 3000);
|
||||
},
|
||||
|
||||
// 选择用户地理位置回调
|
||||
user_back_choice_location(e) {
|
||||
// 重新刷新数据
|
||||
this.init();
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 轮播改变、背景色处理
|
||||
change_banner(color) {
|
||||
if ((color || null) == null) {
|
||||
color = this.theme_color;
|
||||
}
|
||||
this.setData({
|
||||
top_content_bg_color: 'background: linear-gradient(180deg, ' + color + ' 0%, #f5f5f5 80%);',
|
||||
top_content_search_bg_color: 'background: linear-gradient(180deg, ' + color + ' 0%, #f5f5f5 300%);',
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索icon扫码事件
|
||||
search_icon_event(e) {
|
||||
app.globalData.scan_handle();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './index.css';
|
||||
</style>
|
||||
@@ -255,7 +255,8 @@
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.setData({
|
||||
pay_url: app.globalData.get_request_url('pay', 'order'),
|
||||
// pay_url: app.globalData.get_request_url('pay', 'order'),
|
||||
pay_url: app.globalData.get_request_url('getpayment', 'xo'),
|
||||
qrcode_url: app.globalData.get_request_url('paycheck', 'order'),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user