enter.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view>
  3. <u-navbar title="入驻" placeholder='true' :autoBack="true">
  4. </u-navbar>
  5. <view>
  6. <u-swiper :list="fileList" autoplay radius='0' :circular="true"
  7. @change="e => current = e.current" @click="click">
  8. <view slot="indicator" class="indicator">
  9. <view class="indicator__dot" v-for="(item, index) in fileList" :key="index"
  10. :class="[index === current && 'indicator__dot--active']">
  11. </view>
  12. </view>
  13. </u-swiper>
  14. </view>
  15. <view>
  16. <luyj-grid-link :list="list" @gridExc="clickGrid" @switchChange='switchChange'></luyj-grid-link>
  17. </view>
  18. <u-modal :show="editshow" @confirm="$u.debounce(confirm,500)" title="选择自动跳转内容" @cancel="editshow=false" closeOnClickOverlay showCancelButton>
  19. <view class="slot-content">
  20. <u-radio-group v-model="radiovalue1" placement="column" @change="groupChange">
  21. <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
  22. :label="item.value" :name="item.value">
  23. </u-radio>
  24. </u-radio-group>
  25. </view>
  26. </u-modal>
  27. <u-tabbar :value="tabbarCheck" @change="tabbarChange" activeColor="#5F7DE9">
  28. <u-tabbar-item name="team" text="加入">
  29. <image class="u-page__item__slot-icon" slot="active-icon"
  30. src="@/static/image/nav-icon/antOutline-team Copy.png"></image>
  31. <image class="u-page__item__slot-icon" slot="inactive-icon"
  32. src="@/static/image/nav-icon/antOutline-team.png"></image>
  33. </u-tabbar-item>
  34. <u-tabbar-item name="notification" text="通知">
  35. <image class="u-page__item__slot-icon" slot="active-icon"
  36. src="@/static/image/nav-icon/md-notifications_none Copy.png"></image>
  37. <image class="u-page__item__slot-icon" slot="inactive-icon"
  38. src="@/static/image/nav-icon/md-notifications_none.png"></image>
  39. </u-tabbar-item>
  40. <u-tabbar-item name="user" text="我的">
  41. <image class="u-page__item__slot-icon" slot="active-icon"
  42. src="@/static/image/nav-icon/antOutline-user1 Copy.png"></image>
  43. <image class="u-page__item__slot-icon" slot="inactive-icon"
  44. src="@/static/image/nav-icon/antOutline-user1.png"></image>
  45. </u-tabbar-item>
  46. </u-tabbar>
  47. </view>
  48. </template>
  49. <script>
  50. var that
  51. import {
  52. pathToBase64,
  53. base64ToPath
  54. } from 'image-tools'
  55. import luyjGridLink from '@/uni_modules/lxm-fold-link/luyj-grid-link/components/luyj-grid-link/luyj-grid-link.vue'
  56. export default {
  57. components: {
  58. "luyjGridLink": luyjGridLink
  59. },
  60. data() {
  61. return {
  62. fileList: [],
  63. editshow: false,
  64. tabbarCheck: 'team',
  65. showAuthorizePhone: false,
  66. showAuthorizeUser: false,
  67. radiolist1: [],
  68. radiovalue1: '',
  69. userInfo: {
  70. head: '',
  71. nickname: '',
  72. phone: '',
  73. },
  74. customStyleUnOk: {
  75. marginTop: '20rpx',
  76. color: '#5F7DE9',
  77. border: '2px solid #5F7DE9',
  78. "border-radius": "10px",
  79. fontSize: "32rpx"
  80. },
  81. customStyleOk: {
  82. marginTop: '20rpx',
  83. color: '#fff',
  84. border: '2px solid #5F7DE9',
  85. "border-radius": "10px",
  86. fontSize: "32rpx",
  87. background: "#5F7DE9"
  88. },
  89. list: [{
  90. title: '全部分类',
  91. // cur: 'basic',
  92. bgColor: '', // 背景颜色
  93. color: 'blue',
  94. title_show: true,
  95. showAll: false,
  96. colNumber: 4, // 显示的列数
  97. iconsList: [{
  98. cuIcon: '1_canyin-35',
  99. color: 'blue',
  100. name: '餐饮',
  101. status: true,
  102. url: '/pageA/enter/cateringindustry'
  103. },
  104. {
  105. cuIcon: 'zufang',
  106. color: 'blue',
  107. name: '民宿',
  108. status: true,
  109. url: '/pageA/enter/homestay'
  110. },
  111. {
  112. cuIcon: 'jiudian-38',
  113. color: 'blue',
  114. name: '酒店',
  115. status: true,
  116. url: '/pageA/enter/hotel'
  117. }
  118. ]
  119. },
  120. {
  121. title: '我的入驻',
  122. // cur: 'basic',
  123. bgColor: '', // 背景颜色
  124. color: 'blue',
  125. title_show: true,
  126. foodEntry: 0,
  127. homeEntry: 0,
  128. hotelEntry: 0,
  129. switch: true,
  130. showAll: false,
  131. switch_status: true,
  132. colNumber: 4, // 显示的列数
  133. iconsList: [{
  134. cuIcon: '1_canyin-35',
  135. color: 'blue',
  136. name: '餐饮',
  137. status: true,
  138. url: '/pageA/enter/myCateringdustry/index'
  139. },
  140. {
  141. cuIcon: 'zufang',
  142. color: 'blue',
  143. name: '民宿',
  144. status: true,
  145. url: '/pageA/enter/myHomestay/index'
  146. },
  147. {
  148. cuIcon: 'jiudian-38',
  149. color: 'blue',
  150. name: '酒店',
  151. status: true,
  152. url: '/pageA/enter/hotel'
  153. }
  154. ]
  155. },
  156. ],
  157. }
  158. },
  159. onLoad() {
  160. that = this
  161. this.userInfo = uni.getStorageSync("userInfo")
  162. if (uni.getStorageSync("userInfo").phone && uni.getStorageSync("userInfo").automaticSkip) {
  163. if (uni.getStorageSync("userInfo").autoModule == 'foodEntry') {
  164. uni.navigateTo({
  165. url: '/pageA/enter/myCateringdustry/index'
  166. })
  167. } else if (uni.getStorageSync("userInfo").autoModule == 'homeEntry') {
  168. uni.navigateTo({
  169. url: '/pageA/enter/myHomestay/index'
  170. })
  171. } else if (uni.getStorageSync("userInfo").autoModule == 'hotelEntry') {
  172. uni.navigateTo({
  173. url: '/pageA/enter/hotel'
  174. })
  175. }
  176. }
  177. this.getList()
  178. },
  179. onShow: function() {
  180. let _isLoad = uni.getStorageSync("scanAddCardToIndex")
  181. if (uni.getStorageSync("userInfo").phone) {
  182. if (uni.getStorageSync("userInfo").foodEntry == 0 && uni.getStorageSync("userInfo").homeEntry == 0 &&
  183. uni.getStorageSync("userInfo").hotelEntry == 0) {
  184. this.list[1].switch_status = false
  185. } else {
  186. this.list[1].switch_status = uni.getStorageSync("userInfo").automaticSkip ? true : false
  187. }
  188. if (uni.getStorageSync("userInfo").foodEntry > 0) {
  189. this.list[1].iconsList[0].status = true
  190. } else {
  191. this.list[1].iconsList[0].status = false
  192. }
  193. if (uni.getStorageSync("userInfo").homeEntry > 0) {
  194. this.list[1].iconsList[1].status = true
  195. this.list[0].iconsList[1].status = false
  196. } else {
  197. this.list[1].iconsList[1].status = false
  198. this.list[0].iconsList[1].status = true
  199. }
  200. if (uni.getStorageSync("userInfo").hotelEntry > 0) {
  201. this.list[1].iconsList[2].status = true
  202. this.list[0].iconsList[2].status = false
  203. } else {
  204. this.list[1].iconsList[2].status = false
  205. this.list[0].iconsList[2].status = true
  206. }
  207. } else {}
  208. },
  209. methods: {
  210. tabbarChange(e) {
  211. console.log(e)
  212. if (e == 'notification') {
  213. uni.navigateTo({
  214. url: '/pageA/notice/index'
  215. })
  216. } else if (e == 'user') {
  217. uni.navigateTo({
  218. url: '/pageA/my/my'
  219. })
  220. }
  221. // name => tabbarCheck = name
  222. },
  223. async confirm() {
  224. var data1 = await this.updateUser()
  225. if (data1.errno == 200) {
  226. uni.setStorageSync("userInfo", this.userInfo)
  227. this.editshow = false
  228. }
  229. },
  230. groupChange(e) {
  231. console.log(e)
  232. if (e == '餐饮') {
  233. this.userInfo.autoModule = 'foodEntry'
  234. } else if (e == '民宿') {
  235. this.userInfo.autoModule = 'homeEntry'
  236. } else if (e == '酒店') {
  237. this.userInfo.autoModule = 'hotelEntry'
  238. }
  239. },
  240. async switchChange(e) {debugger
  241. var status = e ? 1 : 0
  242. console.log(e, 111111)
  243. // this.userInfo.automaticSkip = status
  244. // var data = await this.updateUser()
  245. // console.log(data)
  246. // if (data.errno == 200) {
  247. // uni.setStorageSync("userInfo", this.userInfo)
  248. // uni.showToast({
  249. // icon: "none",
  250. // title: '已开启自动跳转',
  251. // duration: 3000
  252. // });
  253. // if (uni.getStorageSync("userInfo").foodEntry != 0 && uni.getStorageSync("userInfo").homeEntry ==
  254. // 0 && uni.getStorageSync("userInfo").hotelEntry == 0) {
  255. // this.userInfo.autoModule = 'foodEntry'
  256. // var data1 = await this.updateUser()
  257. // if (data1.errno == 200) {
  258. // uni.setStorageSync("userInfo", this.userInfo)
  259. // return
  260. // }
  261. // }
  262. // if (uni.getStorageSync("userInfo").foodEntry == 0 && uni.getStorageSync("userInfo").homeEntry !=
  263. // 0 && uni.getStorageSync("userInfo").hotelEntry == 0) {
  264. // this.userInfo.autoModule = 'homeEntry'
  265. // var data1 = await this.updateUser()
  266. // if (data1.errno == 200) {
  267. // uni.setStorageSync("userInfo", this.userInfo)
  268. // return
  269. // }
  270. // }
  271. // if (uni.getStorageSync("userInfo").foodEntry == 0 && uni.getStorageSync("userInfo").homeEntry ==
  272. // 0 && uni.getStorageSync("userInfo").hotelEntry != 0) {
  273. // this.userInfo.autoModule = 'hotelEntry'
  274. // var data1 = await this.updateUser()
  275. // if (data1.errno == 200) {
  276. // uni.setStorageSync("userInfo", this.userInfo)
  277. // return
  278. // }
  279. // }
  280. // this.radiolist1 = []
  281. // if (uni.getStorageSync("userInfo").foodEntry != 0) {
  282. // this.radiolist1.push({
  283. // value: '餐饮'
  284. // })
  285. // }
  286. // if (uni.getStorageSync("userInfo").homeEntry != 0) {
  287. // this.radiolist1.push({
  288. // value: '民宿'
  289. // })
  290. // }
  291. // if (uni.getStorageSync("userInfo").hotelEntry != 0) {
  292. // this.radiolist1.push({
  293. // value: '酒店'
  294. // })
  295. // }
  296. if (e) {
  297. if (uni.getStorageSync("userInfo").foodEntry != 0 && uni.getStorageSync("userInfo").homeEntry ==
  298. 0 && uni.getStorageSync("userInfo").hotelEntry == 0) {
  299. this.userInfo.autoModule = 'foodEntry'
  300. var data1 = await this.updateUser()
  301. if (data1.errno == 200) {
  302. uni.setStorageSync("userInfo", this.userInfo)
  303. return
  304. }
  305. }
  306. if (uni.getStorageSync("userInfo").foodEntry == 0 && uni.getStorageSync("userInfo").homeEntry !=
  307. 0 && uni.getStorageSync("userInfo").hotelEntry == 0) {
  308. this.userInfo.autoModule = 'homeEntry'
  309. var data1 = await this.updateUser()
  310. if (data1.errno == 200) {
  311. uni.setStorageSync("userInfo", this.userInfo)
  312. return
  313. }
  314. }
  315. if (uni.getStorageSync("userInfo").foodEntry == 0 && uni.getStorageSync("userInfo").homeEntry ==
  316. 0 && uni.getStorageSync("userInfo").hotelEntry != 0) {
  317. this.userInfo.autoModule = 'hotelEntry'
  318. var data1 = await this.updateUser()
  319. if (data1.errno == 200) {
  320. uni.setStorageSync("userInfo", this.userInfo)
  321. return
  322. }
  323. }
  324. this.radiolist1 = []
  325. if (uni.getStorageSync("userInfo").foodEntry != 0) {
  326. this.radiolist1.push({
  327. value: '餐饮'
  328. })
  329. }
  330. if (uni.getStorageSync("userInfo").homeEntry != 0) {
  331. this.radiolist1.push({
  332. value: '民宿'
  333. })
  334. }
  335. if (uni.getStorageSync("userInfo").hotelEntry != 0) {
  336. this.radiolist1.push({
  337. value: '酒店'
  338. })
  339. }
  340. this.editshow = true
  341. }else{
  342. this.userInfo.automaticSkip = status
  343. var data = await this.updateUser()
  344. console.log(data)
  345. if (data.errno == 200) {
  346. uni.setStorageSync("userInfo", this.userInfo)
  347. uni.showToast({
  348. icon: "none",
  349. title: '已开关闭动跳转',
  350. duration: 3000
  351. });
  352. }
  353. else {
  354. uni.showToast({
  355. icon: "none",
  356. title: '自动跳转关闭失败',
  357. duration: 3000
  358. });
  359. this.userInfo.automaticSkip = status == 0 ? false : true
  360. }
  361. }
  362. },
  363. getList() {
  364. this.$request.baseRequest('admin.tourism.carouselManagement', 'list', {
  365. page: 1,
  366. limit: 9999,
  367. classify: '商家版首页'
  368. }, failres => {
  369. uni.showToast({
  370. icon: "none",
  371. title: failres.errmsg,
  372. duration: 3000
  373. });
  374. }).then(res => {
  375. this.fileList = res.data.items
  376. })
  377. },
  378. toDetail(url) {
  379. uni.navigateTo({
  380. url: url
  381. })
  382. },
  383. updateUser() {
  384. return new Promise((resolve, reject) => {
  385. that.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  386. commonUserInfo: JSON.stringify(this.userInfo)
  387. }, failres => {
  388. reject(failres)
  389. }).then(res => {
  390. resolve(res)
  391. })
  392. })
  393. },
  394. async getPhoneNumber(e) {
  395. that.userInfo = await this.$request.wxlogin()
  396. that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
  397. this.showAuthorizePhone = false
  398. this.showAuthorizeUser = true
  399. },
  400. async authUser(type) {
  401. //同步信息,没有头像和昵称自动生成
  402. this.userInfo = await this.$request.syncInfo(this.userInfo)
  403. if (this.userInfo.openId) {
  404. uni.setStorageSync("userInfo", that.userInfo)
  405. that.showAuthorizeUser = false
  406. // that.mescroll.resetUpScroll()
  407. }
  408. },
  409. //获取昵称输入内容
  410. userNameInput(e) {
  411. this.userInfo.nickname = e.detail.value
  412. },
  413. async onChooseAvatar(e) {
  414. this.$set(this.userInfo, "head", await this.toBase64(e.detail.avatarUrl))
  415. },
  416. toBase64(url) {
  417. return new Promise(resolve => {
  418. pathToBase64(url).then(path => {
  419. resolve(path);
  420. }).catch(error => {
  421. console.log(error)
  422. })
  423. })
  424. },
  425. }
  426. }
  427. </script>
  428. <style lang="scss" scoped>
  429. .slot-content {
  430. width: 100%;
  431. }
  432. /deep/.u-checkbox-group {
  433. position: absolute;
  434. right: 20px;
  435. z-index: 99;
  436. top: 30px;
  437. }
  438. /deep/.u-checkbox__icon-wrap.u-checkbox__icon-wrap--square {
  439. border-color: #D7DEEB !important;
  440. }
  441. /deep/.mescroll-body {
  442. min-height: 558px !important;
  443. height: 558px !important;
  444. background-color: green;
  445. overflow: scroll !important;
  446. }
  447. .auth-btncard {
  448. display: flex !important;
  449. justify-content: space-between !important;
  450. .btn-unok {
  451. width: 40%;
  452. }
  453. .btn-ok {
  454. width: 40%;
  455. }
  456. }
  457. .auth-card {
  458. text-align: center;
  459. .avatar-img {
  460. width: 200rpx;
  461. }
  462. .title {
  463. font-size: 20rpx;
  464. }
  465. .content {
  466. font-size: 32rpx;
  467. font-weight: bold;
  468. color: #1A1A1A;
  469. margin-bottom: 30rpx;
  470. }
  471. }
  472. .avatar-wrapper {
  473. color: #333 !important;
  474. border: none !important;
  475. border-radius: 0 !important;
  476. background-color: transparent !important;
  477. padding: 0;
  478. }
  479. .avatar-wrapper::after {
  480. border: none !important;
  481. }
  482. .avatar {
  483. width: 100rpx;
  484. height: 100rpx;
  485. overflow: hidden;
  486. border-radius: 100%;
  487. }
  488. /deep/.u-popup__content {
  489. border-radius: 20rpx !important;
  490. }
  491. /deep/.u-tabbar-item image {
  492. width: 40rpx;
  493. height: 40rpx;
  494. }
  495. </style>