index.vue 11 KB

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