index.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. <template>
  2. <view>
  3. <view class="content">
  4. <swiper class="screen-swiper" style="height: 320rpx;width: 686rpx;margin-top: 24rpx;border-radius: 32rpx;"
  5. :circular="true" :autoplay="true" interval="2500" duration="800">
  6. <swiper-item v-for="(item,index) in swiperList" :key="index" @tap="goNav(item.url)">
  7. <image :src="item.imageUrl" webp class="bannerImg"></image>
  8. </swiper-item>
  9. </swiper>
  10. <view class="tabview1" v-if="XCXIsSelect != '否'">
  11. <view class="type_box" v-if="typeList && typeList.length > 1">
  12. <view class="icon-box" @tap="selTab(-1,0)">
  13. <view style="font-weight: 700;"
  14. :style="{color:tabIndex == -1?'#FF6E98':'',fontSize:tabIndex==-1?'36rpx':'32rpx'}">
  15. 全部</view>
  16. <view style="height: 32rpx;">
  17. <svg t="1761021751826" v-show="tabIndex == -1" class="icon" viewBox="0 0 2970 1024"
  18. version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4553" width="24" height="24">
  19. <path
  20. d="M1483.968134 1024A1945.340076 1945.340076 0 0 1 65.537898 403.558292a245.597905 245.597905 0 0 1 0-334.217817 214.898167 214.898167 0 0 1 316.002639 0 1501.114864 1501.114864 0 0 0 2204.752863 0 214.898167 214.898167 0 0 1 316.002638 0 245.597905 245.597905 0 0 1 0 334.217817A1945.237743 1945.237743 0 0 1 1483.968134 1024z"
  21. fill="#FF6E98" p-id="4554"></path>
  22. </svg>
  23. </view>
  24. </view>
  25. <view class="icon-box" v-for="(item,index) in typeList" @tap="selTab(index,item.id)">
  26. <view style="font-weight: 700;"
  27. :style="{color:tabIndex == index?'#FF6E98':'',fontSize:tabIndex==index?'36rpx':'32rpx'}">
  28. {{item.value}}</view>
  29. <view style="height: 32rpx;">
  30. <svg t="1761021751826" v-show="tabIndex == index" class="icon" viewBox="0 0 2970 1024"
  31. version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4553" width="24" height="24">
  32. <path
  33. d="M1483.968134 1024A1945.340076 1945.340076 0 0 1 65.537898 403.558292a245.597905 245.597905 0 0 1 0-334.217817 214.898167 214.898167 0 0 1 316.002639 0 1501.114864 1501.114864 0 0 0 2204.752863 0 214.898167 214.898167 0 0 1 316.002638 0 245.597905 245.597905 0 0 1 0 334.217817A1945.237743 1945.237743 0 0 1 1483.968134 1024z"
  34. fill="#FF6E98" p-id="4554"></path>
  35. </svg>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="tabsx">
  40. <view style="margin-right: 20rpx;" v-for="(item,index) in list" :key="index" :class="listIndex==index?'active':'normal'"
  41. @click="change(index)">{{item.name}}</view>
  42. </view>
  43. </view>
  44. <view class="list_item" v-for="(item,index) in orderList" :key="index" @tap="goOrder(item)">
  45. <view style="position: relative;">
  46. <image :src="item.massageImg" mode="aspectFill"
  47. style="border-radius: 24rpx;width: 160rpx;height: 160rpx;"></image>
  48. <view class="flex justify-center align-center "
  49. style="color: #54CC84;font-size: 24rpx;width: 148rpx;height: 40rpx;background: #DCFFEA;border-radius: 36rpx;position: absolute;left: 6rpx;bottom: -20rpx;">
  50. <image src="../../static/time.png" style="width: 26rpx;height: 26rpx;margin-right: 8rpx;">
  51. </image>
  52. <view>{{item.duration}}分钟</view>
  53. </view>
  54. </view>
  55. <view class="listitem_rightview">
  56. <view class="titleview">
  57. <view class="item_title">{{item.title}}</view>
  58. <view class="item_yishou">已售{{item.sales}}</view>
  59. </view>
  60. <view class="flex flex-wrap margin-top-sm" v-if="item.labels.length>0">
  61. <text class="margin-bottom-xs box" v-for="(ites,index) in item.labels"
  62. :key="index">{{ites}}</text>
  63. </view>
  64. <view class="btnview align-center" :style="item.labels.length > 0 ? '' : 'margin-top:20rpx'">
  65. <view class="item_money flex align-center">
  66. <view><text>¥</text>{{item.price}}
  67. <text class="oldPrice_view">¥{{item.oldPrice}}</text>
  68. </view>
  69. <!-- <view class="flex justify-between margin-tb-sm align-center margin-left"
  70. style="color: #999999;font-size: 22rpx;">
  71. <image src="../../static/time.png"
  72. style="width: 26rpx;height: 26rpx;margin-right: 8rpx;"></image>
  73. <view>{{item.duration}}分钟</view>
  74. </view> -->
  75. </view>
  76. <view class="item_btn" v-if="item.classifyName === '足浴按摩'" @click.stop="goOrder(item)">
  77. 选择技师
  78. <image style="position: absolute;width: 39rpx;height: 39rpx;top: -4rpx;right: -8rpx;"
  79. src="../../static/image/btn-icon.png" mode=""></image>
  80. </view>
  81. <view class="item_btn" v-if="item.classifyName === '健身私教'" @click.stop="goOrder(item)">
  82. 选择教练
  83. </view>
  84. <view class="item_btn" v-if="item.classifyName != '健身私教' && item.classifyName != '足浴按摩'"
  85. @click.stop="goOrder(item)">
  86. 选择师傅
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <empty v-if="orderList.length==0" style="position: relative;top: -120rpx;z-index: 9;"></empty>
  93. <view style="position: fixed;z-index: 999;bottom: 160rpx;" v-if="showTP">
  94. <image src="/static/image/city_open.png" style="width: 690rpx;margin: 30rpx;height: 600rpx;"></image>
  95. <view
  96. style="position: absolute;bottom: 100rpx;width: 100%;text-align: center;display: flex;justify-content: center;">
  97. <view>
  98. <view style="color: #333333;font-size: 28rpx;"><text
  99. style="font-size: 44rpx;color:#ee6c54">{{tpCount}}</text>人已投票</view>
  100. <view class="tp_view" v-if="tpSel == 2" @tap="saveTP">投票</view>
  101. <view class="ytp_view" v-if="tpSel == 1">已投票</view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 新人红包 -->
  106. <uni-popup ref="popushongbao" type="center">
  107. <view>
  108. <image @tap="GetQuan" src="../../static/images/hb_bg.png" style="width: 564upx;height:618upx "></image>
  109. </view>
  110. </uni-popup>
  111. </view>
  112. </template>
  113. <script>
  114. import empty from '@/components/empty.vue'
  115. import RenDropdownFilter from '@/components/ren-dropdown-filter/ren-dropdown-filter.vue'
  116. // 调用手机系统权限
  117. // #ifdef APP-PLUS
  118. import permision from "@/components/permission.js";
  119. // #endif
  120. export default {
  121. components: {
  122. RenDropdownFilter,
  123. empty
  124. },
  125. onShareAppMessage(res) { //发送给朋友
  126. return {
  127. title: this.tuiguang,
  128. path: '/pages/index/index?invitation=' + this.invitationCode,
  129. imageUrl: this.tuiguangImg,
  130. }
  131. },
  132. onShareTimeline(res) { //分享到朋友圈
  133. return {
  134. title: this.tuiguang,
  135. path: '/pages/index/index?invitation=' + this.invitationCode,
  136. imageUrl: this.tuiguangImg,
  137. }
  138. },
  139. data() {
  140. return {
  141. tpSel: 0,
  142. tpCount: 0,
  143. showTP: false,
  144. invitationCode: '',
  145. tuiguang: '',
  146. tuiguangImg: '',
  147. city: '请选择城市',
  148. latitude: '',
  149. longitude: '',
  150. page: 1,
  151. limit: 10,
  152. orderList: [],
  153. tabIndex: -1,
  154. swiperList: [],
  155. typeList: [],
  156. value1: 0,
  157. value2: 0,
  158. value3: 0,
  159. defaultIndex: [0, 0, 0],
  160. classifyId: '',
  161. filterData: [
  162. [{
  163. label: '推荐',
  164. value: '',
  165. }, ],
  166. [{
  167. label: '价格',
  168. value: '0',
  169. },
  170. {
  171. label: '从高到低',
  172. value: '1',
  173. },
  174. {
  175. label: '从低到高',
  176. value: '2',
  177. }
  178. ],
  179. [{
  180. label: '销量',
  181. value: '0',
  182. },
  183. {
  184. label: '从高到低',
  185. value: '1',
  186. },
  187. {
  188. label: '从低到高',
  189. value: '2',
  190. }
  191. ],
  192. ],
  193. txAppKey: '',
  194. list: [{
  195. name: '综合排序',
  196. id: 1
  197. }, {
  198. name: '价格',
  199. id: 2
  200. }, {
  201. name: '销量',
  202. id: 3
  203. }, {
  204. name: '好评度',
  205. id: 4
  206. }],
  207. arr: [],
  208. showModal: true,
  209. listIndex: 0,
  210. XCXIsSelect: '否',
  211. }
  212. },
  213. onLoad(e) {
  214. let that = this
  215. // 获取邀请码保存到本地
  216. if (e.invitation) {
  217. that.$queue.setData('inviterCode', e.invitation);
  218. }
  219. // #ifdef MP-WEIXIN
  220. if (e.scene) {
  221. const scene = decodeURIComponent(e.scene);
  222. this.$queue.setData('inviterCode', scene.split(',')[0]);
  223. }
  224. // #endif
  225. that.$Request.getT('/app/common/type/250').then(res => { //技师完成通知
  226. if (res.code == 0) {
  227. if (res.data && res.data.value) {
  228. that.arr.push(res.data.value)
  229. }
  230. }
  231. })
  232. that.$Request.getT('/app/common/type/248').then(res => { //技师取消通知
  233. if (res.code == 0) {
  234. if (res.data && res.data.value) {
  235. that.arr.push(res.data.value)
  236. }
  237. }
  238. })
  239. that.$Request.getT('/app/common/type/217').then(res => { //腾讯地图key
  240. if (res.code == 0) {
  241. if (res.data && res.data.value) {
  242. that.txAppKey = res.data.value;
  243. }
  244. }
  245. })
  246. that.getBannerList();
  247. that.getZiZhi()
  248. that.XCXIsSelect = that.$queue.getData('XCXIsSelect');
  249. that.invitationCode = uni.getStorageSync('invitationCode')
  250. uni.getLocation({
  251. type: 'gcj02',
  252. geocode: true, //设置该参数为true可直接获取经纬度及城市信息
  253. success: function(res) {
  254. console.log(res, '地理位置')
  255. that.latitude = res.latitude
  256. that.longitude = res.longitude
  257. uni.setStorageSync('latitude', res.latitude)
  258. uni.setStorageSync('longitude', res.longitude)
  259. // #ifdef APP-PLUS
  260. that.city = res.address.city
  261. that.selectCity(that.longitude, that.latitude);
  262. uni.setStorageSync('city', res.address.city)
  263. // that.page = 1
  264. // that.getorderlist('')
  265. that.getKTCityList();
  266. // #endif
  267. // #ifdef H5
  268. that.selectCity(that.longitude, that.latitude);
  269. // #endif
  270. // #ifdef MP-WEIXIN
  271. uni.request({
  272. url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + that.latitude +
  273. ',' + that.longitude + '&key=' + that.txAppKey,
  274. success(re) {
  275. if (re.statusCode === 200) {
  276. let citydata = re.data.result.address_component.city
  277. // console.log("获取城市名称成功", citydata)/
  278. that.city = citydata ? citydata : '未知'
  279. uni.setStorageSync('city', citydata)
  280. that.getKTCityList();
  281. // that.page = 1
  282. // that.getorderlist('')
  283. } else {
  284. console.log("获取信息失败,请重试!")
  285. }
  286. }
  287. });
  288. // #endif
  289. },
  290. fail: function(err) {
  291. console.log(err);
  292. // #ifdef APP-PLUS
  293. that.checkPermission();
  294. // #endif
  295. }
  296. })
  297. that.page = 1
  298. that.getorderlist('')
  299. },
  300. onShow() {
  301. this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
  302. this.$Request.get('/app/common/type/297').then(res => {
  303. if (res.code == 0) {
  304. // #ifdef MP-WEIXIN
  305. this.$queue.setData('XCXIsSelect', res.data.value);
  306. // #endif
  307. // #ifndef MP-WEIXIN
  308. this.$queue.setData('XCXIsSelect', '是');
  309. // #endif
  310. this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
  311. }
  312. });
  313. let userId = this.$queue.getData('userId');
  314. if (userId) {
  315. this.getTpMy();
  316. this.getTpCount();
  317. this.checkNewUser();
  318. // #ifdef MP-WEIXIN
  319. //订阅
  320. if (this.showModal) {
  321. this.openMsg()
  322. }
  323. // #endif
  324. this.city = uni.getStorageSync('city')
  325. this.getKTCityList();
  326. this.latitude = uni.getStorageSync('latitude')
  327. this.longitude = uni.getStorageSync('longitude')
  328. }
  329. this.page = 1
  330. this.getorderlist('')
  331. },
  332. methods: {
  333. goNav(url) {
  334. let userId = this.$queue.getData('userId');
  335. if (!userId) {
  336. uni.navigateTo({
  337. url: '/pages/public/login'
  338. });
  339. return;
  340. }
  341. if (url.indexOf('/pages/') !== -1 || url.indexOf('/my/') !== -1) {
  342. uni.navigateTo({
  343. url
  344. });
  345. } else {
  346. //#ifndef H5
  347. uni.navigateTo({
  348. url: '/pages/index/webView?url=' + url
  349. });
  350. //#endif
  351. //#ifdef H5
  352. window.location.href = url;
  353. //#endif
  354. }
  355. },
  356. async checkPermission() {
  357. console.log(11111111)
  358. let status = permision.isIOS ? await permision.requestIOS('location') : await permision.requestAndroid(
  359. 'android.permission.ACCESS_FINE_LOCATION');
  360. if (status === null || status === 1) {
  361. status = 1;
  362. } else if (status === 2) {
  363. uni.showModal({
  364. content: "系统定位已关闭",
  365. confirmText: "确定",
  366. showCancel: false,
  367. success: function(res) {}
  368. })
  369. } else if (status.code) {
  370. uni.showModal({
  371. content: status.message
  372. })
  373. } else {
  374. uni.showModal({
  375. title: '定位服务已关闭',
  376. content: "您需要打开定位权限,否则我们将无法获得到您附近的项目服务,导致我们无法为您提供服务,请到>设置>隐私>定位服务>中开启【上门服务】定位权限",
  377. confirmText: "设置",
  378. success: function(res) {
  379. if (res.confirm) {
  380. permision.gotoAppSetting();
  381. }
  382. }
  383. })
  384. }
  385. return status;
  386. },
  387. saveTP() {
  388. let userId = this.$queue.getData('userId');
  389. if (!userId) {
  390. uni.navigateTo({
  391. url: '/pages/public/login'
  392. });
  393. return;
  394. }
  395. let userName = this.$queue.getData('userName');
  396. this.$queue.showLoading('投票中...');
  397. this.$Request.postJson('/app/message/insertMessage', {
  398. state: 11,
  399. content: this.city,
  400. userName: userName,
  401. userId: userId
  402. })
  403. .then(res => {
  404. if (res.code === 0) {
  405. uni.showToast({
  406. title: '投票成功!'
  407. });
  408. this.getTpCount();
  409. this.getTpMy();
  410. } else {
  411. uni.hideLoading();
  412. uni.showModal({
  413. showCancel: false,
  414. title: '投票失败',
  415. content: res.msg
  416. });
  417. }
  418. });
  419. },
  420. getTpMy() {
  421. this.$Request.getT('/app/message/selectMessageByUserId?page=1&limit=1&state=11').then(res => {
  422. if (res.code == 0) {
  423. if (res.data && res.data.list && res.data.list.length > 0) {
  424. this.tpSel = 1;
  425. } else {
  426. this.tpSel = 2;
  427. }
  428. }
  429. });
  430. },
  431. getTpCount() {
  432. this.$Request.getT('/app/message/selectCityCount?city=' + this.city).then(res => {
  433. if (res.code == 0) {
  434. this.tpCount = res.data ? res.data : 0;
  435. }
  436. });
  437. },
  438. getCity(e) {
  439. console.log(e[0].label);
  440. this.city = e[0].label;
  441. uni.setStorageSync('city', this.city)
  442. this.getKTCityList();
  443. this.page = 1
  444. this.getlist()
  445. },
  446. getKTCityList() {
  447. let cityName = uni.getStorageSync('city') ? uni.getStorageSync('city') : '请选择城市'
  448. if (cityName === '请选择城市') {
  449. return;
  450. }
  451. this.$Request.getT('/app/trip/selectTripList').then(res => {
  452. if (res.code == 0) {
  453. this.cityList = [];
  454. let isOpen = false
  455. let cityName = uni.getStorageSync('city') ? uni.getStorageSync('city') : '请选择城市'
  456. res.data.forEach((d, index) => {
  457. if (cityName === d.city) {
  458. isOpen = true;
  459. }
  460. let data = {}
  461. data.label = d.city
  462. data.value = index
  463. this.cityList.push(data);
  464. });
  465. if (!isOpen) {
  466. // this.orderList = []
  467. // this.showTP = true;
  468. // uni.showToast({
  469. // title: '当前城市暂未开通,请切换城市',
  470. // duration: 2000,
  471. // icon: 'none'
  472. // });
  473. } else {
  474. this.showTP = false;
  475. }
  476. }
  477. });
  478. },
  479. // 开启订阅消息
  480. openMsg() {
  481. console.log('订阅消息')
  482. var that = this
  483. uni.getSetting({
  484. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  485. success(ret) {
  486. console.log(ret.subscriptionsSetting, '------------------')
  487. // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
  488. if (ret.subscriptionsSetting.itemSettings) {
  489. uni.setStorageSync('sendMsg', true)
  490. uni.openSetting({ // 打开设置页
  491. success(rea) {
  492. console.log(rea.authSetting)
  493. }
  494. });
  495. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  496. uni.setStorageSync('sendMsg', false)
  497. uni.showModal({
  498. title: '提示',
  499. content: '为了更好的体验,请绑定消息推送',
  500. confirmText: '确定',
  501. cancelText: '取消',
  502. success: function(res) {
  503. if (res.confirm) {
  504. wx.requestSubscribeMessage({
  505. tmplIds: that.arr,
  506. success(re) {
  507. var datas = JSON.stringify(re);
  508. if (datas.indexOf("accept") != -1) {
  509. console.log(re)
  510. // uni.setStorageSync('sendMsg', true)
  511. }
  512. },
  513. fail: (res) => {
  514. console.log(res)
  515. }
  516. })
  517. // uni.setStorageSync('sendMsg', true)
  518. that.showModal = false
  519. } else if (res.cancel) {
  520. console.log('取消')
  521. // uni.setStorageSync('sendMsg', false)
  522. that.showModal = true
  523. }
  524. }
  525. })
  526. }
  527. }
  528. })
  529. },
  530. // 分享文案和图片
  531. getZiZhi() {
  532. this.$Request.getT('/app/common/type/299').then(res => { //分享文案 299
  533. if (res.code === 0) {
  534. this.tuiguang = res.data.value;
  535. }
  536. });
  537. this.$Request.getT('/app/common/type/300').then(res => { //分享图片 300
  538. if (res.code === 0) {
  539. this.tuiguangImg = res.data.value;
  540. }
  541. });
  542. },
  543. // 筛选
  544. change(index) {
  545. // this.value1 = e[0][0].value
  546. // this.value2 = e[1][0].value
  547. // this.value3 = e[2][0].value
  548. this.listIndex = index
  549. this.page = 1
  550. this.getorderlist('')
  551. },
  552. GetQuan() {
  553. let userId = this.$queue.getData('userId');
  554. this.$Request.getT('/app/coupon/insertNewUserCoupon').then(res => {
  555. if (res.code == 0) {
  556. this.$refs.popushongbao.close();
  557. this.$queue.showToast('领取成功!')
  558. setTimeout(d => {
  559. uni.navigateTo({
  560. url: '/my/hongbao/youhuijuan'
  561. });
  562. }, 1000);
  563. } else {
  564. this.$queue.showToast(res.msg)
  565. }
  566. });
  567. },
  568. checkNewUser() {
  569. this.$Request.getT("/app/user/selectUserById").then(res => {
  570. if (res.code == 0) {
  571. if (res.data && res.data.isCoupon != 1) {
  572. setTimeout(d => {
  573. this.$refs.popushongbao.open();
  574. }, 2000);
  575. }
  576. if (!res.data.wxOpenId) { //授权微信
  577. let url = window.location.origin + '/pages/index/order/test'
  578. console.log('url==========', url);
  579. return window.location.href =
  580. `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbcba29ef4f698074&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect`
  581. }
  582. }
  583. });
  584. },
  585. //获取轮播图
  586. getBannerList() {
  587. this.$Request.get("/app/banner/selectBannerList", {
  588. classify: 1
  589. }).then(res => {
  590. if (res.code == 0) {
  591. this.swiperList = res.data
  592. console.log(this.swiperList);
  593. }
  594. });
  595. this.$Request.get("/app/dict/list", {
  596. type: '服务类型'
  597. }).then(res => {
  598. if (res.code == 0) {
  599. if (res.data) {
  600. this.typeList = res.data
  601. console.log(res.data, 'dsaaaa');
  602. this.classifyId = res.data[0].id;
  603. this.page = 1
  604. this.getorderlist('')
  605. }
  606. }
  607. });
  608. },
  609. // 跳转订单
  610. goOrder(e) {
  611. // #ifdef MP-WEIXIN
  612. if (uni.getStorageSync('sendMsg')) {
  613. wx.requestSubscribeMessage({
  614. tmplIds: this.arr,
  615. success(re) {
  616. var datas = JSON.stringify(re);
  617. if (datas.indexOf("accept") != -1) {
  618. console.log(re)
  619. }
  620. },
  621. fail: (res) => {
  622. console.log(res)
  623. }
  624. })
  625. }
  626. // #endif
  627. let token = this.$queue.getData('token')
  628. if (token) {
  629. uni.navigateTo({
  630. url: '/pages/index/order/order?massageTypeId=' + e.massageTypeId
  631. });
  632. } else {
  633. uni.navigateTo({
  634. url: '/pages/public/login'
  635. });
  636. }
  637. },
  638. // 选择城市
  639. goSelectCity() {
  640. uni.navigateTo({
  641. url: '/pages/index/citys/citys'
  642. });
  643. },
  644. // 跳转搜索
  645. goSearch(index) {
  646. // #ifdef MP-WEIXIN
  647. if (uni.getStorageSync('sendMsg')) {
  648. wx.requestSubscribeMessage({
  649. tmplIds: this.arr,
  650. success(re) {
  651. var datas = JSON.stringify(re);
  652. if (datas.indexOf("accept") != -1) {
  653. console.log(re)
  654. }
  655. },
  656. fail: (res) => {
  657. console.log(res)
  658. }
  659. })
  660. }
  661. // #endif
  662. uni.navigateTo({
  663. url: '/pages/index/search/index?index=' + index
  664. });
  665. },
  666. selectCity(longitude, latitude) {
  667. this.$Request.get('/app/Login/selectCity?lat=' + latitude + '&lng=' + longitude).then(res => {
  668. if (res.code == 0) {
  669. this.city = res.data.city ? res.data.city : '未知'
  670. uni.setStorageSync('city', res.data.city)
  671. this.page = 1
  672. this.getorderlist('')
  673. this.getKTCityList();
  674. }
  675. });
  676. },
  677. selTab(index, id) {
  678. // #ifdef APP-PLUS
  679. if (this.latitude === '' || this.longitude === '') {
  680. this.checkPermission();
  681. return;
  682. }
  683. // #endif
  684. this.tabIndex = index;
  685. this.classifyId = id;
  686. this.page = 1
  687. this.getorderlist('')
  688. },
  689. getorderlist(type) {
  690. console.log('city', this.city);
  691. let city = this.city;
  692. if (this.city === '请选择城市') {
  693. // city = '';
  694. if (type === 'refresh') {
  695. uni.stopPullDownRefresh();
  696. }
  697. return;
  698. }
  699. let index = this.list[this.listIndex].id
  700. let data = {
  701. classifyId:this.tabIndex==-1?0: this.classifyId,
  702. page: this.page,
  703. limit: this.limit,
  704. status: 1,
  705. by: index, //销量
  706. latitude: this.latitude,
  707. longitude: this.longitude,
  708. city: city
  709. }
  710. this.$Request.get("/app/artificer/selectMassageTypePage", data).then(res => {
  711. if (res.code == 0) {
  712. if (this.page == 1) {
  713. for (let i = 0; i < res.data.list.length; i++) {
  714. if (res.data.list[i].labels) {
  715. res.data.list[i].labels = res.data.list[i].labels.split(",");
  716. } else {
  717. res.data.list[i].labels = []
  718. }
  719. }
  720. this.orderList = res.data.list
  721. } else {
  722. for (let i = 0; i < res.data.list.length; i++) {
  723. if (res.data.list[i].labels) {
  724. res.data.list[i].labels = res.data.list[i].labels.split(",");
  725. } else {
  726. res.data.list[i].labels = []
  727. }
  728. }
  729. this.orderList = [...this.orderList, ...res.data.list]
  730. }
  731. // if (this.orderList.length == 0) {
  732. // this.orderList = []
  733. // uni.showToast({
  734. // title: '当前城市暂未开通,请切换城市',
  735. // duration: 2000,
  736. // icon: 'none'
  737. // });
  738. // }
  739. }
  740. if (type === 'refresh') {
  741. uni.stopPullDownRefresh();
  742. }
  743. })
  744. }
  745. },
  746. onReachBottom: function() {
  747. this.page = this.page + 1;
  748. this.getorderlist('')
  749. },
  750. onPullDownRefresh: function() {
  751. this.page = 1;
  752. this.getorderlist('refresh');
  753. this.getZiZhi()
  754. }
  755. }
  756. </script>
  757. <style lang="scss">
  758. .icon-box {
  759. display: flex;
  760. flex-direction: column;
  761. align-items: center;
  762. margin-right: 50rpx;
  763. }
  764. .type_box {
  765. display: flex;
  766. align-items: center;
  767. margin-top: 20rpx;
  768. }
  769. page {
  770. background: linear-gradient(179deg, #FFC2D5 0%, #F6F6F6 800rpx);
  771. }
  772. .bg {
  773. background: #FFFFFF;
  774. }
  775. .ytp_view {
  776. background: #e3e3e3;
  777. width: 400rpx;
  778. border-radius: 10rpx;
  779. font-size: 28rpx;
  780. text-align: center;
  781. height: 80rpx;
  782. line-height: 80rpx;
  783. color: #848484;
  784. margin-top: 40rpx;
  785. }
  786. .tp_view {
  787. background: #ee6c54;
  788. width: 400rpx;
  789. border-radius: 10rpx;
  790. font-size: 28rpx;
  791. text-align: center;
  792. height: 80rpx;
  793. line-height: 80rpx;
  794. color: #FFFFFF;
  795. margin-top: 40rpx;
  796. }
  797. .bannerImg {
  798. width: 686rpx;
  799. height: 320upx;
  800. border-radius: 32rpx;
  801. }
  802. .box {
  803. // width: 128rpx;
  804. height: 48rpx;
  805. line-height: 48rpx;
  806. background: #FFECF2;
  807. border-radius: 32rpx 32rpx 32rpx 32rpx;
  808. text-align: center;
  809. letter-spacing: 2rpx;
  810. margin-right: 8upx;
  811. font-size: 24rpx;
  812. padding: 0 16rpx;
  813. color: #FF6E98;
  814. }
  815. .list_item {
  816. // width: 650upx;
  817. // height: 160upx;
  818. width: 92%;
  819. // margin: 30rpx 0;
  820. background: #FFFFFF;
  821. border-radius: 24upx;
  822. padding: 20upx;
  823. display: flex;
  824. align-items: center;
  825. margin-bottom: 20upx;
  826. .listitem_rightview {
  827. margin-left: 20upx;
  828. width: 80%;
  829. padding-top: 10rpx;
  830. .btnview {
  831. display: flex;
  832. align-items: center;
  833. justify-content: space-between;
  834. // margin-top: 12upx;
  835. width: 100%;
  836. }
  837. .titleview {
  838. display: flex;
  839. align-items: flex-end;
  840. justify-content: space-between
  841. }
  842. .moneyview {
  843. display: flex;
  844. align-items: flex-end;
  845. image {
  846. width: 30upx;
  847. height: 30upx;
  848. margin-left: 20upx;
  849. margin-bottom: 2upx;
  850. }
  851. }
  852. .item_time {
  853. font-size: 24upx;
  854. font-family: PingFang SC;
  855. font-weight: 500;
  856. color: #999999;
  857. margin-left: 10upx;
  858. }
  859. .item_money {
  860. font-size: 40rpx;
  861. font-family: PingFang SC;
  862. font-weight: 800;
  863. color: #FF6E98;
  864. .oldPrice_view {
  865. font-size: 24rpx;
  866. font-family: PingFang SC;
  867. font-weight: 400;
  868. text-decoration: line-through;
  869. color: #AAAAAA;
  870. margin-left: 8rpx;
  871. }
  872. text {
  873. font-size: 24upx;
  874. }
  875. }
  876. .item_oldmoney {
  877. font-size: 24upx;
  878. font-family: PingFang SC;
  879. font-weight: 500;
  880. text-decoration: line-through;
  881. color: #999999;
  882. margin-left: 10upx;
  883. }
  884. .item_btn {
  885. width: 160upx;
  886. height: 64rpx;
  887. background: linear-gradient(313deg, #FFE6EE 0%, #FFBACA 100%);
  888. border-radius: 36rpx;
  889. text-align: center;
  890. line-height: 64rpx;
  891. font-size: 28rpx;
  892. font-family: PingFang SC;
  893. font-weight: bold;
  894. color: #222222;
  895. position: relative;
  896. }
  897. .item_yishou {
  898. font-size: 22upx;
  899. font-family: PingFang SC;
  900. font-weight: 500;
  901. color: #999999;
  902. }
  903. .item_title {
  904. width: 320rpx;
  905. overflow: hidden;
  906. text-overflow: ellipsis;
  907. white-space: nowrap;
  908. font-size: 28upx;
  909. font-family: PingFang SC;
  910. font-weight: bold;
  911. color: #1E1F31;
  912. }
  913. }
  914. image {
  915. width: 220upx;
  916. height: 160upx;
  917. border-radius: 24upx;
  918. }
  919. }
  920. .tabview1 {
  921. border-radius: 24rpx;
  922. z-index: 99;
  923. .tabview {
  924. // width: 686upx;
  925. // // height: 100upx;
  926. background: #F2FFF9;
  927. border-radius: 24rpx 24rpx 0 0;
  928. // margin-top: -50upx;
  929. // z-index: 99;
  930. display: flex;
  931. line-height: 100upx;
  932. .tabItem_sel {
  933. font-size: 30upx;
  934. font-family: PingFang SC;
  935. font-weight: 800;
  936. color: #20C675;
  937. flex: 1;
  938. text-align: center;
  939. }
  940. .tabItem {
  941. font-size: 26upx;
  942. font-family: PingFang SC;
  943. font-weight: 500;
  944. color: #333333;
  945. flex: 1;
  946. text-align: center;
  947. }
  948. }
  949. .tabsx {
  950. width: 686upx;
  951. border-radius: 24rpx;
  952. padding-bottom: 10rpx;
  953. display: flex;
  954. align-items: center;
  955. padding: 20rpx 30rpx;
  956. font-size: 26rpx;
  957. .active {
  958. color: #FF6E98;
  959. font-size: 28rpx;
  960. font-weight: bold;
  961. padding: 4rpx 15rpx;
  962. box-sizing: border-box;
  963. background: linear-gradient(313deg, #FFE6EE 0%, #FFBACA 100%);
  964. border-radius: 36rpx 36rpx 36rpx 36rpx;
  965. }
  966. .normal {
  967. border-radius: 36rpx 36rpx 36rpx 36rpx;
  968. background-color: #fff;
  969. padding: 4rpx 15rpx;
  970. }
  971. }
  972. }
  973. .content {
  974. display: flex;
  975. flex-direction: column;
  976. align-items: center;
  977. justify-content: center;
  978. padding-bottom: 100upx;
  979. }
  980. .logo {
  981. height: 200rpx;
  982. width: 200rpx;
  983. margin-top: 200rpx;
  984. margin-left: auto;
  985. margin-right: auto;
  986. margin-bottom: 50rpx;
  987. }
  988. .text-area {
  989. display: flex;
  990. justify-content: center;
  991. }
  992. .title {
  993. font-size: 36rpx;
  994. color: #8f8f94;
  995. }
  996. </style>