diff --git a/App.vue b/App.vue index ecfe47c8..54a0b15f 100644 --- a/App.vue +++ b/App.vue @@ -71,7 +71,7 @@ // 请求地址 request_url: 'http://shopxo.com/', // 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/) - static_url: 'http://shopxo.com/', + static_url: 'https://new.shopxo.vip/', // 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立) system_type: 'default', // 基础信息 @@ -241,15 +241,16 @@ /** * 获取用户信息,信息不存在则唤醒授权 * object 回调操作对象 - * method 回调操作对象的函数 + * method 回调操作对象的函数 + * params 回调操请求参数 * return 有用户数据直接返回, 则回调调用者 */ - get_user_info(object, method) { + get_user_info(object, method, params) { var user = this.get_user_cache_info(); if (user == null) { // #ifdef MP // 小程序唤醒用户授权 - this.user_login(object, method); + this.user_login(object, method, params); // #endif // #ifdef H5 || APP @@ -320,33 +321,34 @@ /** * 用户登录 * object 回调操作对象 - * method 回调操作对象的函数 + * method 回调操作对象的函数 + * params 回调请求参数 * auth_data 授权数据 */ - user_auth_login(object, method, auth_data) { + user_auth_login(object, method, params, auth_data) { var self = this; // #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO || MP-KUAISHOU uni.checkSession({ success: function() { var login_data = self.get_login_cache_info(); if (login_data == null) { - self.user_login(object, method); + self.user_login(object, method, params); } else { - self.get_user_login_info(object, method, login_data, auth_data); + self.get_user_login_info(object, method, params, login_data, auth_data); } }, fail: function() { uni.removeStorageSync(self.data.cache_user_login_key); - self.user_login(object, method); + self.user_login(object, method, params); } }); // #endif // #ifdef MP-ALIPAY var login_data = self.get_login_cache_info(); if (login_data == null) { - self.user_login(object, method); + self.user_login(object, method, params); } else { - self.get_user_login_info(object, method, login_data, auth_data); + self.get_user_login_info(object, method, params, login_data, auth_data); } // #endif }, @@ -354,13 +356,13 @@ /** * 用户登录 * object 回调操作对象 - * method 回调操作对象的函数 - * auth_data 授权数据 + * method 回调操作对象的函数 + * params 回调操请求参数 */ - user_login(object, method) { + user_login(object, method, params) { var login_data = uni.getStorageSync(this.data.cache_user_login_key) || null; if (login_data == null) { - this.user_login_handle(object, method, true); + this.user_login_handle(object, method, params, true); } else { this.login_to_auth(); } @@ -369,11 +371,11 @@ /** * 用户登录处理 * object 回调操作对象 - * method 回调操作对象的函数 - * auth_data 授权数据 + * method 回调操作对象的函数 + * params 回调操请求参数 * is_to_auth 是否进入授权 */ - user_login_handle(object, method, is_to_auth = true) { + user_login_handle(object, method, params, is_to_auth = true) { var self = this; uni.showLoading({ title: "授权中..." @@ -400,7 +402,7 @@ if ((data.is_user_exist || 0) == 1 || client_type == 'weixin') { uni.setStorageSync(self.data.cache_user_info_key, data); if (typeof object === 'object' && (method || null) != null) { - object[method](); + object[method](params); } } else { uni.setStorageSync(self.data.cache_user_login_key, data); @@ -408,7 +410,7 @@ var pages = getCurrentPages(); if(pages[pages.length-1]['route'] == 'pages/login/login') { if (typeof object === 'object' && (method || null) != null) { - object[method](); + object[method](params); } } else { self.login_to_auth(); @@ -456,11 +458,12 @@ /** * 获取用户授权信息 * object 回调操作对象 - * method 回调操作对象的函数 + * method 回调操作对象的函数 + * params 回调请求参数 * login_data 登录信息 * auth_data 授权数据 */ - get_user_login_info(object, method, login_data, auth_data) { + get_user_login_info(object, method, params, login_data, auth_data) { // 请求数据 var data = { auth_data: JSON.stringify(auth_data), @@ -483,7 +486,7 @@ if (res.data.code == 0) { uni.setStorageSync(self.data.cache_user_info_key, res.data.data); if (typeof object === 'object' && (method || null) != null) { - object[method](); + object[method](params); } } else { self.showToast(res.data.msg); @@ -798,12 +801,13 @@ /** * 登录校验 * object 回调操作对象 - * method 回调操作对象的函数 + * method 回调操作对象的函数 + * params 回调请求参数 */ - is_login_check(res, object, method) { + is_login_check(res, object, method, params) { if (res.code == -400) { uni.clearStorage(); - this.get_user_info(object, method); + this.get_user_info(object, method, params); return false; } return true; @@ -1743,6 +1747,50 @@ object[method](0); } // #endif + }, + + // 启动位置监听(0 打开小程序监听、1小程序后台运行也监听) + start_location_update(type = 0, object, method) { + // 先停止再调用 + uni.stopLocationUpdate(); + // 关闭监听 + uni.offLocationChange(); + + // 根据类型调用api + if(type == 0) { + // 打开小程序监听 + uni.startLocationUpdate({ + success: (res) => { + this.start_location_update_change(object, method); + }, + fail: res => { + if (typeof object === 'object' && (method || null) != null) { + object[method]({status: 0, msg: res.errMsg}); + } + } + }); + } else { + // 小程序后台运行监听 + uni.startLocationUpdateBackground({ + success: (res) => { + this.start_location_update_change(object, method); + }, + fail: res => { + if (typeof object === 'object' && (method || null) != null) { + object[method]({status: 0, msg: res.errMsg}); + } + } + }); + } + }, + + // 位置监听改变 + start_location_update_change(object, method) { + uni.onLocationChange((res) => { + if (typeof object === 'object' && (method || null) != null) { + object[method]({status: 1, lat: res.longitude, lng: res.latitude, data: res}); + } + }); } }, diff --git a/common/css/page.css b/common/css/page.css index 71a6c628..8fe3368b 100644 --- a/common/css/page.css +++ b/common/css/page.css @@ -174,6 +174,9 @@ button:before { } .dis-inline-block { display: inline-block !important; +} +.va-t { + vertical-align: top; } .va-m { vertical-align: middle; @@ -356,6 +359,9 @@ button:before { } .br-blue { border: solid 1px #2196F3 !important; +} +.br-base { + border: solid 1px #666 !important; } .br-0 { border: 0 !important; diff --git a/manifest.json b/manifest.json index 45d887e2..0371c3da 100644 --- a/manifest.json +++ b/manifest.json @@ -49,7 +49,7 @@ }, "quickapp" : {}, "mp-weixin" : { - "requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress" ], + "requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress", "onLocationChange", "startLocationUpdate", "startLocationUpdateBackground" ], "appid" : "wxda7779770f53e901", "setting" : { "urlCheck" : false, diff --git a/pages.json b/pages.json index f463f04d..074dd5c1 100644 --- a/pages.json +++ b/pages.json @@ -989,6 +989,25 @@ } } ] + }, + { + "root": "pages/plugins/delivery", + "pages": [ + { + "path": "order/order", + "style": { + "enablePullDownRefresh": true, + "navigationBarTitleText": "配送订单" + } + }, + { + "path": "order-detail/order-detail", + "style": { + "enablePullDownRefresh": true, + "navigationBarTitleText": "订单详情" + } + } + ] } ], "globalStyle": { diff --git a/pages/login/login.vue b/pages/login/login.vue index 7a2af8ba..76c828b8 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -580,7 +580,7 @@ // auth_data 授权数据 user_auth_code(auth_data) { if ((auth_data || null) != null) { - app.globalData.user_auth_login(this, 'user_auth_back_event', auth_data); + app.globalData.user_auth_login(this, 'user_auth_back_event', null, auth_data); } else { app.globalData.showToast("授权失败"); } diff --git a/pages/plugins/delivery/order-detail/order-detail.css b/pages/plugins/delivery/order-detail/order-detail.css new file mode 100644 index 00000000..7ce88921 --- /dev/null +++ b/pages/plugins/delivery/order-detail/order-detail.css @@ -0,0 +1,37 @@ +/* +* 商品信息 +*/ +.goods-base { + min-height: 160rpx; + margin-left: 180rpx; +} +.goods .goods-item:last-child { + border-bottom: 0; +} +.goods-image { + width: 160rpx; + height: 160rpx; +} + +/* +* 地址信息 +*/ +.address-base, +.address-detail { + padding: 10rpx 0; +} +.address-detail .icon { + width: 30rpx; + height: 35rpx !important; +} +.address-detail .text { + width: calc(100% - 40rpx); +} +.address-detail .text { + line-height: 36rpx; +} +.address-alias, +.address-map-submit { + padding: 0 15rpx; + line-height: 40rpx; +} \ No newline at end of file diff --git a/pages/plugins/delivery/order-detail/order-detail.vue b/pages/plugins/delivery/order-detail/order-detail.vue new file mode 100644 index 00000000..22979852 --- /dev/null +++ b/pages/plugins/delivery/order-detail/order-detail.vue @@ -0,0 +1,218 @@ + + + \ No newline at end of file diff --git a/pages/plugins/delivery/order/order.css b/pages/plugins/delivery/order/order.css new file mode 100644 index 00000000..8ae1ca77 --- /dev/null +++ b/pages/plugins/delivery/order/order.css @@ -0,0 +1,36 @@ +/* +* 头部 +*/ +.header { + height: 180rpx; +} +.nav-base .item { + width: 20%; +} +.nav-base .item .badge-icon { + top: -18rpx; + left: calc(50% + 52rpx); + z-index: 1; +} +.nav-search input { + width: calc(100% - 180rpx); +} + +/** + * 数据列表 + */ +.scroll-box { + height: calc(100vh - 180rpx); +} +.data-list .address-info { + width: calc(100% - 158rpx); + word-wrap: break-word; + word-break: break-all; +} +.data-list .address-info .icon-item { + right: 0; + top: 0; + line-height: 54rpx; + height: 54rpx; + width: 54rpx; +} \ No newline at end of file diff --git a/pages/plugins/delivery/order/order.vue b/pages/plugins/delivery/order/order.vue new file mode 100644 index 00000000..1c051883 --- /dev/null +++ b/pages/plugins/delivery/order/order.vue @@ -0,0 +1,512 @@ + + + \ No newline at end of file diff --git a/pages/plugins/distribution/order-detail/order-detail.vue b/pages/plugins/distribution/order-detail/order-detail.vue index a6371399..20c65f4a 100644 --- a/pages/plugins/distribution/order-detail/order-detail.vue +++ b/pages/plugins/distribution/order-detail/order-detail.vue @@ -76,10 +76,12 @@ const app = getApp(); import componentNoData from "../../../../components/no-data/no-data"; import componentBottomLine from "../../../../components/bottom-line/bottom-line"; - + + var common_static_url = app.globalData.get_static_url('common'); export default { data() { - return { + return { + common_static_url: common_static_url, params: null, data_list_loding_status: 1, data_list_loding_msg: '', diff --git a/pages/user-order-detail/user-order-detail.vue b/pages/user-order-detail/user-order-detail.vue index 9c4b2226..057b5b1d 100644 --- a/pages/user-order-detail/user-order-detail.vue +++ b/pages/user-order-detail/user-order-detail.vue @@ -13,7 +13,7 @@ {{detail.address_data.province_name}}{{detail.address_data.city_name}}{{detail.address_data.county_name}}{{detail.address_data.address}} - 查看位置 + 查看位置