index.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  1. <template>
  2. <view class="home-page">
  3. <view class="bg">
  4. <view class=" u-flex">
  5. <view class="u-m-r-10">
  6. <image :src="avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
  7. </view>
  8. <view class="u-flex-1 u-m-l-10" v-if="!isLogin">
  9. <view>
  10. <view class=" flex align-center">
  11. <view class="userName">{{userName}}</view>
  12. <view class="labe" @tap="stateSave" v-if="XCXIsSelect != '否'">
  13. <text class="yuan">
  14. </text>
  15. <view v-if="isTrue">已上线</view>
  16. <view v-if="!isTrue">已下线</view>
  17. </view>
  18. </view>
  19. <view class="flex " style="font-size: 24rpx;color: #222222;margin-top: 20rpx;"
  20. v-if="XCXIsSelect != '否'">
  21. <view v-if="renzheng == 0" @click.stop="goNav('/my/renzheng/rzType')">
  22. 暂未实名认证
  23. </view>
  24. <view v-if="renzheng == 1" @click.stop="goNav('/my/renzheng/index')">
  25. 实名审核中
  26. </view>
  27. <view v-if="renzheng == 2">
  28. 已实名认证
  29. </view>
  30. <view v-if="renzheng == 3" @click.stop="goNav('/my/renzheng/index')">
  31. 实名已拒绝
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view v-else class="userName" @click="goLogin('/pages/public/login')">
  37. 登录
  38. </view>
  39. </view>
  40. <view class="box" v-if="XCXIsSelect != '否'">
  41. <view class="label-item">
  42. ¥<text class="number">{{sumMoney}}</text>
  43. <view class="label">总收益</view>
  44. </view>
  45. <view class="label-item">
  46. <text class="number">{{countOrderNum}}</text>
  47. <view class="label">总销量</view>
  48. </view>
  49. <view class="label-item">
  50. <text class="number">{{countTakingByUserId}}</text>
  51. <view class="label">用户评价</view>
  52. </view>
  53. <view class="label-item">
  54. <text class="number">{{countByUserId}}</text>
  55. <view class="label">访客人数</view>
  56. </view>
  57. </view>
  58. </view>
  59. <view >
  60. <view style="background: #FFFFFF;border-radius: 32rpx 32rpx 32rpx 32rpx;padding: 28rpx;" class="flex align-center justify-between" v-if="XCXIsSelect != '否'">
  61. <view class="text-center" @click="goNavs('/pages/my/mangshi')">
  62. <image src="../../static/images/index/shezhi.png" style="width: 80rpx;height:80rpx;"></image>
  63. <view style="font-size: 24rpx;color: #222222;margin-top: 20rpx;">忙时设置</view>
  64. </view>
  65. <view class="text-center" @click="goNavs('/my/qiandao/index')">
  66. <image src="../../static/images/index/qiandao.png" style="width: 80rpx;height:80rpx;"></image>
  67. <view style="font-size: 24rpx;color: #222222;margin-top: 20rpx;">签到中心</view>
  68. </view>
  69. <view class="text-center" @click="goNav('/pages/my/user')">
  70. <image src="../../static/images/index/geren.png" style="width: 80rpx;height:80rpx;"></image>
  71. <view style="font-size: 24rpx;color: #222222;margin-top: 20rpx;">个人信息</view>
  72. </view>
  73. <view class="text-center" @click="goNavs('/pages/index/jinji')">
  74. <image src="../../static/images/index/jinji.png" style="width: 80rpx;height:80rpx;"></image>
  75. <view style="font-size: 24rpx;color: #222222;margin-top: 20rpx;">紧急报警</view>
  76. </view>
  77. </view>
  78. <!-- <view class="box1" @click="goNav('/my/shuju/index')">
  79. <view class="text-bold text-lg margin-bottom-sm">订单数据</view>
  80. <view class="orderbox ">
  81. <view class="text-center">
  82. ¥<text class="text-bold text-xl">{{orderMoney}}</text>
  83. <view class="margin-top-xs">订单收入</view>
  84. </view>
  85. <view class="text-center">
  86. <text class="text-bold text-xl">{{countOrder}}</text>
  87. <view class="margin-top-xs">总订单数</view>
  88. </view>
  89. <view class="text-center">
  90. ¥<text class="text-bold text-xl">{{sumRefund}}</text>
  91. <view class="margin-top-xs">退款金额</view>
  92. </view>
  93. <view class="text-center">
  94. <text class="text-bold text-xl">{{countByUserId}}</text>
  95. <view class="margin-top-xs">访客人数</view>
  96. </view>
  97. </view>
  98. </view> -->
  99. <view class="box-title">订单管理</view>
  100. <view class="guanlibox" @click="goDetail(1)">
  101. <view class="item">
  102. <view class="icon-box">
  103. <image class="icon" src="../../static/images/index/order1.png">
  104. </image>
  105. <view class="label">待服务</view>
  106. </view>
  107. <text class="number">{{countOrderIng}}</text>
  108. </view>
  109. <view class="item item2">
  110. <view class="icon-box">
  111. <image class="icon" src="../../static/images/index/order2.png">
  112. </image>
  113. <view class="label">进行中</view>
  114. </view>
  115. <text class="number">{{countOrderAppraise}}</text>
  116. </view>
  117. <view class="item item3">
  118. <view class="icon-box">
  119. <image class="icon" src="../../static/images/index/order3.png">
  120. </image>
  121. <view class="label">已完成</view>
  122. </view>
  123. <text class="number">{{countOrderEnd}}</text>
  124. </view>
  125. </view>
  126. <view class="box-title">订单数据</view>
  127. <view class="guanlibox" @click="goNav('/my/shuju/index')">
  128. <view class="item">
  129. <view class="icon-box">
  130. <image class="icon" src="../../static/images/index/order4.png">
  131. </image>
  132. <view class="label">订单收入</view>
  133. </view>
  134. <text class="number">{{orderMoney}}</text>
  135. </view>
  136. <view class="item">
  137. <view class="icon-box">
  138. <image class="icon" src="../../static/images/index/order5.png">
  139. </image>
  140. <view class="label">总订单数</view>
  141. </view>
  142. <text class="number">{{countOrder}}</text>
  143. </view>
  144. <view class="item">
  145. <view class="icon-box">
  146. <image class="icon" src="../../static/images/index/order6.png">
  147. </image>
  148. <view class="label">退款金额</view>
  149. </view>
  150. <text class="number">{{sumRefund}}</text>
  151. </view>
  152. </view>
  153. <view style="margin-top: 40rpx;" v-if="goods.length > 0">
  154. <view class="text-bold text-lg">
  155. <view>今日服务</view>
  156. </view>
  157. <view class="bgwhite radius margin-top-sm padding-bottom-sm" v-for="(item,index) in goods" :key='index'
  158. @click="goNav('/my/order/pay?ordersId='+item.ordersId)">
  159. <view class="flex justify-between padding-sm">
  160. <view class="text-green" v-if="item.status ==1">待付款...</view>
  161. <view class="text-green" v-if="item.status ==2">待服务</view>
  162. <view class="text-green" v-if="item.status ==5">已完成</view>
  163. <view class="text-green" v-if="item.status ==6">进行中</view>
  164. <view class="text-green" v-if="item.status ==7">已出发</view>
  165. <view class="text-green" v-if="item.status ==8">已到达</view>
  166. <view class="text-green" v-if="item.status ==3">待评价</view>
  167. <view class="text-green" v-if="item.status ==4" style="color: #999999;">已取消</view>
  168. <view v-if="item.overTimeOrders == 1" style="color: red;font-size:26rpx">(订单已超时)</view>
  169. <!-- <view class="text-green" v-if="item.state ==1 ||item.state ==2">待完成</view>
  170. <view class="text-green" v-if="item.state ==3||item.state ==4">已完成</view> -->
  171. <view class="text-green">预约时间:{{item.serveTime}}</view>
  172. </view>
  173. <view class="xian"></view>
  174. <view class=" u-flex u-p-t-30 padding-sm">
  175. <view class="u-m-r-10">
  176. <u-avatar :src="item.massageImg?item.massageImg: '../../static/logo.png'" mode="square"
  177. size="100">
  178. </u-avatar>
  179. </view>
  180. <view class="u-flex-1 margin-left-xs">
  181. <view class="u-font-18 text-bold u-line-1" style="width: 560rpx;">
  182. <view class="margin-right-xs text-df margin-left-xs"
  183. style="margin-top: 0rpx;display: inline-block;width: 400rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  184. {{item.title}}
  185. </view>
  186. </view>
  187. <view class="margin-left-xs text-cut" style="width:550upx">{{item.address}}</view>
  188. </view>
  189. </view>
  190. <view class="flex u-p-t-20 justify-between align-center padding-sm">
  191. <view class=" flex-sub ">
  192. 实收:<text class="text-df">¥</text><text
  193. class="text-xl text-bold">{{item.sumArtificerMoney}}</text>
  194. </view>
  195. <view class="flex text-right">
  196. <u-button v-if="item.status == 1" :custom-style="customStyle" shape="circle" :plain="true"
  197. @click="cancelOrder(item)">取消订单</u-button>
  198. <u-button v-if="item.status == 1" :custom-style="customStyle1" shape="circle" :plain="true"
  199. @click="bindphone(item.phone)">联系TA</u-button>
  200. <u-button v-if=" item.state==1" :custom-style="customStyle1" shape="circle" :plain="true"
  201. @click="goNav('/my/order/pay?id='+item.ordersId+'&isTrue=1')">查看详情</u-button>
  202. <u-button v-if="item.status == 6" :custom-style="customStyle" shape="circle" :plain="true"
  203. @click="cancel(item)">订单完成</u-button>
  204. </view>
  205. </view>
  206. <view class="xian" v-if="item.endTime && item.endTime.day && item.status == 6"></view>
  207. <view class="pintuan_syrs flex justify-between"
  208. v-if="item.endTime && item.endTime.day && item.status == 6">
  209. <view style="font-size: 28rpx;font-family: PingFang SC;font-weight: bold;color: #2FB57A;">服务倒计时
  210. </view>
  211. <uni-countdown :day="item.endTime.day" :hour="item.endTime.hour" :minute="item.endTime.minute"
  212. :second="item.endTime.second" color="#20C675">
  213. </uni-countdown>
  214. </view>
  215. </view>
  216. </view>
  217. <view style="margin-top: 40rpx;text-align: center;color: #ccc;font-size: 32rpx;" @click="handleGo">
  218. 黔ICP备2025056155号-1
  219. </view>
  220. <uni-popup ref="popup" type="center">
  221. <view style="background: #fff;width:658upx;height: 960upx; border-radius:17upx;position: relative;">
  222. <image :src="Guanggao" style="width: 100%;height: 100%;" mode="aspectFill"
  223. @tap="saveImgs(Guanggao)"></image>
  224. </view>
  225. </uni-popup>
  226. </view>
  227. </view>
  228. </template>
  229. <script>
  230. import empty from '@/components/empty.vue'
  231. export default {
  232. components: {
  233. empty
  234. },
  235. data() {
  236. return {
  237. Guanggao: '',
  238. ssDW: false,
  239. stateName: '休息中',
  240. avatar: '../../static/logo.png',
  241. isLogin: true,
  242. userName: '匿名',
  243. renzheng: 0,
  244. goods: [],
  245. sumMoney: 0, //总收益
  246. countOrderNum: 0, //总销量
  247. countTakingByUserId: 0, //用户评价数
  248. orderMoney: 0, //订单收入
  249. countOrder: 0, //总订单数
  250. sumRefund: 0, //退款金额
  251. countByUserId: 0, //访客人数
  252. countOrderIng: 0, //待接单
  253. countOrderAppraise: 0, //待完成
  254. countOrderEnd: 0, //已完成
  255. putaway: 0, //上架中
  256. soldOut: 0, //下架中
  257. page: 1,
  258. limit: 10,
  259. longitude: '',
  260. latitude: '',
  261. isTrue: true,
  262. showModal: true,
  263. userId: '',
  264. arr: [],
  265. city: '',
  266. invitationCode:'',
  267. isCashDeposit: 0,
  268. customStyle: {
  269. color: '#999999',
  270. border: '2rpx solid #999999',
  271. // backgroundColor: '#1E1F31',
  272. border: "8rpx",
  273. width: '180rpx',
  274. height: '54rpx',
  275. margin: "0 0 0 20rpx"
  276. },
  277. customStyle1: {
  278. color: '#2FB57A',
  279. border: '2rpx solid #2FB57A',
  280. border: "8rpx",
  281. width: '180rpx',
  282. height: '54rpx',
  283. margin: "0 0 0 20rpx"
  284. },
  285. XCXIsSelect: '否',
  286. time: ''
  287. }
  288. },
  289. onShareAppMessage(res) { //发送给朋友
  290. return {
  291. title: this.tuiguang,
  292. path: '/pages/index/index?invitation=' + this.invitationCode,
  293. imageUrl: this.tuiguangImg,
  294. }
  295. },
  296. onShareTimeline(res) { //分享到朋友圈
  297. return {
  298. title: this.tuiguang,
  299. path: '/pages/index/index?invitation=' + this.invitationCode,
  300. imageUrl: this.tuiguangImg,
  301. }
  302. },
  303. onLoad(e) {
  304. this.userId = uni.getStorageSync('userId')
  305. // 获取邀请码保存到本地
  306. if (e.invitation) {
  307. this.$queue.setData('inviterCode', e.invitation);
  308. }
  309. // #ifdef MP-WEIXIN
  310. if (e.scene) {
  311. const scene = decodeURIComponent(e.scene);
  312. this.$queue.setData('inviterCode', scene.split(',')[0]);
  313. }
  314. // #endif
  315. this.$Request.getT('/app/common/type/247').then(res => { //下单成功
  316. if (res.code == 0) {
  317. if (res.data && res.data.value) {
  318. this.arr.push(res.data.value)
  319. }
  320. }
  321. })
  322. this.$Request.getT('/app/common/type/249').then(res => { //用户完成成功
  323. if (res.code == 0) {
  324. if (res.data && res.data.value) {
  325. this.arr.push(res.data.value)
  326. }
  327. }
  328. })
  329. this.$Request.getT('/app/common/type/309').then(res => { //用户完成成功
  330. if (res.code == 0) {
  331. if (res.data && res.data.value) {
  332. this.arr.push(res.data.value)
  333. }
  334. }
  335. })
  336. // 技师端首页是否弹框 380
  337. this.$Request.get('/app/common/type/380').then(res => {
  338. if (res.code == 0 && res.data.value && res.data.value === '是') {
  339. this.$Request.get('/app/common/type/379').then(res => {
  340. if (res.code == 0 && res.data && res.data.value) {
  341. this.Guanggao = res.data.value;
  342. this.$refs.popup.open();
  343. }
  344. });
  345. }
  346. });
  347. // this.getcity()
  348. },
  349. onShow() {
  350. //是否开启技师端实时定位 375
  351. this.$Request.get('/app/common/type/375').then(res => {
  352. if (res.code == 0 && res.data) {
  353. if (res.data.value === '是') {
  354. let that = this
  355. let userId = uni.getStorageSync('userId')
  356. let renzheng = uni.getStorageSync('renzheng')
  357. if (userId && renzheng && renzheng == 2) {
  358. that.getcity()
  359. }
  360. }
  361. }
  362. });
  363. this.$Request.get('/app/common/type/238').then(res => {
  364. if (res.code == 0) {
  365. // #ifdef MP-WEIXIN
  366. this.$queue.setData('XCXIsSelect', res.data.value);
  367. // #endif
  368. // #ifndef MP-WEIXIN
  369. this.$queue.setData('XCXIsSelect', '是');
  370. // #endif
  371. this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
  372. }
  373. });
  374. this.userId = uni.getStorageSync('userId')
  375. this.isCashDeposit = uni.getStorageSync('isCashDeposit')
  376. if (this.userId) {
  377. this.isLogin = false
  378. this.getJinRiOrder();
  379. this.getUserInfo()
  380. this.getFb()
  381. this.getArtificer()
  382. this.getNewOrder()
  383. // #ifdef MP-WEIXIN
  384. //订阅
  385. if (this.showModal) {
  386. this.openMsg()
  387. }
  388. // #endif
  389. let that = this
  390. that.time = setInterval(function() {
  391. that.getNewOrder()
  392. },10000)
  393. } else {
  394. this.isLogin = true
  395. this.userName = '匿名'
  396. this.browse = 0
  397. this.fans = 0
  398. this.follow = 0
  399. this.visitor = 0
  400. this.avatar = '../../static/logo.png'
  401. }
  402. },
  403. methods: {
  404. handleGo(){
  405. window.open('https://beian.miit.gov.cn/','_target')
  406. },
  407. getNewOrder() {
  408. let data = {
  409. page: 1,
  410. limit: 100,
  411. state: 51
  412. }
  413. if (this.isLogin) {return;}
  414. this.$Request.getT('/app/message/selectMessageByUserIds', data).then(res => {
  415. if (res.code == 0) {
  416. if (res.data.totalCount > 0) {
  417. this.aplayAudios()
  418. }
  419. } else {
  420. if(res.code == 401){
  421. this.isLogin = true
  422. this.userId = '';
  423. }else{
  424. this.$queue.showToast(res.msg);
  425. }
  426. }
  427. });
  428. },
  429. // 新订单语音播放
  430. aplayAudios() {
  431. console.log('语音提示')
  432. const innerAudioContext = uni.createInnerAudioContext();
  433. innerAudioContext.autoplay = true;
  434. innerAudioContext.src = 'https://bcdhub.oss-cn-beijing.aliyuncs.com/audio/order.mp3';
  435. innerAudioContext.onPlay(() => {
  436. console.log('开始播放');
  437. });
  438. innerAudioContext.onError((res) => {
  439. console.log(res.errMsg);
  440. console.log(res.errCode);
  441. });
  442. },
  443. saveImgs(imgs) {
  444. let imgArr = [];
  445. imgArr.push(imgs);
  446. // //预览图片
  447. uni.previewImage({
  448. urls: imgArr,
  449. current: 0
  450. });
  451. },
  452. stateSave() {
  453. this.$Request.postT('/app/artificer/updateArtificer').then(res => {
  454. if (res.code == 0) {
  455. this.getArtificer();
  456. this.$queue.showToast('切换成功!')
  457. } else {
  458. this.$queue.showToast(res.msg);
  459. }
  460. });
  461. },
  462. // 取消订单
  463. cancelOrder(e) {
  464. let that = this
  465. uni.showModal({
  466. title: '提示',
  467. content: '确认取消并删除订单?',
  468. success: function(res) {
  469. if (res.confirm) {
  470. let data = {
  471. ordersId: e.ordersId,
  472. }
  473. that.$queue.showLoading('提交中...')
  474. that.$Request.post('/app/artificer/deleteOrders', data).then(res => {
  475. uni.hideLoading();
  476. if (res.code == 0) {
  477. that.getJinRiOrder();
  478. } else {
  479. that.$queue.showToast(res.msg);
  480. }
  481. })
  482. } else if (res.cancel) {
  483. console.log('用户点击取消');
  484. }
  485. }
  486. });
  487. },
  488. // 完成订单
  489. cancel(e) {
  490. let that = this
  491. uni.showModal({
  492. title: '提示',
  493. content: '如果服务未完成点击完成订单会遭到平台违规处理,请确认服务是否完毕?',
  494. success: function(res) {
  495. if (res.confirm) {
  496. let data = {
  497. ordersId: e.ordersId,
  498. accomplishLongitude: that.longitude,
  499. accomplishLatitude: that.latitude
  500. }
  501. that.$queue.showLoading('提交中...')
  502. that.$Request.post('/app/artificer/accomplishOrders', data).then(res => {
  503. uni.hideLoading();
  504. if (res.code == 0) {
  505. that.getJinRiOrder();
  506. } else {
  507. that.$queue.showToast(res.msg);
  508. }
  509. })
  510. } else if (res.cancel) {
  511. console.log('用户点击取消');
  512. }
  513. }
  514. });
  515. },
  516. timeFormat(param) {
  517. return param < 10 ? '0' + param : param;
  518. },
  519. getJinRiOrder() {
  520. let data = {
  521. type: 1,
  522. page: 1,
  523. limit: 10,
  524. startTime: '',
  525. endTime: ''
  526. }
  527. this.$Request.getT('/app/artificer/selectTodayOrder', data).then(res => {
  528. if (res.code == 0) {
  529. this.goods = [];
  530. res.data.list.forEach(d => {
  531. if (d.status == 6 && d.endTime) {
  532. let data = {}
  533. data.day = 0;
  534. data.hour = 0;
  535. data.minute = 0;
  536. data.second = 0;
  537. var now = new Date().getTime();
  538. var endDate = new Date(d.endTime).getTime();
  539. let time = (endDate - now) / 1000;
  540. data.day = this.timeFormat(parseInt(time / (60 * 60 * 24)));
  541. data.hour = this.timeFormat(parseInt(time % (60 * 60 * 24) / 3600));
  542. data.minute = this.timeFormat(parseInt(time % (60 * 60 * 24) % 3600 / 60));
  543. data.second = this.timeFormat(parseInt(time % (60 * 60 * 24) % 3600 % 60));
  544. d.endTime = data;
  545. }
  546. this.goods.push(d);
  547. });
  548. }
  549. })
  550. },
  551. getcity() {
  552. let that = this
  553. uni.getLocation({
  554. type: 'wgs84',
  555. success: function(res) {
  556. console.log('当前位置的经度:' + res.longitude);
  557. console.log('当前位置的纬度:' + res.latitude);
  558. that.latitude = res.latitude
  559. that.longitude = res.longitude
  560. that.getcitys()
  561. }
  562. });
  563. },
  564. getcitys() {
  565. this.$Request.get('/app/Login/selectCity?lat=' + this.latitude + '&lng=' + this.longitude).then(res => {
  566. if (res.code == 0) {
  567. this.city = res.data.city ? res.data.city : '未知'
  568. // uni.setStorageSync('city', res.data.city)
  569. // let data = {
  570. // num: 1,
  571. // size: 10
  572. // }
  573. // this.getData(data)
  574. }
  575. });
  576. },
  577. //上线开关
  578. bindopen() {
  579. let bzjCheck = this.$queue.getData("bzjCheck");
  580. if (this.isCashDeposit == 0 && bzjCheck != '否') {
  581. uni.showModal({
  582. title: '提示',
  583. content: '请先去缴纳保证金',
  584. success: function(res) {
  585. if (res.confirm) {
  586. uni.navigateTo({
  587. url: '/my/publish/money'
  588. })
  589. } else if (res.cancel) {
  590. console.log('用户点击取消');
  591. }
  592. }
  593. });
  594. } else {
  595. let data = {
  596. longitude: this.longitude,
  597. latitude: this.latitude,
  598. // status: this.status,
  599. city: this.city
  600. }
  601. this.$Request.post("/app/artificer/updateArtificer", data).then(res => {
  602. if (res.code == 0) {
  603. this.getArtificer()
  604. this.getUserInfo()
  605. } else {
  606. // uni.showToast({
  607. // title: res.msg,
  608. // icon: 'none'
  609. // })
  610. uni.showModal({
  611. title: '提示',
  612. content: res.msg,
  613. success: function(res) {
  614. if (res.confirm) {
  615. uni.navigateTo({
  616. url: '/my/publish/money'
  617. })
  618. } else if (res.cancel) {
  619. console.log('用户点击取消');
  620. }
  621. }
  622. });
  623. }
  624. })
  625. }
  626. },
  627. //获取技师的信息
  628. getArtificer() {
  629. this.$Request.getT("/app/artificer/selectArtificer").then(res => {
  630. if (res.code == 0) {
  631. uni.setStorageSync("isTruestatus", res.data.status)
  632. if (res.data) {
  633. if (res.data.status == 1) {
  634. this.isTrue = true
  635. } else if (res.data.status == 2) {
  636. this.isTrue = false
  637. }
  638. } else {
  639. this.isTrue = false
  640. }
  641. uni.setStorageSync('artificerId', res.data.artificerId)
  642. }
  643. });
  644. },
  645. //获取用户发布
  646. getFb() {
  647. this.$Request.get("/app/artificer/selectArtificerIndex").then(res => {
  648. if (res.code == 0) {
  649. this.sumMoney = res.data.sumMoney //总收益
  650. this.putaway = res.data.putaway //上架中
  651. this.soldOut = res.data.soldOut //下架中
  652. this.countOrderNum = res.data.countOrderNum //总销量
  653. this.countTakingByUserId = res.data.countTakingByUserId //用户评价
  654. this.orderMoney = res.data.orderMoney //订单收入
  655. this.countOrder = res.data.countOrder //总订单数
  656. this.sumRefund = res.data.sumRefund //退款金额
  657. this.countByUserId = res.data.countByUserId //访客人数
  658. this.countOrderIng = res.data.countOrderIng //进行中
  659. this.countOrderEnd = res.data.countOrderEnd //已完成
  660. this.countOrderAppraise = res.data.countOrderJin //进行中
  661. }
  662. })
  663. },
  664. goDetail(index) {
  665. if (index == 1) {
  666. uni.switchTab({
  667. url: '/pages/order/index'
  668. })
  669. }
  670. if (index == 2) {
  671. uni.navigateTo({
  672. url: '/my/publish/index'
  673. })
  674. }
  675. },
  676. bindFb() {
  677. let userId = uni.getStorageSync('userId')
  678. let renzheng = uni.getStorageSync('renzheng')
  679. if (userId) {
  680. if (renzheng == 2) {
  681. uni.navigateTo({
  682. url: '/my/publish/index'
  683. })
  684. } else {
  685. uni.showModal({
  686. title: '提示',
  687. content: '您还未实名认证,请先认证',
  688. success: function(res) {
  689. if (res.confirm) {
  690. console.log('用户点击确定');
  691. uni.navigateTo({
  692. url: '/my/renzheng/index'
  693. })
  694. } else if (res.cancel) {
  695. console.log('用户点击取消');
  696. }
  697. }
  698. })
  699. }
  700. } else {
  701. uni.showModal({
  702. title: '提示',
  703. content: '您还未登录,请先登录',
  704. success: function(res) {
  705. if (res.confirm) {
  706. console.log('用户点击确定');
  707. uni.navigateTo({
  708. url: '/pages/public/login'
  709. })
  710. } else if (res.cancel) {
  711. console.log('用户点击取消');
  712. }
  713. }
  714. })
  715. }
  716. },
  717. goNavs(e, name) {
  718. console.log(e)
  719. if (this.userId) {
  720. let renzheng = uni.getStorageSync('renzheng')
  721. if (renzheng == 2) {
  722. let bzjCheck = this.$queue.getData("bzjCheck");
  723. if (bzjCheck != '否') {
  724. if (this.isCashDeposit == 0) {
  725. uni.showModal({
  726. title: '提示',
  727. content: '请先去缴纳保证金',
  728. success: function(res) {
  729. if (res.confirm) {
  730. uni.navigateTo({
  731. url: '/my/publish/money'
  732. })
  733. } else if (res.cancel) {
  734. console.log('用户点击取消');
  735. }
  736. }
  737. });
  738. } else {
  739. uni.navigateTo({
  740. url: e,
  741. })
  742. }
  743. } else {
  744. uni.navigateTo({
  745. url: e,
  746. })
  747. }
  748. } else {
  749. uni.showModal({
  750. title: '提示',
  751. content: '您还未实名认证,请先认证',
  752. success: function(res) {
  753. if (res.confirm) {
  754. console.log('用户点击确定');
  755. uni.navigateTo({
  756. url: '/my/renzheng/rzType'
  757. })
  758. } else if (res.cancel) {
  759. console.log('用户点击取消');
  760. }
  761. }
  762. })
  763. }
  764. } else {
  765. uni.showModal({
  766. title: '提示',
  767. content: '您还未登录,请先登录',
  768. success: function(res) {
  769. if (res.confirm) {
  770. console.log('用户点击确定');
  771. uni.navigateTo({
  772. url: '/pages/public/login'
  773. })
  774. } else if (res.cancel) {
  775. console.log('用户点击取消');
  776. }
  777. }
  778. })
  779. }
  780. },
  781. goNav(e, name) {
  782. console.log(e)
  783. if (this.userId) {
  784. uni.navigateTo({
  785. url: e
  786. })
  787. } else {
  788. uni.showModal({
  789. title: '提示',
  790. content: '您还未登录,请先登录',
  791. success: function(res) {
  792. if (res.confirm) {
  793. console.log('用户点击确定');
  794. uni.navigateTo({
  795. url: '/pages/public/login'
  796. })
  797. } else if (res.cancel) {
  798. console.log('用户点击取消');
  799. }
  800. }
  801. })
  802. }
  803. },
  804. getUserInfo() {
  805. this.$Request.get("/app/user/selectUserById").then(res => {
  806. if (res.code == 0) {
  807. this.userName = res.data.userName
  808. this.invitationCode = res.data.invitationCode
  809. this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
  810. this.isAuthentication = res.data.isAuthentication
  811. this.isCashDeposit = res.data.isCashDeposit
  812. uni.setStorageSync('avatar', res.data.avatar)
  813. uni.setStorageSync('userName', res.data.userName)
  814. uni.setStorageSync('invitationCode', res.data.invitationCode)
  815. // uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
  816. // uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
  817. if (res.data.isAuthentication == 0 || res.data.isAuthentication == null) {
  818. this.renzheng = 0
  819. uni.setStorageSync("renzheng", this.renzheng)
  820. } else if (res.data.isAuthentication == 1) {
  821. this.renzheng = 1
  822. uni.setStorageSync("renzheng", this.renzheng)
  823. } else if (res.data.isAuthentication == 2) {
  824. this.renzheng = 2
  825. uni.setStorageSync("renzheng", this.renzheng)
  826. } else if (res.data.isAuthentication == 3) {
  827. this.renzheng = 3
  828. uni.setStorageSync("renzheng", this.renzheng)
  829. } else if (res.data.isAuthentication == 4) {
  830. this.renzheng = 4
  831. uni.setStorageSync("renzheng", this.renzheng)
  832. } else if (res.data.isAuthentication == 5) {
  833. this.renzheng = 5
  834. uni.setStorageSync("renzheng", this.renzheng)
  835. } else if (res.data.isAuthentication == 6) {
  836. this.renzheng = 6
  837. uni.setStorageSync("renzheng", this.renzheng)
  838. }
  839. }
  840. });
  841. },
  842. goLogin(e) {
  843. uni.navigateTo({
  844. url: e
  845. })
  846. },
  847. // 开启订阅消息
  848. openMsg() {
  849. console.log('订阅消息')
  850. var that = this
  851. uni.getSetting({
  852. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  853. success(ret) {
  854. console.log(ret.subscriptionsSetting, '------------------')
  855. // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
  856. if (ret.subscriptionsSetting.itemSettings) {
  857. uni.setStorageSync('sendMsg', true)
  858. uni.openSetting({ // 打开设置页
  859. success(rea) {
  860. console.log(rea.authSetting)
  861. }
  862. });
  863. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  864. console.log(99999)
  865. uni.setStorageSync('sendMsg', false)
  866. uni.showModal({
  867. title: '提示',
  868. content: '为了更好的体验,请绑定消息推送',
  869. confirmText: '确定',
  870. cancelText: '取消',
  871. success: function(res) {
  872. if (res.confirm) {
  873. wx.requestSubscribeMessage({
  874. tmplIds: that.arr,
  875. success(re) {
  876. console.log(JSON.stringify(re),
  877. '++++++++++++++')
  878. var datas = JSON.stringify(re);
  879. if (datas.indexOf("accept") != -1) {
  880. console.log(re)
  881. // uni.setStorageSync('sendMsg', true)
  882. }
  883. },
  884. fail: (res) => {
  885. console.log(res)
  886. }
  887. })
  888. // uni.setStorageSync('sendMsg', true)
  889. console.log('确认')
  890. that.showModal = false
  891. } else if (res.cancel) {
  892. console.log('取消')
  893. // uni.setStorageSync('sendMsg', false)
  894. that.showModal = true
  895. }
  896. }
  897. })
  898. }
  899. }
  900. })
  901. },
  902. }
  903. }
  904. </script>
  905. <style lang="scss">
  906. .home-page {
  907. background: linear-gradient( 182deg, #F2F9F7 0%, #F6F6F6 100%);
  908. min-height: 100vh;
  909. padding: 60rpx 32rpx 20rpx;
  910. .userName{
  911. font-weight: bold;
  912. font-size: 32rpx;
  913. color: #222222;
  914. }
  915. .labe {
  916. width: 134rpx;
  917. height: 40rpx;
  918. background: #DCFFF2;
  919. border-radius: 20rpx 20rpx 20rpx 20rpx;
  920. margin-left: 20rpx;
  921. font-size: 24rpx;
  922. color: #222222;
  923. display: flex;
  924. align-items: center;
  925. justify-content: center;
  926. font-weight: 400;
  927. .yuan {
  928. width: 10rpx;
  929. height: 10rpx;
  930. background: #1EDA94;
  931. border-radius: 50%;
  932. margin-right: 8rpx;
  933. }
  934. }
  935. .box{
  936. display: flex;
  937. padding: 28rpx 0;
  938. margin-top: 20rpx;
  939. .label-item{
  940. flex: 1;
  941. text-align: center;
  942. .number{
  943. font-weight: bold;
  944. font-size: 36rpx;
  945. color: #222222;
  946. }
  947. .label{
  948. font-size: 24rpx;
  949. color: #222222;
  950. margin-top: 20rpx;
  951. }
  952. }
  953. }
  954. .box-title{
  955. font-weight: bold;
  956. font-size: 32rpx;
  957. color: #222222;
  958. padding: 24rpx 0;
  959. }
  960. .guanlibox {
  961. display: flex;
  962. justify-content: space-between;
  963. .item{
  964. width: 216rpx;
  965. height: 170rpx;
  966. background: linear-gradient( 180deg, #DFECFF 0%, #FFFFFF 100%);
  967. border-radius: 32rpx 32rpx 32rpx 32rpx;
  968. display: flex;
  969. flex-direction: column;
  970. align-items: center;
  971. justify-content: center;
  972. .icon-box{
  973. display: flex;
  974. .icon{
  975. width: 40rpx;
  976. height: 40rpx;
  977. }
  978. .label{
  979. font-size: 28rpx;
  980. color: #222222;
  981. margin-left: 12rpx;
  982. }
  983. }
  984. .number{
  985. font-weight: bold;
  986. font-size: 36rpx;
  987. color: #222222;
  988. margin-top: 24rpx;
  989. }
  990. }
  991. .item.item2{
  992. background: linear-gradient( 180deg, #FFF0E8 0%, #FFFFFF 100%);
  993. }
  994. .item.item3{
  995. background: linear-gradient( 180deg, #DCFFF2 0%, #FFFFFF 100%);
  996. }
  997. }
  998. }
  999. .xian {
  1000. width: 100%;
  1001. height: 1rpx;
  1002. border: 1rpx solid #f8f8f8;
  1003. margin-top: 20rpx;
  1004. }
  1005. .pintuan_syrs {
  1006. color: #999999;
  1007. font-size: 20upx;
  1008. margin: 20rpx 20rpx 0rpx;
  1009. display: flex;
  1010. padding-right: 18upx;
  1011. }
  1012. .box1 {
  1013. background: #FFFFFF;
  1014. border-radius: 24rpx;
  1015. padding: 30rpx;
  1016. margin-top: 30rpx;
  1017. }
  1018. .orderbox {
  1019. display: flex;
  1020. align-items: center;
  1021. justify-content: space-between;
  1022. }
  1023. </style>