Browse Source

提交第二个版本

v2
前端-胡立永 4 months ago
parent
commit
a25b76bce5
19 changed files with 246 additions and 161 deletions
  1. +0
    -2
      service-uniapp-client/App.vue
  2. +25
    -16
      service-uniapp-client/components/placard.vue
  3. +1
    -1
      service-uniapp-client/main.js
  4. +1
    -23
      service-uniapp-client/pages/index/center.vue
  5. +12
    -22
      service-uniapp-client/pages/index/index.vue
  6. +18
    -26
      service-uniapp-client/pages/index/technician.vue
  7. +4
    -4
      service-uniapp-client/pages/login/login.vue
  8. +1
    -40
      service-uniapp-client/pages/mine/distribution.vue
  9. +37
    -5
      service-uniapp-client/pages/order/payOrder.vue
  10. +16
    -9
      service-uniapp-client/plugins/upload.js
  11. +6
    -2
      service-uniapp-client/store/store.js
  12. +6
    -0
      service-uniapp-client/utils/position.js
  13. +1
    -0
      service-uniapp-technician/App.vue
  14. +7
    -0
      service-uniapp-technician/main.js
  15. +14
    -0
      service-uniapp-technician/mixins/configList.js
  16. +2
    -1
      service-uniapp-technician/pages/mine/upload.vue
  17. +16
    -10
      service-uniapp-technician/plugins/upload.js
  18. +3
    -0
      service-uniapp-technician/plugins/utils.js
  19. +76
    -0
      service-uniapp-technician/store/store.js

+ 0
- 2
service-uniapp-client/App.vue View File

@ -1,6 +1,5 @@
<script>
import plugins from "./plugins/plugins.js"
import share from '@/utils/Share'
export default {
onLaunch: function() {
@ -9,7 +8,6 @@
this.$store.commit('getArea')
},
onShow: function() {
share()
},
onHide: function() {},
methods: {}


+ 25
- 16
service-uniapp-client/components/placard.vue View File

@ -29,7 +29,8 @@
components : { VueQrcode },
data() {
return {
qrCodeValue: import.meta.env.VITE_REDIRECT_URI + `?vid=${this.getUserInfo()}`,
qrCodeValue: '',
// qrCodeValue: import.meta.env.VITE_REDIRECT_URI + `?vid=${this.getUserInfo()}`,
qrCodeSize: 180 * (window.innerWidth / 750),
qrCodeDarkColor: '#000',
qrCodeLightColor: '#fff',
@ -49,8 +50,18 @@
_center: 0
}
},
created(){
console.log(this.configList);
console.log(this.configList.user_url);
this.qrCodeValue = `${this.configList.user_url}?vid=${this.userInfo.id}`
},
methods: {
async draw() { //
uni.showLoading({
title: '拼命绘画中...'
})
let self = this
//
self.systemInfo = await self.getSystemInfo();
@ -63,17 +74,23 @@
//
let bg = new Image();
bg.src = import.meta.env.VITE_REDIRECT_URI + '/static/placard/placard-bg.png'
bg.src = this.configList.qr_code_image
// bg.src = this.configList.user_url + '/static/placard/placard-bg.png'
//logo
let logo = new Image();
logo.src = import.meta.env.VITE_REDIRECT_URI + '/static/placard/logo.png'
logo.src = this.configList.logo_image
// logo.src = import.meta.env.VITE_REDIRECT_URI + '/static/placard/logo.png'
console.log(this.configList.logo_image);
bg.onload = () => {
logo.onload = () => { //logo(logo)
setTimeout(() => {
let ctx = document.querySelector('canvas').getContext('2d')
let img = document.querySelector('.qrcode img')
let center = self.canvasW / 2; //
self._center = center
@ -120,7 +137,7 @@
////
this.drawList(ctx, 135 * rpx, 650 * rpx, 60 * rpx, 20 * rpx, 10 * rpx, '#59B495')
uni.canvasToTempFilePath({
x: 0, //
y: 0,
@ -128,6 +145,7 @@
height: self.canvasH, // canvas
canvasId: 'myCanvas', // canvas id
success(res) {
uni.hideLoading()
self.tempFilePath = res.tempFilePath //
}
})
@ -218,15 +236,6 @@
currentTagInfo = { x : next }
})
},
getUserInfo(){
if(localStorage.getItem('userInfo')){
return JSON.parse(localStorage.getItem('userInfo')).id
}else{
uni.navigateTo({
url: '/pages/login/login'
})
}
}
}
}
</script>
@ -267,7 +276,7 @@
}
canvas{
opacity: 0;
opacity: 1;
position: fixed;
top: 100%;
left: 0;


+ 1
- 1
service-uniapp-client/main.js View File

@ -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) {


+ 1
- 23
service-uniapp-client/pages/index/center.vue View File

@ -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({


+ 12
- 22
service-uniapp-client/pages/index/index.vue View File

@ -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))
}
}
}
}
</script>


+ 18
- 26
service-uniapp-client/pages/index/technician.vue View File

@ -7,14 +7,20 @@
<view @click="showSelectArea" class="left-area">
<image src="@/static/home/address-icon.png"></image>
<view class="area">{{ area }}</view>
<view class="area">{{ selectArea.name }}</view>
<image src="../../static/home/arrow-icon.png"></image>
<view class="parting-line">|</view>
</view>
<view class="center-area">
<image src="@/static/home/search-icon.png"></image>
<van-field v-model="queryParams.title" :clearable="true" @clear="clearKey" center placeholder="请输入技师" />
<van-search
v-model="queryParams.title"
:clearable="true"
background="transparent"
@clear="getTechnicianList"
@search="getTechnicianList"
center
placeholder="请输入技师" />
</view>
<view class="right-area">
@ -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))
}
}
}
}
</script>
@ -212,6 +203,7 @@
font-size: 26rpx;
color: #ccc;
margin: 0rpx 5rpx;
// background: transparent;
}
}


+ 4
- 4
service-uniapp-client/pages/login/login.vue View File

@ -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')
})


+ 1
- 40
service-uniapp-client/pages/mine/distribution.vue View File

@ -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, // ,apialertpclogpc
appId: 'wxe934cebcbc89d869', //
// timestamp: res.data.timestamp, //
// nonceStr: res.data.nonceStr, //
// signature: res.data.signature, // 1
// surl: res.data.surl, //debugtrueURL
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"]
});
window.jWeixin.ready(() => {
//QQ1.4.0
window.jWeixin.updateAppMessageShareData({
title: '邀请新用户', //
desc: "邀请新用户,成为你的粉丝", //
link: "http://tairoudj.natapp1.cc", //
imgUrl: res.result, //
success: res => {
//
this.wxsharetip = true
},
cancel: function() {
//
}
});
//QQ1.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()


+ 37
- 5
service-uniapp-client/pages/order/payOrder.vue View File

@ -108,6 +108,18 @@
<van-cell-group style="margin-top: 10px;">
<van-radio-group v-model="payMethod">
<van-cell>
<template #title>
<text>线下付款</text>
</template>
<template #icon>
<image class="icon" src="../../static/payOrder/5.png" mode=""></image>
</template>
<template #right-icon>
<van-radio :name="2"></van-radio>
</template>
</van-cell>
<van-cell>
<template #title>
<text>账户余额</text>
@ -174,7 +186,7 @@
已优惠{{ coupon.money || 0 }}
</view>
</view>
<view class="btn" @click="submit">
<view class="btn" @click="handleSubmit">
立即支付
</view>
</view>
@ -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()


+ 16
- 9
service-uniapp-client/plugins/upload.js View File

@ -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)


+ 6
- 2
service-uniapp-client/store/store.js View File

@ -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
}
})


+ 6
- 0
service-uniapp-client/utils/position.js View File

@ -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


+ 1
- 0
service-uniapp-technician/App.vue View File

@ -4,6 +4,7 @@
export default {
onLaunch: function() {
this.$.appContext.app.use(plugins)
this.$store.commit('initConfig')
},
onShow: function() {},
onHide: function() {}


+ 7
- 0
service-uniapp-technician/main.js View File

@ -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
}


+ 14
- 0
service-uniapp-technician/mixins/configList.js View File

@ -0,0 +1,14 @@
import { mapState } from 'vuex'
export default {
data() {
return {
}
},
computed: {
...mapState(['configList', 'userInfo', 'selectArea']),
},
methods: {
}
}

+ 2
- 1
service-uniapp-technician/pages/mine/upload.vue View File

@ -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) {}
}
});


+ 16
- 10
service-uniapp-technician/plugins/upload.js View File

@ -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)


+ 3
- 0
service-uniapp-technician/plugins/utils.js View File

@ -58,6 +58,9 @@ function verificationAll(data){
function getLocation(fn){
if(uni.getStorageSync('open_address') == 0){
return {}
}
uni.getLocation({
type: 'wgs84',
geocode:true,//设置该参数为true可直接获取经纬度及城市信息


+ 76
- 0
service-uniapp-technician/store/store.js View File

@ -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

Loading…
Cancel
Save