index.vue 30 KB

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