diff --git a/sourcecode/alipay/app.js b/sourcecode/alipay/app.js index 7675ee92a92d848d38173bd118afdffd8515c144..75eaff47b109f370cf29c68826988a5963db8884 100644 --- a/sourcecode/alipay/app.js +++ b/sourcecode/alipay/app.js @@ -1,5 +1,11 @@ App({ data: { + // uuid缓存key + cache_user_uuid_key: "cache_user_uuid_key", + + // 配置信息缓存key + cache_config_info_key: "cache_config_info_key", + // 用户登录缓存key cache_user_login_key: "cache_user_login_key", @@ -59,15 +65,13 @@ App({ "user_orderaftersale": "退款/售后", "user_orderaftersale_detail": "订单售后", "user_order_comments": "订单评论", - "coupon": "领劵中心", - "user_coupon": "优惠劵", "extraction_address": "自提地址", }, // 请求地址 request_url: "{{request_url}}", - // request_url: 'http://shopxo.com/', - // request_url: 'http://dev.shopxo.net/', + request_url: 'http://shopxo.com/', + request_url: 'http://dev.shopxo.net/', // 基础信息 application_title: "{{application_title}}", @@ -80,68 +84,36 @@ App({ /** * 小程序初始化 */ - onLaunch(options) { + onLaunch(params) { + // 启动参数处理 + params = this.launch_params_handle(params); + // 设置设备信息 this.set_system_info(); - // 参数缓存 - my.setStorage({ - key: this.data.cache_launch_info_key, - data: options.query || null - }); - // 启动query参数处理 - this.startup_query(options.query); + // 初始化配置 + this.init_config(); }, /** - * 启动query参数处理 + * 启动参数处理 */ - startup_query(params) { - // 没有启动参数则返回 - if ((params || null) == null) { - return false; + launch_params_handle(params) { + // 启动参数处理 + if ((params.query || null) != null) { + params = params.query; + } + if ((params.scene || null) != null) { + params = this.url_params_to_json(decodeURIComponent(params.scene)); } - // 启动处理类型 - var type = params.type || null; - switch (type) { - // type=page - case "page": - // 页面 - var page = params.page || null; - - // 参数名 - var params_field = params.params_field || null; - - // 参数值 - var params_value = params.params_value || null; - - // 页面跳转 - if(page != null) - { - my.navigateTo({ - url: "/pages/" + page + "/" + page + "?" + params_field + "=" + params_value - }); - } - break; - - // type=view - case "view" : - var url = params.url || null; - - // 页面跳转 - if(url != null) - { - my.navigateTo({ - url: '/pages/web-view/web-view?url='+url - }); - } - break; + // 缓存启动参数 + my.setStorage({ + key: this.data.cache_launch_info_key, + data: params + }); - // 默认 - default: - break; - } + return params; }, /** @@ -200,12 +172,13 @@ App({ // 用户信息 var user = this.get_user_cache_info(); var token = (user == false) ? '' : user.token || ''; + var uuid = this.request_uuid(); return this.data.request_url + "index.php?s=/api/" + c + "/" + a + plugins_params+ "&application=app&application_client_type=alipay" + - "&token=" + - token + + "&token=" + token + "&ajax=ajax" + + "&uuid="+ uuid + params; }, @@ -615,7 +588,7 @@ App({ // 拨打电话 case 4 : - my.makePhoneCall({ number: value }); + this.call_tel(value); break; } } @@ -711,6 +684,22 @@ App({ } }, + /** + * url参数转json对象 + */ + url_params_to_json(url_params) { + var json = new Object(); + if ((url_params || null) != null) + { + var arr = url_params.split('&'); + for(var i = 0; i { + if (res.data.code == 0) { + my.setStorage({ + key: this.data.cache_config_info_key, + data: res.data.data, + fail: () => { + this.showToast('配置信息缓存失败'); + } + }); + } else { + this.showToast(res.data.msg); + } + }, + fail: () => { + this.showToast('服务器请求出错'); + }, + }); + }, + + /** + * 配置是否有效(100毫秒检验一次、最多检验100次) + * object 回调操作对象 + * method 回调操作对象的函数 + */ + is_config(object, method) { + var self = this; + var count = 0; + var timer = setInterval(function() + { + if(self.get_config('status') == 1) + { + clearInterval(timer); + if (typeof object === 'object' && (method || null) != null) { + object[method](true); + } + } + count++; + if(count >= 100) + { + clearInterval(timer); + } + }, 100); + }, + + /** + * 百度坐标BD-09到火星坐标GCJ02(高德,谷歌,腾讯坐标) + * object 回调操作对象 + * method 回调操作对象的函数 + */ + map_bd_to_gcj(lng, lat) { +   let x_pi = 3.14159265358979324 * 3000.0 / 180.0; +   let x = lng - 0.0065; +   let y = lat - 0.006; +   let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); +   let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); +   let lngs = z * Math.cos(theta); +   let lats = z * Math.sin(theta); +   return { +     lng: lngs, +     lat: lats +   }; + }, + + /** + * 百度坐标BD-09到火星坐标GCJ02(高德,谷歌,腾讯坐标) + * lng 经度 + * lat 纬度 + * name 地图上面显示的名称 + * address 地图上面显示的详细地址 + * scale 缩放比例,范围5~18 + */ + open_location(lng, lat, name, address, scale) { + if(lng == undefined || lat == undefined || lng == '' || lat == '') { + this.showToast('坐标有误'); + return false; + } + + // 转换坐标打开位置 + var position = this.map_bd_to_gcj(parseFloat(lng), parseFloat(lat)); + my.openLocation({ + name: name || '', + address: address || '', + scale: scale || 18, + longitude: position.lng, + latitude: position.lat + }); + }, + + // uuid生成 + uuid() { + var d = new Date().getTime(); + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = (d + Math.random() * 16) % 16 | 0; + d = Math.floor(d / 16); + return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); + }); + }, + + // 获取当前uuid + request_uuid() { + var res = my.getStorageSync({key: this.data.cache_user_uuid_key}) || null; + var uuid = res.data || null; + if(uuid == null) { + uuid = this.uuid(); + my.setStorage({ + key: this.data.cache_user_uuid_key, + data: uuid, + fail: () => { + this.showToast('uuid缓存失败'); + } + }); + } + return uuid; + }, + }); diff --git a/sourcecode/alipay/app.json b/sourcecode/alipay/app.json index 4233b1d6e78b9beba07461f96775295517907261..6ccc1c9e6c45eb1306a87f294d5b5bc9c6757b9b 100644 --- a/sourcecode/alipay/app.json +++ b/sourcecode/alipay/app.json @@ -62,10 +62,11 @@ "pages/plugins/wallet/user-cash/user-cash", "pages/plugins/wallet/user-cash-detail/user-cash-detail", "pages/plugins/excellentbuyreturntocash/profit/profit", - "pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail" + "pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail", + "pages/plugins/exchangerate/currency/currency" ], "window": { - "defaultTitle": "{{application_title}}", + "defaultTitle": "shopxo", "titleBarColor": "#d2364c", "backgroundColor": "#f5f5f5" }, diff --git a/sourcecode/alipay/components/quick-nav/quick-nav.acss b/sourcecode/alipay/components/quick-nav/quick-nav.acss new file mode 100644 index 0000000000000000000000000000000000000000..1d6dfe8fa213f83965b1a11fe8d884f8bb3c6515 --- /dev/null +++ b/sourcecode/alipay/components/quick-nav/quick-nav.acss @@ -0,0 +1,101 @@ +/** + * 按钮 + */ +.quick-nav-movable-container { + position: fixed; + width: 100%; + height: 100%; + top: 150rpx; + left: 0; + background:transparent; + pointer-events: none; + z-index: 2; +} +.quick-nav-event-submit { + pointer-events: auto; + position: fixed; + bottom: 150rpx; + width: 100rpx; + height: 100rpx; + border-radius: 50%; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + background-color: rgb(210 54 76 / 80%); +} +.quick-nav-event-submit image { + width: 50rpx; + height: 50rpx; + margin: 25rpx auto 25rpx auto; + display: block; +} + +/** + * 弹窗 + */ +.quick-nav-popup-container { + padding: 20rpx 10rpx 0 10rpx; + background: #fff; +} +.quick-nav-popup-container .close { + overflow: hidden; +} +.quick-nav-popup-container .close .icon-right { + float: right; +} +.quick-nav-popup-content { + max-height: 80vh; + overflow-y: scroll; + overflow-x: hidden; + padding-bottom: 20rpx; +} + +/** + * 内容 + */ +.quick-nav-data-list { + overflow: hidden; + background: #fff; +} +.quick-nav-data-list .items { + width: calc(25% - 60rpx); + float: left; + padding: 30rpx; +} +.quick-nav-data-list .items-content { + border-radius: 50%; + padding: 20rpx; + text-align: center; + width: 70rpx; + height: 70rpx; + margin: 0 auto; +} +.quick-nav-data-list .items image { + width: 60rpx !important; + height: 60rpx !important; + margin-top: 5rpx; +} +.quick-nav-data-list .items .title { + margin-top: 10rpx; + font-size: 28rpx !important; + text-align:center; + -o-text-overflow: ellipsis; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + max-width: 100%; +} + +/* + * 没有数据 + */ +.quick-nav-popup-container .no-data-box { + padding: 80rpx 0; + text-align: center; +} +.quick-nav-popup-container .no-data-box image { + width: 160rpx; + margin-bottom: 30rpx; +} +.quick-nav-popup-container .no-data-box .no-data-tips { + font-size: 28rpx; + color: #a6a6a6; +} \ No newline at end of file diff --git a/sourcecode/alipay/components/quick-nav/quick-nav.axml b/sourcecode/alipay/components/quick-nav/quick-nav.axml new file mode 100644 index 0000000000000000000000000000000000000000..568a71b6684c99b23aa5158c405d334d91cb63c4 --- /dev/null +++ b/sourcecode/alipay/components/quick-nav/quick-nav.axml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + \ No newline at end of file diff --git a/sourcecode/alipay/components/quick-nav/quick-nav.js b/sourcecode/alipay/components/quick-nav/quick-nav.js new file mode 100644 index 0000000000000000000000000000000000000000..36a37c437431a8ac8ab5a1ee95829df70be14567 --- /dev/null +++ b/sourcecode/alipay/components/quick-nav/quick-nav.js @@ -0,0 +1,53 @@ +const app = getApp(); +Component({ + data: { + popup_status: false, + data_list: [], + system: null, + x: 0, + y: 0, + is_first: 1, + }, + + // 页面被展示 + didMount() { + // 非首次进入则重新初始化配置接口 + if(this.data.is_first == 0) { + app.init_config(); + } + + // 数据设置 + var system = app.get_system_info(); + this.setData({ + is_first: 0, + system: system, + x: 5, + y: (system.windowHeight || 450)-160, + }); + }, + methods: { + // 初始化配置 + init_config(status) { + if((status || false) == true) { + this.setData({ data_list: app.get_config('quick_nav') || [] }); + } else { + app.is_config(this, 'init_config'); + } + }, + + // 弹层开启 + quick_open_event(e) { + this.setData({popup_status: true, data_list: app.get_config('quick_nav') || []}); + }, + + // 弹层关闭 + quick_close_event(e) { + this.setData({ popup_status: false }); + }, + + // 操作事件 + navigation_event(e) { + app.operation_event(e); + }, + }, +}); diff --git a/sourcecode/alipay/components/quick-nav/quick-nav.json b/sourcecode/alipay/components/quick-nav/quick-nav.json new file mode 100644 index 0000000000000000000000000000000000000000..66d926bfe9d3a4f612e44869cb5c57c38bcdae2a --- /dev/null +++ b/sourcecode/alipay/components/quick-nav/quick-nav.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "component-popup": "/components/popup/popup" + } +} \ No newline at end of file diff --git a/sourcecode/alipay/images/quick-submit-icon.png b/sourcecode/alipay/images/quick-submit-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b3cab1bf47fb54067142e96ba2f0941f5208cdc7 Binary files /dev/null and b/sourcecode/alipay/images/quick-submit-icon.png differ diff --git a/sourcecode/alipay/pages/buy/buy.acss b/sourcecode/alipay/pages/buy/buy.acss index 99657b11f4383a7a56b0929ab921c0ee8292e3d2..72eb381e7e1dd214a7fe2b56754f5319d2c4cfce 100644 --- a/sourcecode/alipay/pages/buy/buy.acss +++ b/sourcecode/alipay/pages/buy/buy.acss @@ -160,13 +160,11 @@ /** * 留言 */ -.content-textarea-view, -.content-textarea-view textarea { - height: 180rpx; +.content-textarea-view { padding: 5rpx; } -.content-textarea-view view { - padding: 12rpx; +.content-textarea-view textarea { + height: 180rpx; } /** diff --git a/sourcecode/alipay/pages/buy/buy.axml b/sourcecode/alipay/pages/buy/buy.axml index 58abf740088c510860df44ee98209cda575e94ca..07204ae9b623ceea46efc607d35f26884dd5f129 100644 --- a/sourcecode/alipay/pages/buy/buy.axml +++ b/sourcecode/alipay/pages/buy/buy.axml @@ -86,8 +86,7 @@ -