enter.vue 12 KB

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