index.vue 11 KB

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