enter.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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="name => tabbarCheck = name"
  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. async confirm(){
  261. var data1=await this.updateUser()
  262. if(data1.errno==200){
  263. uni.setStorageSync("userInfo",this.userInfo)
  264. return
  265. }
  266. },
  267. groupChange(e){
  268. console.log(e)
  269. if(e=='餐饮'){
  270. this.userInfo.autoModule='foodEntry'
  271. }else if(e=='民宿'){
  272. this.userInfo.autoModule='homeEntry'
  273. }else if(e=='酒店'){
  274. this.userInfo.autoModule='hotelEntry'
  275. }
  276. },
  277. async switchChange(e){
  278. var status=e?1:0
  279. console.log(e,111111)
  280. this.userInfo.automaticSkip=status
  281. var data=await this.updateUser()
  282. console.log(data)
  283. if(data.errno==200){
  284. uni.setStorageSync("userInfo",this.userInfo)
  285. uni.showToast({
  286. icon: "none",
  287. title: '已开启自动跳转',
  288. duration: 3000
  289. });
  290. if(uni.getStorageSync("userInfo").foodEntry!=0&&uni.getStorageSync("userInfo").homeEntry==0&&uni.getStorageSync("userInfo").hotelEntry==0){
  291. this.userInfo.autoModule='foodEntry'
  292. var data1=await this.updateUser()
  293. if(data1.errno==200){
  294. uni.setStorageSync("userInfo",this.userInfo)
  295. return
  296. }
  297. }
  298. if(uni.getStorageSync("userInfo").foodEntry==0&&uni.getStorageSync("userInfo").homeEntry!=0&&uni.getStorageSync("userInfo").hotelEntry==0){
  299. this.userInfo.autoModule='homeEntry'
  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==0&&uni.getStorageSync("userInfo").hotelEntry!=0){
  307. this.userInfo.autoModule='hotelEntry'
  308. var data1=await this.updateUser()
  309. if(data1.errno==200){
  310. uni.setStorageSync("userInfo",this.userInfo)
  311. return
  312. }
  313. }
  314. this.radiolist1=[]
  315. if(uni.getStorageSync("userInfo").foodEntry!=0){
  316. this.radiolist1.push({value:'餐饮'})
  317. }
  318. if(uni.getStorageSync("userInfo").homeEntry!=0){
  319. this.radiolist1.push({value:'民宿'})
  320. }
  321. if(uni.getStorageSync("userInfo").hotelEntry!=0){
  322. this.radiolist1.push({value:'酒店'})
  323. }
  324. if(e){
  325. this.editshow = true
  326. }
  327. }else{
  328. uni.showToast({
  329. icon: "none",
  330. title: '自动跳转开启失败',
  331. duration: 3000
  332. });
  333. this.userInfo.automaticSkip = status == 0 ? false : true
  334. }
  335. },
  336. getList(){
  337. this.$request.baseRequest('admin.tourism.carouselManagement', 'list', {
  338. page: 1,
  339. limit: 9999,
  340. classify:'商家版首页'
  341. }, failres => {
  342. uni.showToast({
  343. icon: "none",
  344. title: failres.errmsg,
  345. duration: 3000
  346. });
  347. }).then(res => {
  348. this.fileList=res.data.items
  349. })
  350. },
  351. toDetail(url){
  352. uni.navigateTo({
  353. url:url
  354. })
  355. },
  356. updateUser(){
  357. return new Promise((resolve, reject) => {
  358. that.$request.baseRequest('admin.unimall.commonUserInfo', 'list', {
  359. commonUserInfo:JSON.stringify(this.userInfo)
  360. }, failres => {
  361. reject(failres)
  362. }).then(res => {
  363. resolve(res)
  364. })
  365. })
  366. },
  367. async getPhoneNumber(e) {
  368. that.userInfo = await this.$request.wxlogin()
  369. that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
  370. this.showAuthorizePhone = false
  371. this.showAuthorizeUser = true
  372. },
  373. async authUser(type) {
  374. //同步信息,没有头像和昵称自动生成
  375. this.userInfo = await this.$request.syncInfo(this.userInfo)
  376. if (this.userInfo.openId) {
  377. uni.setStorageSync("userInfo", that.userInfo)
  378. that.showAuthorizeUser = false
  379. // that.mescroll.resetUpScroll()
  380. }
  381. },
  382. //获取昵称输入内容
  383. userNameInput(e) {
  384. this.userInfo.nickname = e.detail.value
  385. },
  386. async onChooseAvatar(e) {
  387. this.$set(this.userInfo, "head", await this.toBase64(e.detail.avatarUrl))
  388. },
  389. toBase64(url) {
  390. return new Promise(resolve => {
  391. pathToBase64(url).then(path => {
  392. resolve(path);
  393. }).catch(error => {
  394. console.log(error)
  395. })
  396. })
  397. },
  398. }
  399. }
  400. </script>
  401. <style lang="scss" scoped>
  402. .slot-content {
  403. width: 100%;
  404. }
  405. /deep/.u-checkbox-group {
  406. position: absolute;
  407. right: 20px;
  408. z-index: 99;
  409. top: 30px;
  410. }
  411. /deep/.u-checkbox__icon-wrap.u-checkbox__icon-wrap--square {
  412. border-color: #D7DEEB !important;
  413. }
  414. /deep/.mescroll-body {
  415. min-height: 558px !important;
  416. height: 558px !important;
  417. background-color: green;
  418. overflow: scroll !important;
  419. }
  420. .auth-btncard {
  421. display: flex !important;
  422. justify-content: space-between !important;
  423. .btn-unok {
  424. width: 40%;
  425. }
  426. .btn-ok {
  427. width: 40%;
  428. }
  429. }
  430. .auth-card {
  431. text-align: center;
  432. .avatar-img {
  433. width: 200rpx;
  434. }
  435. .title {
  436. font-size: 20rpx;
  437. }
  438. .content {
  439. font-size: 32rpx;
  440. font-weight: bold;
  441. color: #1A1A1A;
  442. margin-bottom: 30rpx;
  443. }
  444. }
  445. .avatar-wrapper {
  446. color: #333 !important;
  447. border: none !important;
  448. border-radius: 0 !important;
  449. background-color: transparent !important;
  450. padding: 0;
  451. }
  452. .avatar-wrapper::after {
  453. border: none !important;
  454. }
  455. .avatar {
  456. width: 100rpx;
  457. height: 100rpx;
  458. overflow: hidden;
  459. border-radius: 100%;
  460. }
  461. /deep/.u-popup__content {
  462. border-radius: 20rpx !important;
  463. }
  464. /deep/.u-tabbar-item image{
  465. width:40rpx;
  466. height:40rpx;
  467. }
  468. </style>