index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="container">
  3. <!-- 机构信息区域 -->
  4. <view class="ws-header">
  5. <!-- 用户信息 -->
  6. <view class="user-info">
  7. <image src="@/static/ws/default_avatar.png" mode="widthFix"></image>
  8. <view class="ws-login" @click="toAuthorize">请登录</view>
  9. <!-- <view class="user-text"> 瑞恺迪光电科技有限公司有限公司撒娇观看了 </view> -->
  10. </view>
  11. <!-- 背景图 -->
  12. <image class="user-bg" src="@/static/ws/user_bg.png" mode="widthFix"></image>
  13. </view>
  14. <!-- 机构信息END -->
  15. <!-- 订单状态区域 -->
  16. <view class="order-wrap">
  17. <view class="more">
  18. <text class="title">我的订单</text>
  19. <view> <text class="more-right">全部订单</text> <text class="iconfont iconchakangengduo"></text> </view>
  20. </view>
  21. <view class="line"></view>
  22. <view class="order-nav">
  23. <view class="order-nav-item">
  24. <image src="../../static/ws/dh_dqr_01.png" mode="widthFix"></image> <text>待确认</text>
  25. </view>
  26. <view class="order-nav-item">
  27. <image src="../../static/ws/dh_dfk_02.png" mode="widthFix"></image> <text>待付款</text>
  28. </view>
  29. <view class="order-nav-item">
  30. <image src="../../static/ws/dh_dfh_03.png" mode="widthFix"></image> <text>待发货</text>
  31. </view>
  32. <view class="order-nav-item">
  33. <image src="../../static/ws/dh_yfh_04.png" mode="widthFix"></image> <text>已发货</text>
  34. </view>
  35. <view class="order-nav-item"> <image src="../../static/ws/dh_tk_05.png" mode="widthFix"></image> <text>退款</text> </view>
  36. </view>
  37. </view>
  38. <!-- 订单状态区域END -->
  39. <!-- 帮机构下单 -->
  40. <view class="place-order">
  41. <view class="place-left"> <text class="iconfont iconbangjigouxiadan"></text> <text class="title">帮机构下单</text> </view>
  42. <text class="iconfont iconchakangengduo"></text>
  43. </view>
  44. <!-- 帮机构下单END -->
  45. <!-- 客服 -->
  46. <view class="ws-service"> <text class="iconfont iconzaixiankefu"></text> 在线客服 </view>
  47. </view>
  48. </template>
  49. <script>
  50. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  51. import upgradeAlert from '@/components/cm-module/modelAlert/upgradeAlert.vue'
  52. import authorize from '@/common/config/authorize.js'
  53. import { mapState, mapMutations } from 'vuex'
  54. import { cancelPrompt } from '@/services/use.js'
  55. export default {
  56. components: {
  57. uniBadge,
  58. upgradeAlert
  59. },
  60. data() {
  61. return {
  62. nvabarData: {
  63. //顶部自定义导航
  64. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  65. showSearch: 0,
  66. title: '我的', // 导航栏 中间的标题
  67. haveBack: false,
  68. textLeft: this.$store.state.isIphone,
  69. textColor: '#FFFFFF',
  70. bgColor: ''
  71. },
  72. CustomBar: this.CustomBar, // 顶部导航栏高度
  73. StatusBar: this.StatusBar,
  74. isCmcustom: false,
  75. isUpgradeAlert: false,
  76. bgImgUrl: 'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
  77. name: '',
  78. userType: '',
  79. headpic: '',
  80. userMoney: '0.00',
  81. contactNumber: '',
  82. openid: '',
  83. aboutHtml: '',
  84. telPhone: '',
  85. bindMobile: '',
  86. clubStatus: '', //机构升级会员机构审核状态1:待审核 91:审核失败
  87. userIdentity: '', //机构等级
  88. confirmedCount: 0, //待确认
  89. paymentCount: 0, //待付款角标
  90. waitShipmentsCount: 0, //待收货角标
  91. shipmentsCount: 0, //已发货角标
  92. salesReturnCount: '', //退货/款角标
  93. firstList: [{ name: '帮机构下单', path: '/pages/user/club/club-list', icon: 'icon-yunyingrenyuanguanli' }]
  94. }
  95. },
  96. onLoad() {},
  97. computed: {
  98. ...mapState(['hasLogin', 'userInfo'])
  99. },
  100. methods: {
  101. toAuthorize(){
  102. uni.navigateTo({
  103. url:'/pages/login/authorize'
  104. })
  105. },
  106. getUserInfo() {
  107. let self = this
  108. this.UserService.PersonalInfo({ userID: this.userID })
  109. .then(response => {
  110. this.$store.commit('updateAllNum', response.data.count)
  111. let data = response.data
  112. let $userData = data.user
  113. let $clubData = data.club
  114. if ($userData.ableUserMoney == 0 || $userData.ableUserMoney == null) {
  115. this.userMoney = '0.00'
  116. } else {
  117. let i = $userData.ableUserMoney.toString().lastIndexOf('.')
  118. let money
  119. if (i == -1) {
  120. money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
  121. this.userMoney = money + '.00'
  122. } else {
  123. money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
  124. this.userMoney = money
  125. }
  126. }
  127. this.userIdentity = $userData.userIdentity //机构等级
  128. if (this.userIdentity == 2) {
  129. this.name = $clubData.name //会员机构名称
  130. this.userType = '会员机构'
  131. } else {
  132. this.name = $userData.userName //普通机构名称
  133. this.userType = '普通机构'
  134. }
  135. this.headpic = $userData.image //会所头像
  136. this.bindMobile = $userData.bindMobile //登录手机号
  137. this.clubStatus = $userData.clubStatus //机构审核状态
  138. this.contactNumber = data.organize.contactNumber //联系电话
  139. this.confirmedCount = this.showBadge(data.confirmedCount) //待确认
  140. this.paymentCount = this.showBadge(data.paymentCount) //待付款
  141. this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount) //待收货
  142. this.shipmentsCount = this.showBadge(data.shipmentsCount) //已发货
  143. this.salesReturnCount = this.showBadge(data.salesReturnCount) //退货/款
  144. let clubInfo = { name: this.name, image: this.headpic, clubID: $clubData.clubID }
  145. if ($userData.tipStatus == '0') {
  146. this.isUpgradeAlert = true
  147. }
  148. uni.setStorage({ key: 'clubInfo', data: clubInfo })
  149. })
  150. .catch(error => {
  151. this.$util.msg(error.msg, 2000)
  152. })
  153. },
  154. getPhone() {
  155. this.CommonService.QueryAfterSale()
  156. .then(response => {
  157. this.contactNumber = response.data.contactNumber
  158. })
  159. .catch(error => {
  160. this.$util.msg(error.msg, 2000)
  161. })
  162. },
  163. toPhone() {
  164. uni.makePhoneCall({
  165. phoneNumber: this.contactNumber //仅为示例
  166. })
  167. },
  168. hanldUnBindUpgrade() {
  169. //普通用户不升级会员机构
  170. cancelPrompt({ userId: this.userID }).then(response => {
  171. this.isUpgradeAlert = false
  172. })
  173. },
  174. hanldGoApply() {
  175. cancelPrompt({ userId: this.userID }).then(response => {
  176. this.isUpgradeAlert = false
  177. this.$api.navigateTo(`/pages/login/apply?clubStatus=${this.clubStatus}`)
  178. })
  179. },
  180. navigator(url) {
  181. authorize.getSetting().then(wxResponse => {
  182. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  183. if (wxResponse == 1) {
  184. if (this.hasLogin) {
  185. this.$api.navigateTo(url)
  186. } else {
  187. this.$api.navigateTo('/pages/login/login?type=0')
  188. }
  189. } else {
  190. this.$api.navigateTo('/pages/authorization/authorization?type=1')
  191. }
  192. })
  193. },
  194. navigatorNex(url, type) {
  195. authorize.getSetting().then(wxResponse => {
  196. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  197. if (wxResponse == 1) {
  198. if (!this.hasLogin) {
  199. this.$api.navigateTo(url)
  200. }
  201. } else {
  202. this.$api.navigateTo(`/pages/authorization/authorization?type=${type}`)
  203. }
  204. })
  205. },
  206. showBadge(n) {
  207. let num = ''
  208. if (n > 100) {
  209. num = 99
  210. } else {
  211. num = n
  212. }
  213. return num
  214. },
  215. clubStatusText(state) {
  216. let stateText
  217. switch (state) {
  218. case 90:
  219. stateText = ''
  220. break
  221. case 1:
  222. stateText = '正在审核中'
  223. break
  224. case 92:
  225. stateText = '审核不通过'
  226. break
  227. }
  228. return stateText
  229. }
  230. },
  231. onPageScroll(e) {
  232. //实时获取到滚动的值
  233. if (e.scrollTop > 20) {
  234. this.isCmcustom = true
  235. this.nvabarData.bgColor = '#E37A4B'
  236. this.nvabarData.textColor = '#FFFFFF'
  237. } else {
  238. this.isCmcustom = false
  239. this.nvabarData.bgColor = ''
  240. this.nvabarData.textColor = '#FFFFFF'
  241. }
  242. },
  243. onPullDownRefresh() {
  244. //下拉刷新
  245. if (this.hasLogin) {
  246. this.getUserInfo()
  247. uni.stopPullDownRefresh()
  248. } else {
  249. uni.stopPullDownRefresh()
  250. }
  251. },
  252. onShow() {
  253. if (this.hasLogin) {
  254. this.$api
  255. .getComStorage('userInfo')
  256. .then(resolve => {
  257. this.userID = resolve.userID
  258. this.getUserInfo()
  259. })
  260. .catch(reject => {
  261. console.log('异常处理=========>', reject)
  262. })
  263. } else {
  264. this.getPhone()
  265. this.$store.commit('updateAllNum', 0)
  266. }
  267. }
  268. }
  269. </script>
  270. <style lang="scss">
  271. @import '@/uni.scss';
  272. .container {
  273. background: #f7f7f7;
  274. }
  275. // 用户登录信息区域
  276. .ws-header {
  277. position: relative;
  278. height: 280rpx;
  279. .user-info {
  280. position: absolute;
  281. z-index: 10;
  282. width: 750rpx;
  283. height: 280rpx;
  284. display: flex;
  285. flex-direction: column;
  286. align-items: center;
  287. justify-content: center;
  288. image {
  289. display: block;
  290. width: 120rpx;
  291. height: 120rpx;
  292. border-radius: 50%;
  293. }
  294. }
  295. // 登录按钮
  296. .ws-login {
  297. width: 184rpx;
  298. height: 56rpx;
  299. margin-top: 25rpx;
  300. border-radius: 28rpx;
  301. background: linear-gradient(to right, #fccd90, #b6762f);
  302. line-height: 56rpx;
  303. text-align: center;
  304. color: #ffffff;
  305. font-size: 28rpx;
  306. }
  307. // 公司名
  308. .user-text {
  309. width: 446rpx;
  310. margin-top: 25rpx;
  311. color: #fff;
  312. font-size: 28rpx;
  313. line-height: 40rpx;
  314. text-align: center;
  315. white-space: nowrap;
  316. overflow: hidden;
  317. text-overflow: ellipsis;
  318. }
  319. .user-bg {
  320. width: 100%;
  321. }
  322. }
  323. .more {
  324. width: 750rpx;
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. padding: 23rpx 25rpx;
  329. box-sizing: border-box;
  330. background: #fff;
  331. .more-right {
  332. font-size: 26rpx;
  333. line-height: 37rpx;
  334. margin-right: 10rpx;
  335. }
  336. .title {
  337. font-size: 32rpx;
  338. line-height: 45rpx;
  339. color: #333333;
  340. }
  341. .iconfont {
  342. font-size: 20rpx;
  343. vertical-align: middle;
  344. }
  345. }
  346. .order-wrap {
  347. background: #fff;
  348. .line {
  349. width: 702rpx;
  350. height: 1px;
  351. margin: 0 auto;
  352. background: #f0f0f0;
  353. }
  354. .order-nav {
  355. display: flex;
  356. justify-content: space-evenly;
  357. align-items: center;
  358. padding: 40rpx 0;
  359. .order-nav-item {
  360. display: flex;
  361. align-items: center;
  362. flex-direction: column;
  363. image {
  364. width: 56rpx;
  365. height: 56rpx;
  366. }
  367. text {
  368. font-size: 26rpx;
  369. line-height: 37rpx;
  370. }
  371. }
  372. }
  373. }
  374. .place-order {
  375. width: 750rpx;
  376. display: flex;
  377. justify-content: space-between;
  378. align-items: center;
  379. padding: 23rpx 25rpx;
  380. box-sizing: border-box;
  381. background: #fff;
  382. margin-top: 20rpx;
  383. .place-left {
  384. .title {
  385. font-size: 28rpx;
  386. line-height: 40rpx;
  387. margin-left: 10rpx;
  388. }
  389. .iconfont {
  390. font-size: 36rpx;
  391. vertical-align: middle;
  392. }
  393. }
  394. .iconfont {
  395. font-size: 20rpx;
  396. }
  397. }
  398. .ws-service {
  399. width: 160rpx;
  400. height: 48rpx;
  401. margin: 40rpx auto 0;
  402. display: flex;
  403. justify-content: center;
  404. align-items: center;
  405. font-size: 22rpx;
  406. background: linear-gradient(to right, #fccd90, #b6762f);
  407. color: #fff;
  408. border-radius: 24rpx;
  409. .iconfont{
  410. font-size: 30rpx;
  411. margin-right: 6rpx;
  412. }
  413. }
  414. </style>