user.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="user-page-container">
  3. <TuanAppShim bg="#f6eadf"></TuanAppShim>
  4. <BaseInfo ref="baseInfoRef" @handleNavigate="handleNavigate"></BaseInfo>
  5. <view class="main-area">
  6. 111
  7. </view>
  8. <tui-modal
  9. :show="$data._isShowTuiModel" title="提示" content="您还未登录,是否先去登录?"
  10. @click="_handleClickTuiModel($event, 'login', '/pages/user/user')"
  11. ></tui-modal>
  12. <TuanChatKF ref="tuanChatKFRef"></TuanChatKF>
  13. <tui-toast ref="toast"></tui-toast>
  14. <!-- 特殊code的 menu 操作 -->
  15. <CodeCreatePopup ref="codeCreateRef"></CodeCreatePopup>
  16. <!-- 参与抽奖输入暗语 -->
  17. <tui-dialog
  18. style="position: relative;z-index: 888;" :buttons="[{ text: '取消' }, { text: '确定', color: '#586c94' }]"
  19. :show="isShowLotteryDialog" title="暗语" @click="handleLotteryDialog"
  20. >
  21. <template #content>
  22. <tui-input v-model="codeWordLottery" label="" type="text" placeholder="请输入抽奖暗语"></tui-input>
  23. </template>
  24. </tui-dialog>
  25. </view>
  26. </template>
  27. <script>
  28. // import { getStorageKeyToken, jumpToOtherProject } from '../../utils'
  29. // import BaseInfo from './cpns/BaseInfo'
  30. // import Pane from './cpns/Pane.vue'
  31. // import showModalMixin from '../../mixin/showModal'
  32. // import { T_STORAGE_KEY } from '../../constant'
  33. // import { myFunction, myServe, additionalFunction, shopServe, myPreferential, otherFunction } from './data'
  34. // import { Encrypt } from '../../utils/secret'
  35. export default {
  36. name: 'User',
  37. components: {
  38. BaseInfo,
  39. Pane
  40. },
  41. // mixins: [ showModalMixin() ],
  42. onShow() {
  43. this.init()
  44. },
  45. data() {
  46. return {
  47. timer: null,
  48. myFunction,
  49. myServe,
  50. shopServe,
  51. additionalFunction,
  52. myPreferential,
  53. otherFunction,
  54. isShowOther: false,
  55. userInfo: {},
  56. bindingCode: '',
  57. // 参与抽奖
  58. isShowLotteryDialog: false,
  59. codeWordLottery: ''
  60. }
  61. },
  62. methods: {
  63. init() {
  64. this.userInfo = uni.getStorageSync(T_STORAGE_KEY) || {}
  65. if (this.isLogin()) {
  66. this.$refs.baseInfoRef && this.$refs.baseInfoRef.userIsPurchase()
  67. this.$store.dispatch('auth/refrshUserInfoAction')
  68. this.$store.dispatch('user/count')
  69. }
  70. this.$forceUpdate()
  71. },
  72. handleNavigate(item, cb) {
  73. // if (['/user/sever/customer-service/customer-service', '/user/sever/chat/chat'].includes(item.url)) {
  74. // this.$refs.tuanChatKFRef.show();
  75. // return;
  76. // }
  77. if (item.navigate) {
  78. item.navigate()
  79. return
  80. }
  81. if (item.type === 'external') {
  82. this.go('/user/view?target=' + item.url)
  83. return
  84. }
  85. if (this.isLogin()) {
  86. if (item.type === 'participateLottery') {
  87. this.isShowLotteryDialog = true
  88. return
  89. } else if (item.type === 'userInvitation') {
  90. if (this.$store.state.auth.identityInfo.type.includes(1)) {
  91. uni.showActionSheet({
  92. title: '* 请选择业务 *',
  93. itemList: ['关系链绑定', '绑定加盟商'],
  94. itemColor: '#2c3e50',
  95. success: (res) => {
  96. if (res.tapIndex === 0) {
  97. this.go('/another-tf/another-user/user-invitation/index')
  98. } else if (res.tapIndex === 1) {
  99. this.$refs.codeCreateRef.getCode('franchiseeInvitation')
  100. }
  101. }
  102. })
  103. } else {
  104. this.go('/another-tf/another-user/user-invitation/index')
  105. }
  106. return
  107. } else if (item.type === 'flyToService') {
  108. // this.$store.dispatch('app/getCustomerServiceAction', { isToService: true })
  109. this.go('/another-tf/another-user/chat/chat-detail?chat=serviceAssistant')
  110. return
  111. } else if (item.type === 'settle') {
  112. const storageKeyToken = getStorageKeyToken()
  113. if (storageKeyToken) {
  114. jumpToOtherProject(`${item.url}/#/?username=${this.userInfo.name}&user=${Encrypt(storageKeyToken)}`)
  115. }
  116. return
  117. } else if (item.type === 'shopInvitation') {
  118. this.$refs.codeCreateRef.getCode('shopInvitation')
  119. return
  120. }
  121. if (!item.url) {
  122. this.empty()
  123. return
  124. }
  125. if (cb && typeof cb === 'function' && cb()) {
  126. uni.navigateTo({
  127. url: item.url
  128. })
  129. } else {
  130. uni.navigateTo({
  131. url: item.url
  132. })
  133. }
  134. } else {
  135. this.$data._isShowTuiModel = true
  136. }
  137. },
  138. handleLotteryDialog(e) {
  139. if (e.index === 0) { } else if (e.index === 1) {
  140. if (!(this.codeWordLottery === '新年快乐')) return this.$showToast('暗语错误')
  141. this.go(`/pages/jump/jump?userId=${this.userInfo.buyerUserId}&type=participateLottery&code=`)
  142. }
  143. this.codeWordLottery = ''
  144. this.isShowLotteryDialog = false
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="less" scoped>
  150. .user-page-container {
  151. widows: 100vw;
  152. min-height: 100vh;
  153. background-color: #f6f6f5;
  154. padding-bottom: 120upx;
  155. .main-area {
  156. width: 100%;
  157. padding: 0 32upx 32upx;
  158. box-sizing: border-box;
  159. /deep/ .menu-title {
  160. font-size: 24upx;
  161. color: #3a3629;
  162. }
  163. /deep/ .menu-icon {
  164. width: 64upx;
  165. height: 64upx;
  166. }
  167. /deep/ .menu-item {
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. flex-direction: column;
  172. }
  173. /deep/ .order-pane {
  174. margin-top: 20upx;
  175. }
  176. }
  177. }
  178. /deep/ .tui-loading-init {
  179. position: inherit;
  180. transform: translate(0, 0);
  181. background-color: transparent;
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. width: 100vw;
  186. min-width: 100vw;
  187. max-width: 100vw;
  188. flex-direction: row;
  189. // padding-top: 30upx;
  190. }
  191. /deep/ .tui-loadmore-tips {
  192. color: #ff7a4e;
  193. margin-bottom: 40upx;
  194. }
  195. /deep/ .tui-loading-center {
  196. border-color: #ff7a4e;
  197. }
  198. </style>