index.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  1. <template>
  2. <view class="new-users copy-data" :style="{ height: pageHeight }">
  3. <view class="top" :style="colorStyle">
  4. <!-- #ifdef MP || APP-PLUS -->
  5. <view class="sys-head">
  6. <view class="sys-bar" :style="{ height: sysHeight }"></view>
  7. <!-- #ifdef MP -->
  8. <view class="sys-title" :style="member_style == 3 ? 'color:#333' : ''">{{ $t('个人中心') }}</view>
  9. <!-- #endif -->
  10. <view class="bg" :style="member_style == 3 ? 'background:#f5f5f5' : ''"></view>
  11. </view>
  12. <!-- #endif -->
  13. </view>
  14. <view class="mid" style="flex: 1; overflow: hidden" :style="colorStyle">
  15. <scroll-view scroll-y="true" style="height: 100%">
  16. <view class="head">
  17. <view class="user-card" :class="member_style == 3 ? 'unBg' : ''">
  18. <view class="bg"></view>
  19. <view class="user-info">
  20. <view>
  21. <!-- 注释这个是加的bnt -->
  22. <!-- #ifdef H5 -->
  23. <!-- <button class="bntImg" v-if="userInfo.is_complete == 0 && isWeixin"
  24. @click="getWechatuserinfo">
  25. <image class="avatar" src='/static/images/f.png'></image>
  26. <view class="avatarName">{{$t('获取头像')}}</view>
  27. </button> -->
  28. <!-- #endif -->
  29. <!-- #ifndef APP-PLUS -->
  30. <view class="avatar-box" :class="{ on: userInfo.is_money_level }">
  31. <image class="avatar" :src="userInfo.avatar" v-if="userInfo.avatar" @click="goEdit()"></image>
  32. <image v-else class="avatar" src="/static/images/f.png" mode="" @click="goEdit()"></image>
  33. <view class="headwear" v-if="userInfo.is_money_level && userInfo.svip_open">
  34. <image src="/static/images/headwear.png"></image>
  35. </view>
  36. </view>
  37. <!-- #endif -->
  38. <!-- #ifdef APP-PLUS -->
  39. <view class="avatar-box" :class="{ on: userInfo.is_money_level }">
  40. <image class="avatar" :src="userInfo.avatar" v-if="userInfo.avatar" @click="goEdit()"></image>
  41. <image v-else class="avatar" src="/static/images/f.png" mode="" @click="goEdit()"></image>
  42. <view class="headwear" v-if="userInfo.is_money_level && userInfo.svip_open">
  43. <image src="/static/images/headwear.png"></image>
  44. </view>
  45. </view>
  46. <!-- #endif -->
  47. </view>
  48. <view class="info">
  49. <!-- #ifdef MP || APP-PLUS -->
  50. <view class="name" v-if="!userInfo.uid" @click="openAuto" style="height: 100%; display: flex; align-items: center">
  51. {{ $t('请点击授权') }}
  52. </view>
  53. <!-- #endif -->
  54. <!-- #ifdef H5 -->
  55. <view class="name" v-if="!userInfo.uid" @click="openAuto" style="height: 100%; display: flex; align-items: center">
  56. {{ $t(isWeixin ? '请点击授权' : '请点击登录') }}
  57. </view>
  58. <!-- #endif -->
  59. <view class="name" v-if="userInfo.uid">
  60. <text class="line1 nickname">{{ userInfo.nickname }}</text>
  61. <image class="live" :src="userInfo.vip_icon" v-if="userInfo.vip_icon"></image>
  62. <view class="vip" v-if="userInfo.is_money_level > 0 && userInfo.svip_open">
  63. <image src="/static/images/svip.png"></image>
  64. </view>
  65. </view>
  66. <view class="num" v-if="userInfo.phone" @click="goEdit()">
  67. <view class="num-txt">{{ userInfo.phone }}</view>
  68. </view>
  69. <!-- #ifdef MP -->
  70. <button class="phone" v-if="!userInfo.phone && isLogin" open-type="getPhoneNumber" @getphonenumber="getphonenumber">{{ $t(`绑定手机号`) }}</button>
  71. <!-- #endif -->
  72. <!-- #ifndef MP -->
  73. <view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone">
  74. {{ $t('绑定手机号') }}
  75. </view>
  76. <!-- #endif -->
  77. </view>
  78. <view class="message">
  79. <navigator v-if="isLogin" url="/pages/users/user_info/index" hover-class="none">
  80. <view class="iconfont icon-shezhi"></view>
  81. </navigator>
  82. </view>
  83. <view class="message">
  84. <navigator v-if="isLogin" url="/pages/users/message_center/index" hover-class="none">
  85. <view v-if="userInfo.service_num" class="num">
  86. {{ userInfo.service_num >= 100 ? '99+' : userInfo.service_num }}
  87. </view>
  88. <view class="iconfont icon-s-kefu"></view>
  89. </navigator>
  90. </view>
  91. <!-- #ifdef MP -->
  92. <!-- <view class="setting" @click="Setting"><text class="iconfont icon-shezhi"></text></view> -->
  93. <!-- #endif -->
  94. </view>
  95. <view class="num-wrapper">
  96. <view class="num-item" v-if="userInfo.balance_func_status" @click="goMenuPage('/pages/users/user_money/index')">
  97. <text class="num">{{ userInfo.now_money || 0 }}</text>
  98. <view class="txt">{{ $t('余额') }}</view>
  99. </view>
  100. <view class="num-item" @click="goMenuPage('/pages/users/user_integral/guquan')">
  101. <text class="num">{{ userInfo.share || 0 }}</text>
  102. <view class="txt">{{ $t('股权') }}</view>
  103. </view>
  104. <!-- <view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
  105. <text class="num">{{ userInfo.couponCount || 0 }}</text>
  106. <view class="txt">{{ $t('优惠券') }}</view>
  107. </view> -->
  108. <view class="num-item" @click="goMenuPage('/pages/users/user_integral/index')">
  109. <text class="num">{{ userInfo.integral || 0 }}</text>
  110. <view class="txt">{{ $t('积分') }}</view>
  111. </view>
  112. </view>
  113. <!-- <view class="sign" @click="goSignIn">签到</view> -->
  114. <view class="cardVipA acea-row row-between-wrapper" v-if="userInfo.svip_open && member_style == 1">
  115. <view class="left-box">
  116. <view v-if="userInfo.vip_status == 1" class="small">{{ $t('永久') }}</view>
  117. <view v-else-if="userInfo.vip_status == 3" class="small">
  118. {{ $t('会员到期') }}
  119. {{ userInfo.overdue_time | dateFormat }}
  120. </view>
  121. <view v-else-if="userInfo.vip_status == -1" class="small">{{ $t('已过期') }}</view>
  122. <view v-else-if="userInfo.vip_status == 2" class="small">{{ $t('未开通会员') }}</view>
  123. </view>
  124. <view class="acea-row row-middle">
  125. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index" hover-class="none" class="btn">{{ $t('查看会员权益') }}</navigator>
  126. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  127. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  128. </navigator>
  129. <text class="iconfont icon-jiantou"></text>
  130. </view>
  131. </view>
  132. <view class="cardVipB acea-row row-between" v-if="userInfo.svip_open && member_style == 3">
  133. <view class="left-box acea-row">
  134. <view class="pictrue">
  135. <image src="../../static/images/member01.png"></image>
  136. </view>
  137. <view v-if="userInfo.vip_status == 1" class="small">{{ $t('永久') }}</view>
  138. <view v-else-if="userInfo.vip_status == 3" class="small">
  139. {{ $t('会员到期') }}
  140. {{ userInfo.overdue_time | dateFormat }}
  141. </view>
  142. <view v-else-if="userInfo.vip_status == -1" class="small">{{ $t('已过期') }}</view>
  143. <view v-else-if="userInfo.vip_status == 2" class="small">{{ $t('未开通会员') }}</view>
  144. </view>
  145. <view class="acea-row">
  146. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index" hover-class="none" class="btn">{{ $t('会员可享多项权益') }}</navigator>
  147. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  148. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  149. </navigator>
  150. <text class="iconfont icon-jiantou btn"></text>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="card-vip" v-if="userInfo.svip_open && member_style == 2">
  155. <view class="left-box">
  156. <view class="big">{{ $t('会员可享多项权益') }}</view>
  157. <view v-if="userInfo.vip_status == 1" class="small">{{ $t('永久') }}</view>
  158. <view v-else-if="userInfo.vip_status == 3" class="small">
  159. {{ $t('会员到期') }}
  160. {{ userInfo.overdue_time | dateFormat }}
  161. </view>
  162. <view v-else-if="userInfo.vip_status == -1" class="small">{{ $t('已过期') }}</view>
  163. <view v-else-if="userInfo.vip_status == 2" class="small">{{ $t('未开通会员') }}</view>
  164. </view>
  165. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  166. {{ $t('查看会员权益') }}
  167. </navigator>
  168. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  169. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  170. </navigator>
  171. </view>
  172. <view class="order-wrapper" :class="userInfo.svip_open ? '' : 'height'">
  173. <view class="order-hd flex">
  174. <view class="left">{{ $t('订单中心') }}</view>
  175. <view class="right flex" @click="goMenuPage('/pages/goods/order_list/index')" >
  176. {{ $t('查看全部') }}
  177. <text class="iconfont icon-jiantou"></text>
  178. </view>
  179. </view>
  180. <view class="order-bd">
  181. <block v-for="(item, index) in orderMenu" :key="index">
  182. <view class="order-item" @click="goMenuPage(item.url)">
  183. <view class="pic">
  184. <!-- <image :src="item.img" mode=""></image> -->
  185. <text class="iconfont" :class="item.img"></text>
  186. <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
  187. </view>
  188. <view class="txt">{{ $t(item.title) }}</view>
  189. </view>
  190. </block>
  191. </view>
  192. </view>
  193. </view>
  194. <!-- 轮播 -->
  195. <view class="slider-wrapper" v-if="imgUrls.length > 0 && my_banner_status">
  196. <swiper
  197. indicator-dots="true"
  198. :autoplay="autoplay"
  199. :circular="circular"
  200. :interval="interval"
  201. :duration="duration"
  202. indicator-color="rgba(255,255,255,0.6)"
  203. indicator-active-color="#fff"
  204. >
  205. <block v-for="(item, index) in imgUrls" :key="index">
  206. <swiper-item>
  207. <view @click="goPages(item.url)" class="slide-navigator acea-row row-between-wrapper" hover-class="none">
  208. <image :src="item.pic" class="slide-image"></image>
  209. </view>
  210. </swiper-item>
  211. </block>
  212. </swiper>
  213. </view>
  214. <!-- 会员菜单 -->
  215. <view class="user-menus" style="margin-top: 20rpx" v-if="my_menus_status">
  216. <view class="menu-title" v-if="my_menus_status == 1">{{ $t('我的服务') }}</view>
  217. <view :class="{ 'list-box': my_menus_status == 1, 'column-box': my_menus_status == 2 }">
  218. <!-- #ifdef APP-PLUS || H5 -->
  219. <block v-for="(item, index) in MyMenus" :key="index">
  220. <view class="item" v-if="item.url != '#' && item.url != '/pages/service/index'" @click="goMenuPage(item.url, item.name)">
  221. <image :src="item.pic"></image>
  222. <text class="name">{{ $t(item.name) }}</text>
  223. <text class="iconfont icon-jiantou" v-if="my_menus_status == 2"></text>
  224. </view>
  225. </block>
  226. <!-- #endif -->
  227. <!-- #ifdef MP -->
  228. <block v-for="(item, index) in MyMenus" :key="index">
  229. <view
  230. class="item"
  231. v-if="
  232. (item.url != '#' && item.url != '/pages/service/index' && item.url != '/pages/extension/customer_list/chat') ||
  233. (item.url == '/pages/extension/customer_list/chat' && routineContact == 0)
  234. "
  235. @click="goMenuPage(item.url, item.name)"
  236. >
  237. <image :src="item.pic"></image>
  238. <text class="name">{{ $t(item.name) }}</text>
  239. <text class="iconfont icon-jiantou" v-if="my_menus_status == 2"></text>
  240. </view>
  241. </block>
  242. <button class="item" open-type="contact" v-if="routineContact == 1">
  243. <image src="/static/images/contact.png"></image>
  244. <text class="name">{{ $t('联系客服') }}</text>
  245. <text class="iconfont icon-jiantou" v-if="my_menus_status == 2"></text>
  246. </button>
  247. <!-- #endif -->
  248. <!-- #ifdef APP-PLUS -->
  249. <view class="item" hover-class="none" @click="goMenuPage('/pages/users/privacy/index?type=3')">
  250. <image src="/static/images/menu.png"></image>
  251. <text class="name">{{ $t('隐私协议') }}</text>
  252. <text class="iconfont icon-jiantou" v-if="my_menus_status == 2"></text>
  253. </view>
  254. <!-- #endif -->
  255. </view>
  256. </view>
  257. <view class="user-menus" style="margin-top: 20rpx" v-if="business_status && storeMenu.length">
  258. <view class="menu-title" v-if="business_status == 1">{{ $t('商家管理') }}</view>
  259. <view :class="{ 'list-box': business_status == 1, 'column-box': business_status == 2 }">
  260. <block v-for="(item, index) in storeMenu" :key="index">
  261. <view class="item" :url="item.url" hover-class="none" v-if="item.url != '#' && item.url != '/pages/service/index'" @click="goMenuPage(item.url, item.name)">
  262. <image :src="item.pic"></image>
  263. <text class="name">{{ $t(item.name) }}</text>
  264. <text class="iconfont icon-jiantou" v-if="business_status == 2"></text>
  265. </view>
  266. </block>
  267. </view>
  268. </view>
  269. <!-- <image :src="copyRightPic" alt="" class="support"></image> -->
  270. <view class="uni-p-b-98"></view>
  271. </scroll-view>
  272. <editUserModal :isShow="editModal" @closeEdit="closeEdit" @editSuccess="editSuccess"></editUserModal>
  273. </view>
  274. <pageFooter :style="colorStyle"></pageFooter>
  275. </view>
  276. </template>
  277. <script>
  278. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  279. import { getMenuList, getUserInfo, setVisit, mpBindingPhone } from '@/api/user.js';
  280. import { wechatAuthV2, silenceAuth } from '@/api/public.js';
  281. import { toLogin } from '@/libs/login.js';
  282. import { mapState, mapGetters } from 'vuex';
  283. // #ifdef H5
  284. import Auth from '@/libs/wechat';
  285. // #endif
  286. const app = getApp();
  287. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  288. import Routine from '@/libs/routine';
  289. import colors from '@/mixins/color';
  290. import pageFooter from '@/components/pageFooter/index.vue';
  291. import { getCustomer } from '@/utils/index.js';
  292. import editUserModal from '@/components/eidtUserModal/index.vue';
  293. export default {
  294. components: {
  295. pageFooter,
  296. editUserModal
  297. },
  298. // computed: mapGetters(['isLogin','cartNum']),
  299. computed: {
  300. ...mapGetters({
  301. cartNum: 'cartNum',
  302. isLogin: 'isLogin'
  303. })
  304. },
  305. filters: {
  306. coundTime(val) {
  307. var setTime = val * 1000;
  308. var nowTime = new Date();
  309. var rest = setTime - nowTime.getTime();
  310. var day = parseInt(rest / (60 * 60 * 24 * 1000));
  311. // var hour = parseInt(rest/(60*60*1000)%24) //小时
  312. return day + this.$t('day');
  313. },
  314. dateFormat: function (value) {
  315. return dayjs(value * 1000).format('YYYY-MM-DD');
  316. }
  317. },
  318. mixins: [colors],
  319. data() {
  320. return {
  321. editModal: false, // 编辑头像信息
  322. storeMenu: [], // 商家管理
  323. orderMenu: [
  324. {
  325. img: 'icon-daifukuan',
  326. title: '待付款',
  327. url: '/pages/goods/order_list/index?status=0'
  328. },
  329. {
  330. img: 'icon-daifahuo',
  331. title: '待发货',
  332. url: '/pages/goods/order_list/index?status=1'
  333. },
  334. {
  335. img: 'icon-daishouhuo',
  336. title: '待收货',
  337. url: '/pages/goods/order_list/index?status=2'
  338. },
  339. {
  340. img: 'icon-daipingjia',
  341. title: '待评价',
  342. url: '/pages/goods/order_list/index?status=3'
  343. },
  344. {
  345. img: 'icon-a-shouhoutuikuan',
  346. title: '售后/退款',
  347. url: '/pages/users/user_return_list/index'
  348. }
  349. ],
  350. imgUrls: [],
  351. autoplay: true,
  352. circular: true,
  353. interval: 3000,
  354. duration: 500,
  355. isAuto: false, //没有授权的不会自动授权
  356. isShowAuth: false, //是否隐藏授权
  357. orderStatusNum: {},
  358. userInfo: {},
  359. MyMenus: [],
  360. sysHeight: sysHeight,
  361. mpHeight: 0,
  362. showStatus: 1,
  363. activeRouter: '',
  364. // #ifdef H5 || MP
  365. pageHeight: '100%',
  366. routineContact: 0,
  367. // #endif
  368. // #ifdef APP-PLUS
  369. pageHeight: app.globalData.windowHeight,
  370. // #endif
  371. // #ifdef H5
  372. isWeixin: Auth.isWeixin(),
  373. //#endif
  374. footerSee: false,
  375. my_menus_status: 0,
  376. business_status: 0,
  377. member_style: 0,
  378. my_banner_status: 0,
  379. is_diy: uni.getStorageSync('is_diy'),
  380. copyRightPic: '/static/images/support.png' //版权图片
  381. };
  382. },
  383. onLoad(option) {
  384. uni.hideTabBar();
  385. let that = this;
  386. // #ifdef MP
  387. // 小程序静默授权
  388. if (!this.$store.getters.isLogin) {
  389. // Routine.getCode()
  390. // .then(code => {
  391. // Routine.silenceAuth(code).then(res => {
  392. // this.onLoadFun();
  393. // })
  394. // })
  395. // .catch(res => {
  396. // uni.hideLoading();
  397. // });
  398. }
  399. // #endif
  400. // #ifdef H5 || APP-PLUS
  401. // if (that.isLogin == false) {
  402. // toLogin();
  403. // }
  404. //获取用户信息回来后授权
  405. let cacheCode = this.$Cache.get('snsapi_userinfo_code');
  406. let res1 = cacheCode ? option.code != cacheCode : true;
  407. if (this.isWeixin && option.code && res1 && option.scope === 'snsapi_userinfo') {
  408. this.$Cache.set('snsapi_userinfo_code', option.code);
  409. Auth.auth(option.code)
  410. .then((res) => {
  411. this.getUserInfo();
  412. })
  413. .catch((err) => {});
  414. }
  415. // #endif
  416. // #ifdef APP-PLUS
  417. that.$set(that, 'pageHeight', app.globalData.windowHeight);
  418. // #endif
  419. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  420. let curRoute = routes[routes.length - 1].route; //获取当前页面路由
  421. this.activeRouter = '/' + curRoute;
  422. this.getCopyRight();
  423. },
  424. onReady() {
  425. let self = this;
  426. // #ifdef MP
  427. let info = uni.createSelectorQuery().select('.sys-head');
  428. info
  429. .boundingClientRect(function (data) {
  430. //data - 各种参数
  431. self.mpHeight = data.height;
  432. })
  433. .exec();
  434. // #endif
  435. },
  436. onShow: function () {
  437. let that = this;
  438. // #ifdef APP-PLUS
  439. uni.getSystemInfo({
  440. success: function (res) {
  441. that.pageHeight = res.windowHeight + 'px';
  442. }
  443. });
  444. // #endif
  445. if (that.isLogin) {
  446. this.getUserInfo();
  447. this.setVisit();
  448. }
  449. this.getMyMenus();
  450. this.getCopyRight();
  451. },
  452. onPullDownRefresh() {
  453. this.onLoadFun();
  454. },
  455. methods: {
  456. getWechatuserinfo() {
  457. //#ifdef H5
  458. Auth.isWeixin() && Auth.toAuth('snsapi_userinfo', '/pages/user/index');
  459. //#endif
  460. },
  461. editSuccess() {
  462. this.editModal = false;
  463. this.getUserInfo();
  464. },
  465. closeEdit() {
  466. this.editModal = false;
  467. },
  468. // 记录会员访问
  469. setVisit() {
  470. setVisit({
  471. url: '/pages/user/index'
  472. }).then((res) => {});
  473. },
  474. // 打开授权
  475. openAuto() {
  476. toLogin();
  477. },
  478. // 授权回调
  479. onLoadFun() {
  480. this.getUserInfo();
  481. this.getMyMenus();
  482. this.setVisit();
  483. },
  484. Setting: function () {
  485. uni.openSetting({
  486. success: function (res) {}
  487. });
  488. },
  489. // 授权关闭
  490. authColse: function (e) {
  491. this.isShowAuth = e;
  492. },
  493. // 绑定手机
  494. bindPhone() {
  495. uni.navigateTo({
  496. url: '/pages/users/user_phone/index'
  497. });
  498. },
  499. getphonenumber(e) {
  500. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  501. Routine.getCode()
  502. .then((code) => {
  503. let data = {
  504. code,
  505. iv: e.detail.iv,
  506. encryptedData: e.detail.encryptedData
  507. };
  508. mpBindingPhone(data)
  509. .then((res) => {
  510. this.getUserInfo();
  511. this.$util.Tips({
  512. title: res.msg,
  513. icon: 'success'
  514. });
  515. })
  516. .catch((err) => {
  517. return this.$util.Tips({
  518. title: err
  519. });
  520. });
  521. })
  522. .catch((error) => {
  523. uni.hideLoading();
  524. });
  525. }
  526. },
  527. /**
  528. * 获取个人用户信息
  529. */
  530. getUserInfo: function () {
  531. let that = this;
  532. getUserInfo().then((res) => {
  533. that.userInfo = res.data;
  534. that.$store.commit('SETUID', res.data.uid);
  535. that.orderMenu.forEach((item, index) => {
  536. switch (item.title) {
  537. case '待付款':
  538. item.num = res.data.orderStatusNum.unpaid_count;
  539. break;
  540. case '待发货':
  541. item.num = res.data.orderStatusNum.unshipped_count;
  542. break;
  543. case '待收货':
  544. item.num = res.data.orderStatusNum.received_count;
  545. break;
  546. case '待评价':
  547. item.num = res.data.orderStatusNum.evaluated_count;
  548. break;
  549. case '售后/退款':
  550. item.num = res.data.orderStatusNum.refunding_count;
  551. break;
  552. }
  553. });
  554. uni.stopPullDownRefresh();
  555. });
  556. },
  557. //小程序授权api替换 getUserInfo
  558. getUserProfile() {
  559. toLogin();
  560. },
  561. /**
  562. *
  563. * 获取个人中心图标
  564. */
  565. switchTab(order) {
  566. this.orderMenu.forEach((item, index) => {
  567. switch (item.title) {
  568. case '待付款':
  569. item.img = order.dfk;
  570. break;
  571. case '待发货':
  572. item.img = order.dfh;
  573. break;
  574. case '待收货':
  575. item.img = order.dsh;
  576. break;
  577. case '待评价':
  578. item.img = order.dpj;
  579. break;
  580. case '售后/退款':
  581. item.img = order.sh;
  582. break;
  583. }
  584. });
  585. },
  586. getMyMenus: function () {
  587. let that = this;
  588. // if (this.MyMenus.length) return;
  589. getMenuList().then((res) => {
  590. this.member_style = Number(res.data.diy_data.value);
  591. this.my_banner_status = res.data.diy_data.my_banner_status;
  592. this.my_menus_status = res.data.diy_data.my_menus_status;
  593. this.business_status = res.data.diy_data.business_status;
  594. let storeMenu = [];
  595. let myMenu = [];
  596. res.data.routine_my_menus.forEach((el, index, arr) => {
  597. if (el.url == '/pages/admin/order/index' || el.url == '/pages/admin/order_cancellation/index' || el.name == '客服接待') {
  598. storeMenu.push(el);
  599. } else {
  600. myMenu.push(el);
  601. }
  602. });
  603. let order01 = {
  604. dfk: 'icon-daifukuan',
  605. dfh: 'icon-daifahuo',
  606. dsh: 'icon-daishouhuo',
  607. dpj: 'icon-daipingjia',
  608. sh: 'icon-a-shouhoutuikuan'
  609. };
  610. let order02 = {
  611. dfk: 'icon-daifukuan-lan',
  612. dfh: 'icon-daifahuo-lan',
  613. dsh: 'icon-daishouhuo-lan',
  614. dpj: 'icon-daipingjia-lan',
  615. sh: 'icon-shouhou-tuikuan-lan'
  616. };
  617. let order03 = {
  618. dfk: 'icon-daifukuan-ju',
  619. dfh: 'icon-daifahuo-ju',
  620. dsh: 'icon-daishouhuo-ju',
  621. dpj: 'icon-daipingjia-ju',
  622. sh: 'icon-shouhou-tuikuan-ju'
  623. };
  624. let order04 = {
  625. dfk: 'icon-daifukuan-fen',
  626. dfh: 'icon-daifahuo-fen',
  627. dsh: 'icon-daishouhuo-fen',
  628. dpj: 'icon-daipingjia-fen',
  629. sh: 'icon-a-shouhoutuikuan-fen'
  630. };
  631. let order05 = {
  632. dfk: 'icon-daifukuan-lv',
  633. dfh: 'icon-daifahuo-lv',
  634. dsh: 'icon-daishouhuo-lv',
  635. dpj: 'icon-daipingjia-lv',
  636. sh: 'icon-shouhou-tuikuan-lv'
  637. };
  638. switch (res.data.diy_data.order_status) {
  639. case 1:
  640. this.switchTab(order01);
  641. break;
  642. case 2:
  643. this.switchTab(order02);
  644. break;
  645. case 3:
  646. this.switchTab(order03);
  647. break;
  648. case 4:
  649. this.switchTab(order04);
  650. break;
  651. case 5:
  652. this.switchTab(order05);
  653. break;
  654. }
  655. that.$set(that, 'MyMenus', myMenu);
  656. that.$set(that, 'storeMenu', storeMenu);
  657. this.imgUrls = res.data.routine_my_banner;
  658. this.routineContact = Number(res.data.routine_contact_type);
  659. });
  660. },
  661. // 编辑页面
  662. goEdit() {
  663. if (this.isLogin == false) {
  664. toLogin();
  665. } else {
  666. // #ifdef MP
  667. if (this.userInfo.is_default_avatar) {
  668. this.editModal = true;
  669. return;
  670. }
  671. // #endif
  672. uni.navigateTo({
  673. url: '/pages/users/user_info/index'
  674. });
  675. }
  676. },
  677. // 签到
  678. goSignIn() {
  679. uni.navigateTo({
  680. url: '/pages/users/user_sgin/index'
  681. });
  682. },
  683. goPages(url) {
  684. this.$util.JumpPath(url);
  685. },
  686. // goMenuPage
  687. goMenuPage(url, name) {
  688. if (this.isLogin) {
  689. if (url.indexOf('http') === -1) {
  690. // #ifdef H5 || APP-PLUS
  691. if (name && name === '客服接待') {
  692. // return window.location.href = `${location.origin}${url}`
  693. return uni.navigateTo({
  694. url: `/pages/annex/web_view/index?url=${location.origin}${url}`
  695. });
  696. } else if (name && name === '联系客服') {
  697. return getCustomer(url);
  698. } else if (name === '订单核销') {
  699. return uni.navigateTo({
  700. url: url
  701. });
  702. // return window.location.href = `${location.origin}${url}`
  703. }
  704. // #endif
  705. // #ifdef MP
  706. if (name && name === '联系客服') {
  707. return getCustomer(url);
  708. }
  709. if (url != '#' && url == '/pages/users/user_info/index') {
  710. uni.openSetting({
  711. success: function (res) {}
  712. });
  713. }
  714. // #endif
  715. uni.navigateTo({
  716. url: url,
  717. fail(err) {
  718. uni.switchTab({
  719. url: url
  720. });
  721. }
  722. });
  723. } else {
  724. uni.navigateTo({
  725. url: `/pages/annex/web_view/index?url=${url}`
  726. });
  727. }
  728. } else {
  729. // #ifdef MP
  730. this.openAuto();
  731. // #endif
  732. // #ifndef MP
  733. toLogin();
  734. // #endif
  735. }
  736. },
  737. goRouter(item) {
  738. var pages = getCurrentPages();
  739. var page = pages[pages.length - 1].$page.fullPath;
  740. if (item.link == page) return;
  741. uni.switchTab({
  742. url: item.link,
  743. fail(err) {
  744. uni.redirectTo({
  745. url: item.link
  746. });
  747. }
  748. });
  749. },
  750. getCopyRight() {
  751. const copyRight = uni.getStorageSync('copyRight');
  752. if (copyRight.copyrightImage) {
  753. this.copyRightPic = copyRight.copyrightImage;
  754. }
  755. }
  756. }
  757. };
  758. </script>
  759. <style lang="scss">
  760. page,
  761. body {
  762. height: 100%;
  763. }
  764. .height {
  765. margin-top: -100rpx !important;
  766. }
  767. .unBg {
  768. background-color: unset !important;
  769. .user-info {
  770. .info {
  771. .name {
  772. color: #333333 !important;
  773. font-weight: 600;
  774. }
  775. .num {
  776. color: #333 !important;
  777. .num-txt {
  778. height: 38rpx;
  779. background-color: rgba(51, 51, 51, 0.13);
  780. padding: 0 12rpx;
  781. border-radius: 16rpx;
  782. }
  783. }
  784. }
  785. }
  786. .num-wrapper {
  787. color: #333 !important;
  788. font-weight: 600;
  789. .num-item {
  790. .txt {
  791. color: rgba(51, 51, 51, 0.7) !important;
  792. }
  793. }
  794. }
  795. .message {
  796. .iconfont {
  797. color: #333 !important;
  798. }
  799. .num {
  800. color: #fff !important;
  801. background-color: var(--view-theme) !important;
  802. }
  803. }
  804. .setting {
  805. .iconfont {
  806. color: #333 !important;
  807. }
  808. }
  809. }
  810. .cardVipB {
  811. background-color: #343a48;
  812. width: 100%;
  813. height: 124rpx;
  814. border-radius: 16rpx 16rpx 0 0;
  815. padding: 22rpx 30rpx 0 30rpx;
  816. margin-top: 16px;
  817. .left-box {
  818. .small {
  819. color: #f8d5a8;
  820. font-size: 28rpx;
  821. margin-left: 18rpx;
  822. }
  823. .pictrue {
  824. width: 40rpx;
  825. height: 45rpx;
  826. image {
  827. width: 100%;
  828. height: 100%;
  829. }
  830. }
  831. }
  832. .btn {
  833. color: #bbbbbb;
  834. font-size: 26rpx;
  835. }
  836. .icon-jiantou {
  837. margin-top: 6rpx;
  838. }
  839. }
  840. .cardVipA {
  841. position: absolute;
  842. background: url('~@/static/images/member.png') no-repeat;
  843. background-size: 100% 100%;
  844. width: 750rpx;
  845. height: 84rpx;
  846. bottom: -2rpx;
  847. left: 0;
  848. padding: 0 56rpx 0 135rpx;
  849. .left-box {
  850. font-size: 26rpx;
  851. color: #905100;
  852. font-weight: 400;
  853. }
  854. .btn {
  855. color: #905100;
  856. font-weight: 400;
  857. font-size: 24rpx;
  858. }
  859. .iconfont {
  860. font-size: 20rpx;
  861. margin: 4rpx 0 0 4rpx;
  862. }
  863. }
  864. .new-users {
  865. display: flex;
  866. flex-direction: column;
  867. height: 100%;
  868. .sys-head {
  869. position: relative;
  870. width: 100%;
  871. // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);
  872. .bg {
  873. position: absolute;
  874. left: 0;
  875. top: 0;
  876. width: 100%;
  877. height: 100%;
  878. background: var(--view-theme);
  879. background-size: 100% auto;
  880. background-position: left bottom;
  881. }
  882. .sys-title {
  883. z-index: 10;
  884. position: relative;
  885. height: 43px;
  886. text-align: center;
  887. line-height: 43px;
  888. font-size: 36rpx;
  889. color: #ffffff;
  890. }
  891. }
  892. .head {
  893. // background: #fff;
  894. .user-card {
  895. position: relative;
  896. width: 100%;
  897. height: 380rpx;
  898. margin: 0 auto;
  899. padding: 35rpx 28rpx;
  900. background-image: url('~@/static/images/user01.png');
  901. background-size: 100% auto;
  902. background-color: var(--view-theme);
  903. .user-info {
  904. z-index: 20;
  905. position: relative;
  906. display: flex;
  907. .headwear {
  908. position: absolute;
  909. right: -4rpx;
  910. top: -14rpx;
  911. width: 44rpx;
  912. height: 44rpx;
  913. image {
  914. width: 100%;
  915. height: 100%;
  916. }
  917. }
  918. .live {
  919. width: 28rpx;
  920. height: 28rpx;
  921. margin-left: 20rpx;
  922. }
  923. .bntImg {
  924. width: 120rpx;
  925. height: 120rpx;
  926. border-radius: 50%;
  927. text-align: center;
  928. line-height: 120rpx;
  929. background-color: unset;
  930. position: relative;
  931. .avatarName {
  932. font-size: 16rpx;
  933. color: #fff;
  934. text-align: center;
  935. background-color: rgba(0, 0, 0, 0.6);
  936. height: 37rpx;
  937. line-height: 37rpx;
  938. position: absolute;
  939. bottom: 0;
  940. left: 0;
  941. width: 100%;
  942. }
  943. }
  944. .avatar-box {
  945. position: relative;
  946. display: flex;
  947. align-items: center;
  948. justify-content: center;
  949. width: 120rpx;
  950. height: 120rpx;
  951. border-radius: 50%;
  952. &.on {
  953. .avatar {
  954. border: 2px solid #ffac65;
  955. border-radius: 50%;
  956. box-sizing: border-box;
  957. }
  958. }
  959. }
  960. .avatar {
  961. position: relative;
  962. width: 120rpx;
  963. height: 120rpx;
  964. border-radius: 50%;
  965. }
  966. .info {
  967. flex: 1;
  968. display: flex;
  969. flex-direction: column;
  970. justify-content: space-between;
  971. margin-left: 20rpx;
  972. padding: 20rpx 0;
  973. .name {
  974. display: flex;
  975. align-items: center;
  976. color: #fff;
  977. font-size: 31rpx;
  978. .nickname {
  979. max-width: 8em;
  980. }
  981. .vip {
  982. margin-left: 10rpx;
  983. image {
  984. width: 78rpx;
  985. height: 30rpx;
  986. display: block;
  987. }
  988. }
  989. }
  990. .num {
  991. display: flex;
  992. align-items: center;
  993. font-size: 26rpx;
  994. color: rgba(255, 255, 255, 0.6);
  995. image {
  996. width: 22rpx;
  997. height: 23rpx;
  998. margin-left: 20rpx;
  999. }
  1000. }
  1001. }
  1002. }
  1003. .message {
  1004. align-self: flex-start;
  1005. position: relative;
  1006. margin-top: 15rpx;
  1007. margin-right: 20rpx;
  1008. .num {
  1009. position: absolute;
  1010. top: -8rpx;
  1011. left: 18rpx;
  1012. padding: 0 6rpx;
  1013. height: 28rpx;
  1014. border-radius: 12rpx;
  1015. background-color: #fff;
  1016. font-size: 18rpx;
  1017. line-height: 28rpx;
  1018. text-align: center;
  1019. color: var(--view-theme);
  1020. }
  1021. .iconfont {
  1022. font-size: 40rpx;
  1023. color: #fff;
  1024. }
  1025. }
  1026. .num-wrapper {
  1027. z-index: 30;
  1028. position: relative;
  1029. display: flex;
  1030. align-items: center;
  1031. justify-content: space-between;
  1032. margin-top: 22rpx;
  1033. // padding: 0 47rpx;
  1034. color: #fff;
  1035. .num-item {
  1036. width: 33.33%;
  1037. text-align: center;
  1038. & ~ .num-item {
  1039. position: relative;
  1040. &:before {
  1041. content: '';
  1042. position: absolute;
  1043. width: 1rpx;
  1044. height: 28rpx;
  1045. top: 50%;
  1046. margin-top: -14rpx;
  1047. background-color: rgba(255, 255, 255, 0.4);
  1048. left: 0;
  1049. }
  1050. }
  1051. .num {
  1052. font-size: 42rpx;
  1053. font-weight: bold;
  1054. }
  1055. .txt {
  1056. margin-top: 8rpx;
  1057. font-size: 26rpx;
  1058. color: rgba(255, 255, 255, 0.6);
  1059. }
  1060. }
  1061. }
  1062. .sign {
  1063. z-index: 200;
  1064. position: absolute;
  1065. right: -12rpx;
  1066. top: 80rpx;
  1067. display: flex;
  1068. align-items: center;
  1069. justify-content: center;
  1070. width: 120rpx;
  1071. height: 60rpx;
  1072. background: linear-gradient(90deg, rgba(255, 225, 87, 1) 0%, rgba(238, 193, 15, 1) 100%);
  1073. border-radius: 29rpx 4rpx 4rpx 29rpx;
  1074. color: #282828;
  1075. font-size: 28rpx;
  1076. font-weight: bold;
  1077. }
  1078. }
  1079. .order-wrapper {
  1080. background: #fff;
  1081. margin: 0 30rpx;
  1082. border-radius: 16rpx;
  1083. position: relative;
  1084. margin-top: -10rpx;
  1085. .order-hd {
  1086. justify-content: space-between;
  1087. padding: 30rpx 20rpx 10rpx 30rpx;
  1088. margin-top: 25rpx;
  1089. font-size: 30rpx;
  1090. color: #282828;
  1091. .left {
  1092. font-weight: bold;
  1093. }
  1094. .right {
  1095. display: flex;
  1096. align-items: center;
  1097. color: #666666;
  1098. font-size: 26rpx;
  1099. .icon-jiantou {
  1100. margin-left: 5rpx;
  1101. font-size: 26rpx;
  1102. }
  1103. }
  1104. }
  1105. .order-bd {
  1106. display: flex;
  1107. padding: 0 0;
  1108. .order-item {
  1109. display: flex;
  1110. flex-direction: column;
  1111. justify-content: center;
  1112. align-items: center;
  1113. width: 20%;
  1114. height: 140rpx;
  1115. .pic {
  1116. position: relative;
  1117. text-align: center;
  1118. .iconfont {
  1119. font-size: 48rpx;
  1120. color: var(--view-theme);
  1121. }
  1122. image {
  1123. width: 58rpx;
  1124. height: 48rpx;
  1125. }
  1126. }
  1127. .txt {
  1128. margin-top: 6rpx;
  1129. font-size: 26rpx;
  1130. color: #333;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. }
  1136. .slider-wrapper {
  1137. margin: 20rpx 30rpx;
  1138. height: 130rpx;
  1139. swiper,
  1140. swiper-item {
  1141. height: 100%;
  1142. }
  1143. image {
  1144. width: 100%;
  1145. height: 130rpx;
  1146. border-radius: 16rpx;
  1147. }
  1148. }
  1149. .user-menus {
  1150. background-color: #fff;
  1151. margin: 0 30rpx;
  1152. border-radius: 16rpx;
  1153. .column-box {
  1154. padding: 30rpx 20rpx 10rpx 30rpx;
  1155. .item {
  1156. display: flex;
  1157. align-items: center;
  1158. margin-bottom: 40rpx;
  1159. font-size: 26rpx;
  1160. .name {
  1161. flex: 1;
  1162. text-align: left;
  1163. }
  1164. image {
  1165. width: 40rpx;
  1166. height: 40rpx;
  1167. margin-right: 20rpx;
  1168. }
  1169. .icon-jiantou {
  1170. font-size: 26rpx;
  1171. color: rgb(96, 98, 102);
  1172. }
  1173. &:last-child::before {
  1174. display: none;
  1175. }
  1176. &:last-child {
  1177. margin-bottom: 20rpx;
  1178. }
  1179. }
  1180. }
  1181. .menu-title {
  1182. padding: 30rpx 30rpx 40rpx;
  1183. font-size: 30rpx;
  1184. color: #282828;
  1185. font-weight: bold;
  1186. }
  1187. .list-box {
  1188. display: flex;
  1189. flex-wrap: wrap;
  1190. .item {
  1191. position: relative;
  1192. display: flex;
  1193. align-items: center;
  1194. justify-content: space-between;
  1195. flex-direction: column;
  1196. width: 25%;
  1197. margin-bottom: 40rpx;
  1198. font-size: 26rpx;
  1199. color: #333333;
  1200. .name {
  1201. flex: 1;
  1202. text-align: left;
  1203. }
  1204. image {
  1205. width: 52rpx;
  1206. height: 52rpx;
  1207. margin-bottom: 18rpx;
  1208. }
  1209. &:last-child::before {
  1210. display: none;
  1211. }
  1212. }
  1213. }
  1214. button {
  1215. font-size: 28rpx;
  1216. }
  1217. }
  1218. .phone {
  1219. color: #fff;
  1220. background-color: #ffffff80;
  1221. border-radius: 15px;
  1222. width: max-content;
  1223. font-size: 24rpx;
  1224. padding: 2px 10px;
  1225. margin-top: 8rpx;
  1226. }
  1227. .order-status-num {
  1228. min-width: 12rpx;
  1229. background-color: #fff;
  1230. color: var(--view-theme);
  1231. border-radius: 15px;
  1232. position: absolute;
  1233. right: -14rpx;
  1234. top: -15rpx;
  1235. font-size: 20rpx;
  1236. padding: 0 8rpx;
  1237. border: 1px solid var(--view-theme);
  1238. }
  1239. .support {
  1240. width: 219rpx;
  1241. height: 74rpx;
  1242. margin: 54rpx auto;
  1243. display: block;
  1244. }
  1245. }
  1246. .card-vip {
  1247. display: flex;
  1248. align-items: center;
  1249. justify-content: space-between;
  1250. position: relative;
  1251. width: 690rpx;
  1252. height: 134rpx;
  1253. margin: -72rpx auto 0;
  1254. background: url('~@/static/images/user_vip.png');
  1255. background-size: cover;
  1256. padding-left: 118rpx;
  1257. padding-right: 34rpx;
  1258. .left-box {
  1259. font-size: 24rpx;
  1260. color: #ae5a2a;
  1261. .big {
  1262. font-size: 28rpx;
  1263. }
  1264. .small {
  1265. opacity: 0.8;
  1266. margin-top: 10rpx;
  1267. }
  1268. }
  1269. .btn {
  1270. height: 52rpx;
  1271. line-height: 52rpx;
  1272. padding: 0 10rpx;
  1273. text-align: center;
  1274. background: #fff;
  1275. border-radius: 28rpx;
  1276. font-size: 26rpx;
  1277. color: #ae5a2a;
  1278. }
  1279. }
  1280. .setting {
  1281. margin-top: 15rpx;
  1282. margin-left: 15rpx;
  1283. color: #fff;
  1284. .iconfont {
  1285. font-size: 40rpx;
  1286. }
  1287. }
  1288. .new-users {
  1289. padding-bottom: 0;
  1290. padding-bottom: constant(safe-area-inset-bottom);
  1291. padding-bottom: env(safe-area-inset-bottom);
  1292. }
  1293. </style>