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