diff --git a/service-uniapp-client/App.vue b/service-uniapp-client/App.vue
index 7326bee..8ee93a6 100644
--- a/service-uniapp-client/App.vue
+++ b/service-uniapp-client/App.vue
@@ -1,6 +1,5 @@
@@ -267,7 +276,7 @@
}
canvas{
- opacity: 0;
+ opacity: 1;
position: fixed;
top: 100%;
left: 0;
diff --git a/service-uniapp-client/main.js b/service-uniapp-client/main.js
index c1852bb..642d861 100644
--- a/service-uniapp-client/main.js
+++ b/service-uniapp-client/main.js
@@ -22,11 +22,11 @@ import vant from 'vant';
import jweixin from './utils/jweixin-module.js'
import mixinConfigList from '@/mixins/configList.js'
+import store from '@/store/store'
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
import uniDrawer from '@/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue'
-import store from '@/store/store'
//获取url中参数的方法
function GetQueryString(name) {
diff --git a/service-uniapp-client/pages/index/center.vue b/service-uniapp-client/pages/index/center.vue
index 4354c5b..a4a65b8 100644
--- a/service-uniapp-client/pages/index/center.vue
+++ b/service-uniapp-client/pages/index/center.vue
@@ -110,7 +110,6 @@
export default {
data() {
return {
- userInfo: {},
couponNum: 0,
collectNum: 0,
copyright : '',
@@ -119,33 +118,12 @@
}
},
onShow() {
- this.getUserInfo()
+ this.$store.commit('getUserInfo')
this.getCouponNum()
this.getCollectNum()
this.getConfig()
},
methods: {
-
- //获取用户信息
- getUserInfo() {
- this.$api('getUserInfo', {}, res => {
- if (res.code == 200) {
- this.userInfo = res.result;
-
- if(!res.result.phone){ //用户未绑定手机
- this.toPhoneDetail()
- }
- }
- if (res.code == 500 && res.message === '操作失败,用户不存在!') {
- localStorage.removeItem('token')
- localStorage.removeItem('userInfo')
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- })
- },
-
//跳转设置页面
toSetting() {
uni.navigateTo({
diff --git a/service-uniapp-client/pages/index/index.vue b/service-uniapp-client/pages/index/index.vue
index d4050ea..41643b1 100644
--- a/service-uniapp-client/pages/index/index.vue
+++ b/service-uniapp-client/pages/index/index.vue
@@ -141,7 +141,7 @@
onShow() {
this.getBanner()
this.getProject()
- // this.getLocation()
+ this.getLocation()
},
methods: {
//list列表滑动到底部自动新增数据列表
@@ -207,13 +207,13 @@
selectArea(area) {
// this.area = area;
this.showAeraPro = false;
-
- // //后端逻辑
- // this.updateSessionPositon(area)
},
//搜索地址
searchAddress() {
+ if(uni.getStorageSync('open_address') == 0){
+ return
+ }
Position.getLocation(res => {
Position.selectAddress(res.longitude, res.latitude, success => {
let address = this.extractProvinceAndCity(success)
@@ -251,27 +251,17 @@
//获取用户详细地址(省市县)
getLocation() {
+ if(uni.getStorageSync('open_address') == 0){
+ return
+ }
Position.getLocationDetail().then(res => {
- sessionStorage.setItem("position", JSON.stringify(res))
- this.area = res.addressDetail.district
+ if(!this.selectArea.name && this.configList.open_address == 0){
+ this.$store.commit('setArea', {
+ name : res.addressDetail.district
+ })
+ }
})
},
-
- //初始化用户所在地区
- initUserArea() {
- if (!sessionStorage.getItem('position')) return this.getLocation()
- let positionInfo = JSON.parse(sessionStorage.getItem('position'))
- this.area = positionInfo.addressDetail.district
- },
-
- //更新用户所在区域(更新区县信息)
- updateSessionPositon(area) {
- if (sessionStorage.getItem('position')) {
- let position = JSON.parse(sessionStorage.getItem('position'))
- position.addressDetail.district = area
- sessionStorage.setItem('position', JSON.stringify(position))
- }
- }
}
}
diff --git a/service-uniapp-client/pages/index/technician.vue b/service-uniapp-client/pages/index/technician.vue
index 26787f3..caee04e 100644
--- a/service-uniapp-client/pages/index/technician.vue
+++ b/service-uniapp-client/pages/index/technician.vue
@@ -7,14 +7,20 @@
- {{ area }}
+ {{ selectArea.name }}
|
-
-
+
@@ -64,7 +70,7 @@
},
onShow() {
this.getTechnicianList()
- this.initUserArea()
+ this.getLocation()
},
methods: {
//list列表滑动到底部自动新增数据列表
@@ -88,7 +94,7 @@
},
//清空输入框数据
- clearKey() {
+ clearKey() {
this.getTechnicianList();
},
@@ -102,8 +108,6 @@
this.area = area;
this.showAeraPro = false;
- //更新所在地区
- this.updateSessionPositon(area)
},
//显示选择地区
@@ -112,20 +116,16 @@
},
//获取用户详细地址(省市县)
- getLocation() {
+ getLocation() {
Position.getLocationDetail().then(res => {
- sessionStorage.setItem("position", JSON.stringify(res))
- this.area = res.addressDetail.district
+ if(!this.selectArea.name && this.configList.open_address == 0){
+ this.$store.commit('setArea', {
+ name : res.addressDetail.district
+ })
+ }
})
},
- //初始化用户所在地区
- initUserArea(){
- if(!sessionStorage.getItem('position')) return this.getLocation() //获取(详细地址,包括省市区)
- let positionInfo = JSON.parse(sessionStorage.getItem('position'))
- this.area = positionInfo.addressDetail.district
- },
-
//计算距离
calculatedDistance() {
Position.getLocation(result => {
@@ -134,15 +134,6 @@
})
})
},
-
- //更新用户所在区域(更新区县信息)
- updateSessionPositon(area){
- if(sessionStorage.getItem('position')){
- let position = JSON.parse(sessionStorage.getItem('position'))
- position.addressDetail.district = area
- sessionStorage.setItem('position',JSON.stringify(position))
- }
- }
}
}
@@ -212,6 +203,7 @@
font-size: 26rpx;
color: #ccc;
margin: 0rpx 5rpx;
+ // background: transparent;
}
}
diff --git a/service-uniapp-client/pages/login/login.vue b/service-uniapp-client/pages/login/login.vue
index 71673ff..5980cb6 100644
--- a/service-uniapp-client/pages/login/login.vue
+++ b/service-uniapp-client/pages/login/login.vue
@@ -80,8 +80,8 @@
})
},
getwx_authorize() {
- let redirect_uri = encodeURIComponent(import.meta.env.VITE_REDIRECT_URI + '/#/pages/login/login');
- let appid = import.meta.env.VITE_APPID;
+ let redirect_uri = encodeURIComponent(this.configList.user_url + '/#/pages/login/login');
+ let appid = this.configList.wx_appid;
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid +
'&redirect_uri=' + redirect_uri +
'&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect' + '&t=' + new Date().getTime();
@@ -117,10 +117,10 @@
url: '/pages/mine/phoneDetail'
})
} else {
- location.href = import.meta.env.VITE_REDIRECT_URI + '/#/pages/index/index'
+ location.href = this.configList.user_url + '/#/pages/index/index'
}
} else {
- location.href = import.meta.env.VITE_REDIRECT_URI + '/#/pages/login/login'
+ location.href = this.configList.user_url + '/#/pages/login/login'
}
sessionStorage.removeItem('vid')
})
diff --git a/service-uniapp-client/pages/mine/distribution.vue b/service-uniapp-client/pages/mine/distribution.vue
index 4c908eb..7b1e6fc 100644
--- a/service-uniapp-client/pages/mine/distribution.vue
+++ b/service-uniapp-client/pages/mine/distribution.vue
@@ -78,6 +78,7 @@
},
onShow() {
this.getAgentFlow()
+ this.$store.commit('getUserInfo')
},
methods: {
getAgentFlow() {
@@ -110,46 +111,6 @@
this.$refs.placard.draw()
})
},
- wxshare() {
- window.jWeixin.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: 'wxe934cebcbc89d869', // 必填,公众号的唯一标识
- // timestamp: res.data.timestamp, // 必填,生成签名的时间戳
- // nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
- // signature: res.data.signature, // 必填,签名,见附录1
- // surl: res.data.surl, //自己添加的,debug为true的时候可以网页打印出对应的URL是否正确
- jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"]
- });
- window.jWeixin.ready(() => {
- //自定义“分享给朋友”及“分享到QQ”按钮的分享内容(1.4.0)
- window.jWeixin.updateAppMessageShareData({
- title: '邀请新用户', // 分享标题
- desc: "邀请新用户,成为你的粉丝", // 分享描述
- link: "http://tairoudj.natapp1.cc", // 分享链接
- imgUrl: res.result, // 分享图标
- success: res => {
- //点击分享时提示用户分享图,
- this.wxsharetip = true
- },
- cancel: function() {
- // 用户取消分享后执行的回调函数
- }
- });
- //自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容(1.4.0)
- window.jWeixin.updateTimelineShareData({
- title: '标题', // 分享标题
- link: "http://tairoudj.natapp1.cc", // 分享链接
- imgUrl: res.result, // 分享图标
- success: res => {
- //点击分享时提示用户分享图,
- this.wxsharetip = true
- },
- cancel: function() {
- // 用户取消分享后执行的回调函数
- }
- });
- })
- },
tagChange(index) { //选中标签发生改变
this.type = index;
this.getAgentFlow()
diff --git a/service-uniapp-client/pages/order/payOrder.vue b/service-uniapp-client/pages/order/payOrder.vue
index 10e5040..79ca825 100644
--- a/service-uniapp-client/pages/order/payOrder.vue
+++ b/service-uniapp-client/pages/order/payOrder.vue
@@ -108,6 +108,18 @@
+
+
+ 线下付款
+
+
+
+
+
+
+
+
+
账户余额
@@ -174,7 +186,7 @@
已优惠¥{{ coupon.money || 0 }}元
-
+
立即支付
@@ -211,7 +223,7 @@
import selectCouponPopup from '@/components/payOrder/selectCouponPopup.vue'
import configPopup from '@/components/configPopup'
import Position from '@/utils/position.js'
- import { showDialog } from 'vant';
+ import { showDialog, showConfirmDialog } from 'vant';
import { showNotify } from 'vant'
export default {
@@ -330,9 +342,7 @@
url: `/pages/technician/selectTechnician?serviceId=${this.projectDetail.id}`
})
},
-
- //支付
- submit() {
+ handleSubmit(){
if (!this.address.id) {
return this.selectAddressPopupShow = true
}
@@ -345,6 +355,21 @@
icon: 'none'
})
}
+ if(this.payMethod == 2){
+ showConfirmDialog({
+ title: '温馨提示',
+ message: '确认要线下付款吗?',
+ }).then(() => {
+ this.submit()
+ }).catch(() => {
+ console.log("取消下单");
+ })
+ }else{
+ this.submit()
+ }
+ },
+ //支付
+ submit() {
let data = {
addressId: this.address.id, //地址id
orderId: this.order.id, //订单id
@@ -371,6 +396,13 @@
});
} else if (this.payMethod == 0) { //微信支付
this.$wxPay(res,this.paySusscess,this.paySusscess)
+ }else{
+ showDialog({
+ title: '下单成功',
+ message: '下单成功!请前往订单查看',
+ }).then(() => {
+ this.paySusscess()
+ });
}
}else{ //不管订单是否支付成功,直接跳订单页面
this.paySusscess()
diff --git a/service-uniapp-client/plugins/upload.js b/service-uniapp-client/plugins/upload.js
index 04fc32e..f917b7b 100644
--- a/service-uniapp-client/plugins/upload.js
+++ b/service-uniapp-client/plugins/upload.js
@@ -2,6 +2,7 @@
import OSS from "ali-oss"
import { v4 as uuidv4 } from 'uuid';
+import store from "../store/store";
function uploadFileToOSS(file) {
@@ -33,14 +34,20 @@ function uploadFileToOSS(file) {
* 自己的
*/
//桶的地址
- region: 'oss-cn-guangzhou',
- //id
- accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
- //密钥
- accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
- //桶的名字
- bucket: 'hanhaiimage',
- endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+ // region: 'oss-cn-guangzhou',
+ // //id
+ // accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
+ // //密钥
+ // accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
+ // //桶的名字
+ // bucket: 'hanhaiimage',
+ // endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+
+ region : store.state.configList.region,
+ accessKeyId : store.state.configList.accessKeyId,
+ accessKeySecret : store.state.configList.accessKeySecret,
+ bucket : store.state.configList.bucket,
+ endpoint : store.state.configList.endpoint,
});
// 设置文件名和文件目录
@@ -55,7 +62,7 @@ function uploadFileToOSS(file) {
}
}).then(res => {
uni.hideLoading();
- resolve('https://image.hhlm1688.com/' + res.name);
+ resolve(this.configList.staticDomain + res.name);
}).catch(err => {
uni.hideLoading();
reject(err)
diff --git a/service-uniapp-client/store/store.js b/service-uniapp-client/store/store.js
index f6ec845..04c11c6 100644
--- a/service-uniapp-client/store/store.js
+++ b/service-uniapp-client/store/store.js
@@ -2,6 +2,7 @@ import Vuex from 'vuex'
import api from '@/plugins/api.js'
import { handleTree } from '@/plugins/tree.js'
+import share from '@/utils/Share'
//Vuex.Store 构造器选项
const store = new Vuex.createStore({
@@ -22,7 +23,11 @@ const store = new Vuex.createStore({
state.configList[n.keyValue] = n.content
})
}
+ if(state.configList.open_address){
+ uni.setStorageSync('open_address', state.configList.open_address)
+ }
// console.log("initConfig===============", res);
+ share()
})
// let config = ['getPrivacyPolicy', 'getUserAgreement']
@@ -35,9 +40,8 @@ const store = new Vuex.createStore({
// })
},
getUserInfo(state){
- api('getInfo', {}, res => {
+ api('getUserInfo', {}, res => {
if(res.code == 200){
- uni.setStorageSync('userInfo',JSON.stringify(res.result))
state.userInfo = res.result
}
})
diff --git a/service-uniapp-client/utils/position.js b/service-uniapp-client/utils/position.js
index 1ea0d40..f02c0d2 100644
--- a/service-uniapp-client/utils/position.js
+++ b/service-uniapp-client/utils/position.js
@@ -22,6 +22,9 @@ function calculateDistance(lat1, lon1, lat2, lon2) { //计算两点距离
}
function getLocation(fn) { //获取用户经纬度
+ if(uni.getStorageSync('open_address') == 0){
+ return {}
+ }
wxGetLocation() //此方法只用于提示用户打开gps
uni.getLocation({
type: 'gcj02',
@@ -40,6 +43,9 @@ function getLocation(fn) { //获取用户经纬度
}
function getLocationDetail() { //获取用户详细地址
+ if(uni.getStorageSync('open_address') == 0){
+ return {}
+ }
wxGetLocation()
return new Promise((resolve, reject) => {
let key = import.meta.env.VITE_MAP_KEY; //腾讯地图key
diff --git a/service-uniapp-technician/App.vue b/service-uniapp-technician/App.vue
index 9011235..89e4c87 100644
--- a/service-uniapp-technician/App.vue
+++ b/service-uniapp-technician/App.vue
@@ -4,6 +4,7 @@
export default {
onLaunch: function() {
this.$.appContext.app.use(plugins)
+ this.$store.commit('initConfig')
},
onShow: function() {},
onHide: function() {}
diff --git a/service-uniapp-technician/main.js b/service-uniapp-technician/main.js
index 9c273e2..d765f7d 100644
--- a/service-uniapp-technician/main.js
+++ b/service-uniapp-technician/main.js
@@ -24,6 +24,9 @@ import vant from 'vant';
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
import uniDrawer from '@/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue'
+import mixinConfigList from '@/mixins/configList.js'
+import store from '@/store/store'
+
export function createApp() {
const app = createSSRApp(App)
@@ -33,6 +36,10 @@ export function createApp() {
app.use(vant)
// #endif
+
+ app.use(store)
+ app.mixin(mixinConfigList)
+
return {
app
}
diff --git a/service-uniapp-technician/mixins/configList.js b/service-uniapp-technician/mixins/configList.js
new file mode 100644
index 0000000..3581fc3
--- /dev/null
+++ b/service-uniapp-technician/mixins/configList.js
@@ -0,0 +1,14 @@
+
+
+import { mapState } from 'vuex'
+export default {
+ data() {
+ return {
+ }
+ },
+ computed: {
+ ...mapState(['configList', 'userInfo', 'selectArea']),
+ },
+ methods: {
+ }
+}
\ No newline at end of file
diff --git a/service-uniapp-technician/pages/mine/upload.vue b/service-uniapp-technician/pages/mine/upload.vue
index 28a7af6..efe340f 100644
--- a/service-uniapp-technician/pages/mine/upload.vue
+++ b/service-uniapp-technician/pages/mine/upload.vue
@@ -104,13 +104,14 @@ export default {
}
},
deleteImage(index){
+ let self = this
uni.showModal({
title: '确认删除这张照片吗',
confirmText : '确认',
cancelText : '取消',
success: function (res) {
if (res.confirm) {
- this.list.splice(index, 1)
+ self.list.splice(index, 1)
} else if (res.cancel) {}
}
});
diff --git a/service-uniapp-technician/plugins/upload.js b/service-uniapp-technician/plugins/upload.js
index ec6a794..f917b7b 100644
--- a/service-uniapp-technician/plugins/upload.js
+++ b/service-uniapp-technician/plugins/upload.js
@@ -2,6 +2,7 @@
import OSS from "ali-oss"
import { v4 as uuidv4 } from 'uuid';
+import store from "../store/store";
function uploadFileToOSS(file) {
@@ -33,14 +34,20 @@ function uploadFileToOSS(file) {
* 自己的
*/
//桶的地址
- region: 'oss-cn-guangzhou',
- //id
- accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
- //密钥
- accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
- //桶的名字
- bucket: 'hanhaiimage',
- endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+ // region: 'oss-cn-guangzhou',
+ // //id
+ // accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
+ // //密钥
+ // accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
+ // //桶的名字
+ // bucket: 'hanhaiimage',
+ // endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+
+ region : store.state.configList.region,
+ accessKeyId : store.state.configList.accessKeyId,
+ accessKeySecret : store.state.configList.accessKeySecret,
+ bucket : store.state.configList.bucket,
+ endpoint : store.state.configList.endpoint,
});
// 设置文件名和文件目录
@@ -55,8 +62,7 @@ function uploadFileToOSS(file) {
}
}).then(res => {
uni.hideLoading();
- // resolve('https://tennis-oss.xzaiyp.top/' + res.name);
- resolve('https://image.hhlm1688.com/' + res.name);
+ resolve(this.configList.staticDomain + res.name);
}).catch(err => {
uni.hideLoading();
reject(err)
diff --git a/service-uniapp-technician/plugins/utils.js b/service-uniapp-technician/plugins/utils.js
index 4281bda..8c7dea2 100644
--- a/service-uniapp-technician/plugins/utils.js
+++ b/service-uniapp-technician/plugins/utils.js
@@ -58,6 +58,9 @@ function verificationAll(data){
function getLocation(fn){
+ if(uni.getStorageSync('open_address') == 0){
+ return {}
+ }
uni.getLocation({
type: 'wgs84',
geocode:true,//设置该参数为true可直接获取经纬度及城市信息
diff --git a/service-uniapp-technician/store/store.js b/service-uniapp-technician/store/store.js
new file mode 100644
index 0000000..2e02214
--- /dev/null
+++ b/service-uniapp-technician/store/store.js
@@ -0,0 +1,76 @@
+import Vuex from 'vuex'
+
+import api from '@/plugins/api.js'
+// import { handleTree } from '@/plugins/tree.js'
+// import share from '@/utils/Share'
+
+//Vuex.Store 构造器选项
+const store = new Vuex.createStore({
+ state: {
+ configList: {}, //配置列表
+ userInfo : {}, //用户信息
+ areaList : [],//地区列表信息
+ selectArea : {},//当前选择的地区
+ },
+ getters: {
+ },
+ mutations: {
+ // 初始化配置
+ initConfig(state){
+ api('getConfig', {}, res => {
+ if(res.code == 200){
+ res.result.forEach(n => {
+ state.configList[n.keyValue] = n.content
+ })
+ }
+
+ if(state.configList.open_address){
+ uni.setStorageSync('open_address', state.configList.open_address)
+ }
+
+ // console.log("initConfig===============", res);
+ // share()
+ })
+
+ // let config = ['getPrivacyPolicy', 'getUserAgreement']
+ // config.forEach(k => {
+ // api(k, res => {
+ // if (res.code == 200) {
+ // state.configList[k] = res.result
+ // }
+ // })
+ // })
+ },
+ getUserInfo(state){
+ api('getUserInfo', {}, res => {
+ if(res.code == 200){
+ state.userInfo = res.result
+ }
+ })
+ },
+ // 退出登录
+ logout(state){
+ state.userInfo = {}
+ state.role = false
+ state.token = ""
+ uni.removeStorageSync('token')
+ },
+ // 查询地区
+ getArea(state, fn){
+ api('getCurrentArea', {}, res => {
+ if(res.code == 200){
+ state.areaList = handleTree(res.result, 'id', 'pid')
+ fn && fn(res.result)
+
+ state.selectArea = state.areaList[0].children[0].children[0]
+ }
+ })
+ },
+ setArea(state, selectArea){
+ state.selectArea = selectArea
+ },
+ },
+ actions: {},
+})
+
+export default store
\ No newline at end of file