index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. <template>
  2. <view v-if="!isFirstload" class="container" :style="appThemeStyle">
  3. <!-- 页面头部 -->
  4. <view class="main-header">
  5. <img class="bg-image" src="@/static/background/user-header2.png" alt="" />
  6. <!-- 用户信息 -->
  7. <view v-if="false" class="user-info">
  8. <view class="user-avatar" @click="handlePersonal()">
  9. <avatar-image :url="userInfo.avatar_url" :width="100" />
  10. </view>
  11. <view class="user-content">
  12. <!-- 会员昵称 -->
  13. <view class="nick-name oneline-hide" @click="handlePersonal()">{{ userInfo.nick_name }}</view>
  14. <!-- 会员等级 -->
  15. <view v-if="$checkModule('user-grade') && userInfo.grade_id > 0 && userInfo.grade" class="user-grade">
  16. <view class="user-grade_icon">
  17. <image
  18. class="image"
  19. src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA0lBMVEUAAAD/tjL/tzH/uDP/uC7/tjH/tzH/tzL/tTH+tTL+tjP/tDD/tTD+tzD/tjL/szD/uDH/tjL/tjL+tjD/tjT/szb/tzL/tTL+uTH+tjL/tjL/tjL/tTT/tjL/tjL+tjH/uTL/vDD/tjL/tjH/tzL9uS//tTL/nBr/sS7/tjH/ujL/szD/uTv+rzf/tzL+tzH+vDP+uzL+tjP+ry7+tDL9ki/7szf/sEX/tTL/tjL+tjL/tTH/tTT/tzH/tzL/tjP/sTX/uTP/wzX+rTn/vDX9vC8m8ckhAAAAOXRSTlMAlnAMB/vjxKWGMh0S6drMiVxPRkEY9PLy0ru0sKagmo5+dGtgVCMgBP716eXWyMGxqJGRe2o5KSmFNjaYAAABP0lEQVQ4y8XS13KDMBAF0AWDDe4t7r3ETu9lVxJgJ/n/X8rKAzHG5TE+Twz3zki7I/g/KXdghIbGJewrU4yzn08Ebgl6TuZzzuOC6W5es3HX6qsSz3NFShRU0MpucytDmOSpu3yULx3CA9RD1HjVedc0jSjqm6ZzhUjDsFDQhSp/OKj5GQvg0+ZCOixsbtDLAeTTOm/yGi8GyIphIVsgH737FEDV44LJa88IRKK/SetrwT9G/GUIr6vXjoy4GXn7+RboVXnghuSjaoGecwQxL2su3CwAKlO+QFoqxI4FMctHQhQd2OhxTu184jWUlI+rMTBTn1/IQcJHQ6GQdZ7pWiDaNdhTt330efISeiqYwQEzQpTlsURJLhzkEmpCPsERfeIUVyXr6MNuIyp5uziW6xURtt7hhGwzmMNJExfO4Bd9X0ZPqAxdNwAAAABJRU5ErkJggg=="
  20. >
  21. </image>
  22. </view>
  23. <view class="user-grade_name">
  24. <text>{{ userInfo.grade.name }}</text>
  25. </view>
  26. </view>
  27. <!-- 会员无等级时显示手机号 -->
  28. <view v-else class="mobile">{{ userInfo.mobile }}</view>
  29. </view>
  30. </view>
  31. <!-- 未登录 -->
  32. <view v-else class="user-info">
  33. <view class="user-avatar user-logos">
  34. <img style="width: 100%; height: 100%" src="@/static/background/bg2111.jpg" alt="" />
  35. </view>
  36. <view class="user-content">
  37. <view class="nick-name r_flex">
  38. {{ userInfoData.customername ? userInfoData.customername : '当前是微信登录' }}
  39. <view v-if="userInfoData.customerzjhm" class="smTitle r_flex_center">
  40. <i-fingerprint-three style="margin-right: 4rpx" theme="outline" size="16" fill="#8dc63f" :strokeWidth="2" strokeLinejoin="bevel" strokeLinecap="square" />
  41. 已实名
  42. </view>
  43. </view>
  44. <view class="login-tips">{{ userInfoData.customerqym ? `您的企业码:${userInfoData.customerqym}` : '您还没有企业码' }}</view>
  45. <view class="login-tips">{{ wx_userid ? `客户ID:${wx_userid}` : '您还没有客户ID' }}</view>
  46. <!-- <view class="login-tips">点击登录账号-</view> -->
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 绑定手机号 -->
  51. <!-- <view class="my-mobile" v-if="!userInfoData.customertel" @click="handleBindMobile()">
  52. <view class="info">点击绑定手机号,为了您的数据安全</view>
  53. <view class="btn-bind">去绑定</view>
  54. </view> -->
  55. <!-- 我的钱包 -->
  56. <view v-if="false" class="my-asset">
  57. <view class="asset-left flex-box dis-flex flex-x-around">
  58. <view v-if="$checkModule('market-recharge')" class="asset-left-item" style="max-width: 200rpx" @click="onTargetWallet">
  59. <view class="item-value dis-flex flex-x-center">
  60. <text class="oneline-hide">{{ isLogin ? assets.balance : '--' }}</text>
  61. </view>
  62. <view class="item-name dis-flex flex-x-center">
  63. <text>账户余额</text>
  64. </view>
  65. </view>
  66. <view v-if="$checkModule('market-points')" class="asset-left-item" @click="onTargetPoints">
  67. <view class="item-value dis-flex flex-x-center">
  68. <text class="oneline-hide">{{ isLogin ? assets.points : '--' }}</text>
  69. </view>
  70. <view class="item-name dis-flex flex-x-center">
  71. <text>{{ setting[SettingKeyEnum.POINTS.value].points_name }}</text>
  72. </view>
  73. </view>
  74. <view v-if="$checkModule('market-coupon')" class="asset-left-item" @click="onTargetMyCoupon">
  75. <view class="item-value dis-flex flex-x-center">
  76. <text class="oneline-hide">{{ isLogin ? assets.coupon : '--' }}</text>
  77. </view>
  78. <view class="item-name dis-flex flex-x-center">
  79. <text>优惠券</text>
  80. </view>
  81. </view>
  82. </view>
  83. <view v-if="$checkModule('market-recharge')" class="asset-right">
  84. <view class="asset-right-item" @click="onTargetWallet">
  85. <view class="item-icon dis-flex flex-x-center">
  86. <text class="iconfont icon-qianbao"></text>
  87. </view>
  88. <view class="item-name dis-flex flex-x-center">
  89. <text>我的钱包</text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <!-- 点击实名认证 (第2种样式) -->
  95. <!-- <view class="my-mobile2" v-if="!userInfoData.customerzjhm" @click="handleService('pages/user/realname/index')">
  96. <view class="info">还没有实名</view>
  97. <view class="btn-bind">点击实名认证</view>
  98. </view> -->
  99. <!-- 订单操作 -->
  100. <view class="order-navbar">
  101. <view class="order-navbar-item r_flex" v-for="(item, index) in orderNavbar" :key="index" @click="onTargetOrder(item)">
  102. <view class="item-icon">
  103. <text class="iconfont" :class="[`icon-${item.icon}`]"></text>
  104. </view>
  105. <view class="item-name">{{ item.name }}</view>
  106. <i-more class="filter-one" theme="outline" size="30" fill="#fff" :strokeWidth="2" strokeLinejoin="bevel" strokeLinecap="square" />
  107. <!-- 数量标题 -->
  108. <!-- <view class="item-badge" v-if="item.count && item.count > 0">
  109. <text v-if="item.count <= 99" class="text">{{ item.count }}</text>
  110. <text v-else class="text">99+</text>
  111. </view> -->
  112. </view>
  113. </view>
  114. <!-- 订购用户操作 -->
  115. <view class="">
  116. <view class="oub_list order-user-buy" v-for="(item, index) in uderBuyOder" :key="index">
  117. <view class="oub_text oub_text01 r_flex_space">{{ item.yhinfozh }} <u-tag :text="item.yhinfozt" size="mini" type="success" mode="light" /></view>
  118. <view class="oub_text">客户手机:{{ item.yhinfotel }}</view>
  119. <view class="oub_text">产品名称:{{ item.payorderproductname }}({{ item.payorderproductlimit }}{{ item.payorderproductlimittype }})</view>
  120. <!-- <view class="oub_text">产品时长:{{ item.payorderproductlimit }}{{ item.payorderproductlimittype }}</view> -->
  121. <view class="oub_text">实付金额:{{ item.payorderproductprice1 }}</view>
  122. <view class="oub_text">开始时间:{{ item.yhinfostardate }}</view>
  123. <!-- <view class="oub_text">客户账号:{{ item.yhinfozh }}</view>
  124. <view class="oub_text">客户密码:{{ item.yhinfomm }}</view> -->
  125. <view class="r_flex_space" style="margin: 5px 0px;" >
  126. <view class="oub_text">到期时间:{{ item.yhinfoenddate }}</view>
  127. <view class="buttom_view" @click="onXufei(item)">续费</view>
  128. </view>
  129. <view class="r_flex_space" style="margin: 5px 0px;" >
  130. <view class="oub_text">客户账号:{{ item.yhinfozh }}</view>
  131. <view class="buttom_view" @click="onFuzhi(item.yhinfozh)">复制账号</view>
  132. </view>
  133. <view class="r_flex_space" style="margin: 5px 0px;" >
  134. <view class="oub_text">客户密码:{{ item.yhinfomm }}</view>
  135. <view class="buttom_view" @click="onFuzhi(item.yhinfomm)">复制密码</view>
  136. </view>
  137. <view class="r_flex_space" style="margin: 5px 0px;" >
  138. <view class="oub_text">服务器地址:szpop1.hninpop.com:8443</view>
  139. <view class="buttom_view" @click="onFuzhi('szpop1.hninpop.com:8443')">复制地址</view>
  140. </view>
  141. <view class="oub_text buttom_view" @click="onUrl(item)" >使用说明</view>
  142. <!-- <view class="oub_text">下行平均速度:{{ item.payorderradiusxxpj }}</view>
  143. <view class="oub_text">下行最大速度:{{ item.payorderradiusxxmax }}</view>
  144. <view class="oub_text">上行平均速度:{{ item.payorderradiussxpj }}</view>
  145. <view class="oub_text">上行最大速度:{{ item.payorderradiussxmax }}</view> -->
  146. <!-- <view class="oub_text">订单资费:{{ item.payorderzfsfsx }}</view> -->
  147. </view>
  148. </view>
  149. <!-- 我的服务 -->
  150. <view class="my-service" v-if="false">
  151. <view class="service-title">我的服务</view>
  152. <view class="service-content clearfix">
  153. <block v-for="(item, index) in service" :key="index">
  154. <view class="service-item" @click="handleService(item)">
  155. <view class="item-icon">
  156. <text class="iconfont" :class="[`icon-${item.icon}`]"></text>
  157. </view>
  158. <view class="item-name">{{ item.name }}</view>
  159. <view class="item-badge" v-if="item.count && item.count > 0">
  160. <text v-if="item.count <= 99" class="text">{{ item.count }}</text>
  161. <text v-else class="text">99+</text>
  162. </view>
  163. </view>
  164. <!-- 在线客服 -->
  165. <!-- <view class="service-item">
  166. <customer-btn>
  167. <view class="item-icon">
  168. <text class="iconfont" :class="[`icon-${item.icon}`]"></text>
  169. </view>
  170. <view class="item-name">{{ item.name }}</view>
  171. </customer-btn>
  172. </view> -->
  173. </block>
  174. </view>
  175. </view>
  176. <!-- 退出登录 -->
  177. <view v-if="isLogin" class="my-logout">
  178. <view class="logout-btn" @click="handleLogout()">
  179. <text>退出登录</text>
  180. </view>
  181. </view>
  182. <!-- 提示框 -->
  183. <u-modal v-model="modalShow" :confirm-text="'前往认证'" @confirm="onTargetOrder({id: 'comment'})">
  184. <view class="modalCenter">
  185. 尊敬的客户,您有
  186. <text class="icon-red">{{ modalNum }}</text> 笔订单待激活,根据国家工信部实名制要求,请根据提示完成实名认证后激活此产品服务。
  187. </view>
  188. </u-modal>
  189. </view>
  190. </template>
  191. <script>
  192. import store from '@/store'
  193. import {inArray} from '@/utils/util'
  194. import AvatarImage from '@/components/avatar-image'
  195. import CustomerBtn from '@/components/customer-btn'
  196. import {setCartTabBadge} from '@/core/app'
  197. import SettingKeyEnum from '@/common/enum/setting/Key'
  198. import SettingModel from '@/common/model/Setting' // 网址设置接口
  199. import * as UserApi from '@/api/user'
  200. import * as OrderApi from '@/api/order'
  201. import {checkLogin, filterModules} from '@/core/app'
  202. import storage from '@/utils/storage'
  203. import StoreModel from '@/common/model/Store'
  204. import * as AppApi from '@/api/app'
  205. // 订单操作
  206. const orderNavbar = [
  207. {
  208. id: 'all',
  209. name: '全部订单',
  210. icon: 'qpdingdan'
  211. },
  212. // {
  213. // id: 'payment',
  214. // name: '待支付订单',
  215. // icon: 'daifukuan',
  216. // count: 0
  217. // },
  218. // {
  219. // id: 'delivery',
  220. // name: '待发货',
  221. // icon: 'daifahuo',
  222. // count: 0
  223. // },
  224. {
  225. id: 'comment',
  226. name: '已支付订单',
  227. icon: 'daishouhuo',
  228. count: 0
  229. }
  230. ]
  231. /**
  232. * 我的服务
  233. * id: 标识; name: 标题名称; icon: 图标; type 类型(link和button); url: 跳转的链接
  234. */
  235. const service = [
  236. {
  237. id: 'address',
  238. name: '人脸核实',
  239. icon: 'shouhuodizhi',
  240. type: 'link',
  241. url: 'pages/address/index'
  242. },
  243. {
  244. id: 'coupon',
  245. name: '销户',
  246. icon: 'lingquan',
  247. type: 'link',
  248. url: 'pages/coupon/index',
  249. moduleKey: 'market-coupon'
  250. },
  251. {
  252. id: 'myCoupon',
  253. name: '变更套餐',
  254. icon: 'youhuiquan',
  255. type: 'link',
  256. url: 'pages/my-coupon/index',
  257. moduleKey: 'market-coupon'
  258. },
  259. {
  260. id: 'refund',
  261. name: '退换/售后',
  262. icon: 'shouhou',
  263. type: 'link',
  264. url: 'pages/refund/index',
  265. count: 0
  266. },
  267. {
  268. id: 'contact',
  269. name: '在线客服',
  270. icon: 'kefu',
  271. type: 'contact'
  272. },
  273. {
  274. id: 'points',
  275. name: '成为代理商',
  276. icon: 'jifen',
  277. type: 'link',
  278. url: 'pages/login/index',
  279. moduleKey: 'market-points'
  280. },
  281. {
  282. id: 'orderCenter',
  283. name: '订单中心',
  284. icon: 'order-c',
  285. type: 'link',
  286. url: 'pages/order/center'
  287. },
  288. {
  289. id: 'help',
  290. name: '我的帮助',
  291. icon: 'bangzhu',
  292. type: 'link',
  293. url: 'pages/help/index',
  294. moduleKey: 'content-help'
  295. }
  296. ]
  297. export default {
  298. components: {
  299. AvatarImage,
  300. CustomerBtn
  301. },
  302. // 计算属性
  303. computed: {
  304. // 计算属性的
  305. userInfoComputd: () => {
  306. return storage.get('wx_userinfo')
  307. }
  308. },
  309. data() {
  310. return {
  311. modalShow: false,
  312. modalNum: 0,
  313. inArray,
  314. // 枚举类
  315. SettingKeyEnum,
  316. // 正在加载
  317. isLoading: true,
  318. // 首次加载
  319. isFirstload: true,
  320. // 是否已登录
  321. isLogin: false,
  322. // 系统设置
  323. setting: {},
  324. // 当前用户信息
  325. userInfo: {},
  326. // 账户资产
  327. assets: {
  328. balance: '--',
  329. points: '--',
  330. coupon: '--'
  331. },
  332. // 我的服务
  333. service,
  334. // 订单操作
  335. orderNavbar,
  336. // 当前用户待处理的订单数量
  337. todoCounts: {
  338. payment: 0,
  339. deliver: 0,
  340. received: 0
  341. },
  342. wx_userid: storage.get('wx_userid'),
  343. userInfoData: {},
  344. // 用户与订单数据
  345. uderBuyOder: []
  346. }
  347. },
  348. /**
  349. * 生命周期函数--监听页面显示
  350. */
  351. onLoad(options) {},
  352. /**
  353. * 生命周期函数--监听页面显示
  354. */
  355. onShow(options) {
  356. this.onRefreshPage()
  357. this.userInfoData = storage.get('wx_userinfo')
  358. // 实名认证弹窗
  359. this.netmodalShow()
  360. },
  361. methods: {
  362. async netmodalShow() {
  363. // 获取支付数据
  364. const params = {
  365. pageindex: 1,
  366. rows: 999,
  367. 'payorderopenid.value': storage.get('wx_openid'),
  368. 'payordercustomerid.value': storage.get('wx_userid'),
  369. 'payorderlx.value': '新购',
  370. pagevalue: 311
  371. }
  372. const {Data: res} = await AppApi._get_list(params)
  373. this.modalNum = res.Total
  374. if (res.Total > 0) {
  375. this.modalShow = true
  376. }
  377. },
  378. async onUrl() {
  379. // 获取支付数据
  380. // 打开一个新窗口,并导航到指定的URL
  381. window.open('https://support.hninpop.com', '_blank');
  382. },
  383. // 提交支付订单
  384. async onXufei(data) {
  385. // 跳转至商品列表页
  386. this.$navTo('pages/goods/list', {type: 'productxfky'})
  387. return
  388. const app = this
  389. const pram = {
  390. // 客户id
  391. customerid: storage.get('wx_userid'),
  392. // 用户id
  393. yhinfoid: data.yhinfoid,
  394. openid: storage.get('wx_openid'),
  395. // 支付方式
  396. paysortid: data.paysortid,
  397. // 产品类型
  398. productid: data.productid
  399. }
  400. const res = await AppApi.plXufei(pram).finally(() => {})
  401. if (app.curPaymentItem.paysortname == '支付宝') {
  402. // 发起支付宝支付
  403. this.formDom = res.Data
  404. app.$toast('提交支付宝中...')
  405. if (this.formDom) {
  406. setTimeout(() => {
  407. document.forms['alipaysubmit'].submit()
  408. app.disabled = false
  409. }, 500)
  410. setTimeout(() => {
  411. app.$navTo('pages/user/index')
  412. }, 1000)
  413. }
  414. } else if (app.curPaymentItem.paysortname == '微信') {
  415. // 发起微信支付
  416. this.formDom = res.Data
  417. const wechat = res
  418. app.$toast('提交微信中...')
  419. WeixinJSBridge.invoke(
  420. 'getBrandWCPayRequest',
  421. {
  422. appId: wechat.Data.appId, //公众号ID,由商户传入
  423. timeStamp: wechat.Data.timeStamp, //时间戳,自1970年以来的秒数
  424. nonceStr: wechat.Data.nonceStr, //随机串
  425. package: wechat.Data.package,
  426. signType: wechat.Data.signType, //微信签名方式:
  427. paySign: wechat.Data.paySign
  428. },
  429. function (res) {
  430. // 支付成功
  431. if (res.err_msg == 'get_brand_wcpay_request:ok') {
  432. // 使用以上方式判断前端返回,微信团队郑重提示:
  433. app.$toast('支付成功')
  434. }
  435. // 支付过程中用户取消
  436. if (res.err_msg == 'get_brand_wcpay_request:cancel') {
  437. app.$toast('支付取消')
  438. }
  439. // 支付失败
  440. if (res.err_msg == 'get_brand_wcpay_request:fail') {
  441. app.$toast('支付失败')
  442. }
  443. }
  444. )
  445. }
  446. },
  447. // 刷新页面
  448. onRefreshPage() {
  449. // 更新购物车角标
  450. setCartTabBadge()
  451. // 判断是否已登录
  452. this.isLogin = checkLogin()
  453. // 获取页面数据
  454. this.getPageData()
  455. },
  456. // 获取页面数据
  457. async getPageData(callback) {
  458. console.log('下拉刷新user')
  459. const app = this
  460. try {
  461. // 初始化订单操作数据
  462. // app.initOrderTabbar()
  463. // 更新user信息
  464. await StoreModel.getCustomerData()
  465. await app.netmodalShow()
  466. app.uderBuyOder = storage.get('wx_yhinfo')
  467. // app.uderBuyOder = [{name: '111'}]
  468. console.log(app.uderBuyOder, 'uderBuyOder')
  469. } finally {
  470. app.isFirstload = false
  471. // 下拉关闭
  472. uni.stopPullDownRefresh()
  473. }
  474. },
  475. async onFuzhi(data) {
  476. const app = this
  477. uni.setClipboardData({
  478. data: data,
  479. success: () => app.$toast('复制成功'),
  480. fail: ({ errMsg }) => app.$toast('复制失败 ' + errMsg)
  481. })
  482. },
  483. // 初始化我的服务数据
  484. async initService() {
  485. const app = this
  486. // const isShowCustomerBtn = await SettingModel.isShowCustomerBtn()
  487. const newService = []
  488. service.forEach((item) => {
  489. // 默认开启
  490. item.enabled = true
  491. // // 我的积分
  492. // if (item.id === 'points') {
  493. // item.name = '我的' + app.setting[SettingKeyEnum.POINTS.value].points_name
  494. // }
  495. // // 企业微信客服
  496. // if (item.id === 'contact' && !isShowCustomerBtn) {
  497. // item.enabled = false
  498. // }
  499. // 数据角标
  500. if (item.count != undefined) {
  501. item.count = app.todoCounts[item.id]
  502. }
  503. newService.push(item)
  504. })
  505. app.service = filterModules(newService)
  506. },
  507. // 初始化订单操作数据
  508. initOrderTabbar() {
  509. const app = this
  510. const newOrderNavbar = []
  511. orderNavbar.forEach((item) => {
  512. if (item.count != undefined) {
  513. item.count = app.todoCounts[item.id]
  514. }
  515. newOrderNavbar.push(item)
  516. })
  517. app.orderNavbar = newOrderNavbar
  518. },
  519. // 获取商城设置
  520. getSetting() {
  521. const app = this
  522. return new Promise((resolve, reject) => {
  523. resolve(true)
  524. // SettingModel.data()
  525. // .then((setting) => {
  526. // app.setting = setting
  527. // resolve(setting)
  528. // })
  529. // .catch(reject)
  530. })
  531. },
  532. // 获取当前用户信息
  533. getUserInfo() {
  534. const app = this
  535. return new Promise((resolve, reject) => {
  536. !app.isLogin
  537. ? resolve(null)
  538. : UserApi.info(
  539. {},
  540. {
  541. load: app.isFirstload
  542. }
  543. )
  544. .then((result) => {
  545. app.userInfo = result.data.userInfo
  546. resolve(app.userInfo)
  547. })
  548. .catch((err) => {
  549. if (err.result && err.result.status == 401) {
  550. app.isLogin = false
  551. resolve(null)
  552. } else {
  553. reject(err)
  554. }
  555. })
  556. })
  557. },
  558. // 获取账户资产
  559. getUserAssets() {
  560. const app = this
  561. return new Promise((resolve, reject) => {
  562. !app.isLogin
  563. ? resolve(null)
  564. : UserApi.assets(
  565. {},
  566. {
  567. load: app.isFirstload
  568. }
  569. )
  570. .then((result) => {
  571. app.assets = result.data.assets
  572. resolve(app.assets)
  573. })
  574. .catch((err) => {
  575. if (err.result && err.result.status == 401) {
  576. app.isLogin = false
  577. resolve(null)
  578. } else {
  579. reject(err)
  580. }
  581. })
  582. })
  583. },
  584. // 获取当前用户待处理的订单数量
  585. getTodoCounts() {
  586. const app = this
  587. return new Promise((resolve, reject) => {
  588. !app.isLogin
  589. ? resolve(null)
  590. : OrderApi.todoCounts(
  591. {},
  592. {
  593. load: app.isFirstload
  594. }
  595. )
  596. .then((result) => {
  597. app.todoCounts = result.data.counts
  598. resolve(app.todoCounts)
  599. })
  600. .catch((err) => {
  601. if (err.result && err.result.status == 401) {
  602. app.isLogin = false
  603. resolve(null)
  604. } else {
  605. reject(err)
  606. }
  607. })
  608. })
  609. },
  610. // 跳转到登录页
  611. handleLogin() {
  612. !this.isLogin && this.$navTo('pages/login/index')
  613. },
  614. // 跳转到绑定手机号页面
  615. handleBindMobile() {
  616. // this.$navTo('pages/user/bind/index')
  617. this.$navTo('pages/user/certificate/index')
  618. },
  619. // 跳转到修改个人信息页
  620. handlePersonal() {
  621. this.$navTo('pages/user/personal/index')
  622. },
  623. // 退出登录
  624. handleLogout() {
  625. const app = this
  626. uni.showModal({
  627. title: '友情提示',
  628. content: '您确定要退出登录吗?',
  629. success(res) {
  630. if (res.confirm) {
  631. store.dispatch('Logout', {}).then((result) => app.onRefreshPage())
  632. }
  633. }
  634. })
  635. },
  636. // 跳转到钱包页面
  637. onTargetWallet() {
  638. this.$toast('开发中,敬请期待')
  639. return
  640. this.$navTo('pages/wallet/index')
  641. },
  642. // 跳转到订单页
  643. onTargetOrder(item) {
  644. this.$navTo('pages/order/index', {
  645. dataType: item.id
  646. })
  647. },
  648. // 跳转到我的积分页面
  649. onTargetPoints() {
  650. this.$toast('开发中,敬请期待')
  651. return
  652. this.$navTo('pages/points/log')
  653. },
  654. // 跳转到我的优惠券页
  655. onTargetMyCoupon() {
  656. this.$toast('开发中,敬请期待')
  657. return
  658. this.$navTo('pages/my-coupon/index')
  659. },
  660. // 跳转到服务页面
  661. handleService(url) {
  662. console.log('跳转路由:', url)
  663. this.$navTo(url)
  664. }
  665. },
  666. /**
  667. * 下拉刷新
  668. */
  669. onPullDownRefresh() {
  670. // 获取首页数据
  671. this.getPageData(() => {
  672. uni.stopPullDownRefresh()
  673. })
  674. }
  675. }
  676. </script>
  677. <style lang="scss" scoped>
  678. .user-logos {
  679. display: block;
  680. width: 100rpx;
  681. height: 100rpx;
  682. border-radius: 100%;
  683. border: 2px solid #c59a46;
  684. overflow: hidden;
  685. }
  686. .user-img {
  687. border: 2px solid #c59a46;
  688. border-radius: 100%;
  689. }
  690. .container {
  691. padding-bottom: 60rpx;
  692. }
  693. .modalCenter {
  694. padding: 30rpx 40rpx;
  695. }
  696. // 页面头部
  697. .main-header {
  698. // background-color: #FBF7EF;
  699. position: relative;
  700. width: 100%;
  701. height: 280rpx;
  702. background-size: 100% 100%;
  703. overflow: hidden;
  704. display: flex;
  705. align-items: center;
  706. padding-left: 30rpx;
  707. border-bottom: 2px solid #c59a46;
  708. .bg-image {
  709. position: absolute;
  710. top: 0;
  711. left: 0;
  712. width: 100%;
  713. height: 100%;
  714. z-index: 0;
  715. }
  716. .user-info {
  717. display: flex;
  718. z-index: 1;
  719. width: 100%;
  720. .user-content {
  721. display: flex;
  722. flex-direction: column;
  723. justify-content: center;
  724. margin-left: 30rpx;
  725. color: #c59a46;
  726. width: 70%;
  727. .nick-name {
  728. font-size: 34rpx;
  729. font-weight: bold;
  730. width: 100%;
  731. width: 600rpx;
  732. overflow: hidden; //超出的文本隐藏
  733. text-overflow: ellipsis; //溢出用省略号显示
  734. white-space: nowrap; //溢出不换行
  735. margin-right: 20rpx;
  736. }
  737. .mobile {
  738. margin-top: 15rpx;
  739. font-size: 28rpx;
  740. }
  741. .user-grade {
  742. align-self: baseline;
  743. display: flex;
  744. align-items: center;
  745. background: #3c3c3c;
  746. margin-top: 12rpx;
  747. border-radius: 10rpx;
  748. padding: 4rpx 12rpx;
  749. .user-grade_icon .image {
  750. display: block;
  751. width: 32rpx;
  752. height: 32rpx;
  753. }
  754. .user-grade_name {
  755. margin-left: 5rpx;
  756. font-size: 26rpx;
  757. color: #eee0c3;
  758. }
  759. }
  760. .login-tips {
  761. margin-top: 12rpx;
  762. font-size: 30rpx;
  763. }
  764. }
  765. }
  766. }
  767. // 角标组件
  768. .item-badge {
  769. position: absolute;
  770. top: 0;
  771. right: 55rpx;
  772. // background: $main-bg;
  773. background: #fa2209;
  774. color: #fff;
  775. border-radius: 100%;
  776. min-width: 38rpx;
  777. height: 38rpx;
  778. display: flex;
  779. justify-content: center;
  780. align-items: center;
  781. padding: 1rpx;
  782. font-size: 24rpx;
  783. }
  784. // 我的钱包
  785. .my-asset {
  786. display: flex;
  787. background: #fff;
  788. padding: 40rpx 0;
  789. .asset-right {
  790. width: 200rpx;
  791. border-left: 1rpx solid #eee;
  792. }
  793. .asset-right-item {
  794. text-align: center;
  795. color: #545454;
  796. .item-icon {
  797. font-size: 44rpx;
  798. }
  799. .item-name {
  800. margin-top: 14rpx;
  801. font-size: 28rpx;
  802. }
  803. }
  804. .asset-left-item {
  805. max-width: 183rpx;
  806. text-align: center;
  807. color: #666;
  808. padding: 0 16rpx;
  809. .item-value {
  810. font-size: 34rpx;
  811. color: $main-bg;
  812. }
  813. .item-name {
  814. margin-top: 14rpx;
  815. font-size: 28rpx;
  816. }
  817. }
  818. }
  819. // 订单操作
  820. .order-navbar {
  821. margin: 20rpx auto 0rpx auto;
  822. width: 94%;
  823. font-size: 30rpx;
  824. border-radius: 5rpx;
  825. &-item {
  826. align-items: center;
  827. position: relative;
  828. box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
  829. background: #fff;
  830. margin: 20rpx 0rpx;
  831. width: 100%;
  832. padding: 20rpx 40rpx;
  833. line-height: 40rpx;
  834. width: 100%;
  835. background: url('/static/background/NyU04x.png'), no-repeat, #f5bb27;
  836. background-size: 100%;
  837. background-position: left;
  838. position: relative;
  839. border-radius: 20rpx;
  840. z-index: 2;
  841. .item-icon {
  842. padding: 10rpx 0;
  843. color: #fff;
  844. font-size: 54rpx;
  845. margin-right: 20rpx;
  846. }
  847. .item-name {
  848. font-size: 32rpx;
  849. color: #fff;
  850. text-align: center;
  851. margin-right: 10rpx;
  852. }
  853. .filter-one {
  854. position: absolute;
  855. right: 20rpx;
  856. top: 20rpx;
  857. }
  858. }
  859. }
  860. // 订购用户列表
  861. .order-user-buy {
  862. margin: 20rpx auto 0rpx auto;
  863. padding: 20rpx 16rpx;
  864. width: 94%;
  865. font-size: 30rpx;
  866. border-radius: 20rpx;
  867. border: 4rpx solid #f5bb27;
  868. background: #f1b92b17;
  869. color: #e2a225;
  870. .oub_text01 {
  871. font-size: 40rpx;
  872. margin-bottom: 10rpx;
  873. }
  874. .buttom_view {
  875. text-decoration: underline;
  876. display: flex;
  877. flex-direction: row-reverse;
  878. }
  879. }
  880. .smTitle {
  881. font-weight: 400;
  882. font-size: 26rpx;
  883. border-radius: 40rpx;
  884. line-height: 40rpx;
  885. height: 40rpx;
  886. padding: 6rpx 12rpx;
  887. background: #efe7d7;
  888. margin-left: 20rpx;
  889. margin-top: 6rpx;
  890. color: #8dc63f;
  891. }
  892. .nick-name {
  893. align-items: center;
  894. }
  895. // 我的服务
  896. .my-service {
  897. margin: 22rpx auto 22rpx auto;
  898. padding: 22rpx 0;
  899. width: 94%;
  900. box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
  901. border-radius: 5rpx;
  902. background: #fff;
  903. .service-title {
  904. padding-left: 24rpx;
  905. margin-bottom: 20rpx;
  906. font-size: 30rpx;
  907. }
  908. .service-content {
  909. margin-bottom: -20rpx;
  910. .service-item {
  911. position: relative;
  912. width: 25%;
  913. float: left;
  914. margin-bottom: 30rpx;
  915. .item-icon {
  916. text-align: center;
  917. margin: 0 auto;
  918. padding: 14rpx 0;
  919. color: $main-bg;
  920. font-size: 44rpx;
  921. }
  922. .item-name {
  923. font-size: 28rpx;
  924. color: #545454;
  925. text-align: center;
  926. }
  927. }
  928. }
  929. }
  930. // 退出登录
  931. .my-logout {
  932. display: flex;
  933. justify-content: center;
  934. margin-top: 50rpx;
  935. .logout-btn {
  936. width: 60%;
  937. margin: 0 auto;
  938. font-size: 28rpx;
  939. color: #616161;
  940. border-radius: 20rpx;
  941. border: 1px solid #dcdcdc;
  942. padding: 16rpx 0;
  943. text-align: center;
  944. }
  945. }
  946. // 绑定手机号 样式1
  947. .my-mobile {
  948. display: flex;
  949. justify-content: space-between;
  950. align-items: center;
  951. padding: 16rpx 40rpx;
  952. background: #fcebd1;
  953. .info {
  954. color: #cd8c0c;
  955. font-size: 28rpx;
  956. }
  957. .btn-bind {
  958. padding: 8rpx 24rpx;
  959. background-color: #eab766;
  960. color: #fff;
  961. border-radius: 30rpx;
  962. font-size: 26rpx;
  963. text-align: center;
  964. }
  965. }
  966. // 绑定手机号 样式2
  967. .my-mobile2 {
  968. display: flex;
  969. justify-content: space-between;
  970. align-items: center;
  971. margin: 20rpx auto 20rpx auto;
  972. padding: 12rpx 40rpx;
  973. width: 94%;
  974. box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
  975. font-size: 30rpx;
  976. border-radius: 5rpx;
  977. color: red;
  978. background: #ffe7e7;
  979. border: 1px solid red;
  980. .info {
  981. // color: #cd8c0c;
  982. font-size: 26rpx;
  983. }
  984. .btn-bind {
  985. padding: 8rpx 24rpx;
  986. background-color: #fa3534;
  987. color: #fff;
  988. border-radius: 30rpx;
  989. font-size: 26rpx;
  990. text-align: center;
  991. }
  992. }
  993. </style>