index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <!-- 会员/商户我的 -->
  2. <template>
  3. <view>
  4. <!-- 已登录成功展示头像昵称钱包等 -->
  5. <view v-if="user_info.id" class="top_bg">
  6. <!-- 头像昵称等 -->
  7. <view class="main_width my_top_box">
  8. <view style="display: flex;align-items: center;">
  9. <!-- 头像 -->
  10. <view @click="to_per_info()" style="width: 124upx;height: 124upx;">
  11. <view style="border-radius: 62upx;width: 124upx;height: 124upx;overflow: hidden;">
  12. <image style="width: 124upx;height: 124upx;"
  13. :src="user_info.profile_photo==''?'../../static/user_w.png': (user_info.profile_photo.indexOf('http://')==0||user_info.profile_photo.indexOf('https://')==0)?user_info.profile_photo:(serverUrl+ user_info.profile_photo)">
  14. </view>
  15. </view>
  16. <!-- 非商家昵称年龄性别 -->
  17. <view v-if="sys_role==0" style="margin-left: 30upx;">
  18. <view style="font-size: 36upx;margin-left: 4upx;">
  19. <view class="start_box" @click="to_per_info()">
  20. {{user_info.nickname?user_info.nickname:'会员昵称'}}
  21. <view v-if="!loading" @click="to_appraisal(0)" style="margin-left: 10upx;">
  22. <trailerStars allowTap="0" :innerScore="user_info.worker_appraisal_avg">
  23. </trailerStars>
  24. </view>
  25. </view>
  26. </view>
  27. <view style="margin-top: 16upx;display: flex;align-items: center;color: #9B9B9B;">
  28. {{user_info.age||'--'}}岁
  29. <image style="width: 34upx;height: 34upx;"
  30. :src="user_info.gender=='男' ? '../../static/male.png': '../../static/female.png'"
  31. v-if="user_info.gender"></image>
  32. {{user_info.edulevel_name}}
  33. </view>
  34. </view>
  35. <!-- 商家昵称-->
  36. <view v-if="sys_role==1" style="margin-left: 30upx;">
  37. <view style="font-size: 36upx;margin-left: 4upx;">
  38. <view style="max-width: 360upx;" class="start_box" @click="to_per_info()">
  39. {{user_info.company_name?user_info.company_name:(user_info.linker_name?user_info.linker_name:'商家名称')}}
  40. </view>
  41. <view v-if="!loading" @click="to_appraisal(0)" style="margin-top: 15upx;">
  42. <trailerStars allowTap="0" :innerScore="trader_appraisal_avg">
  43. </trailerStars>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 实名认证 -->
  49. <view v-if="sys_role==0" @click="to_verify()" style="margin-top: 30upx;font-size: 24upx;"
  50. :class="user_info.idcard?'verify':'verify verify0'">
  51. {{user_info.idcard?'已认证': '未实名认证'}}
  52. </view>
  53. <view v-if="sys_role==1" @click="to_verify()" style="margin-top: 30upx;font-size: 24upx;"
  54. :class="user_info.realname_handled=='1'?'verify':'verify verify0'">
  55. {{!user_info.lawer_idcard?'未认证' :(user_info.certif_confirmed==0?'认证中':user_info.catalog==0?'个人认证':'企业认证')}}
  56. </view>
  57. </view>
  58. <!-- 钱包 -->
  59. <view :style="'background-image: url('+(serverUrlImg+'wallet_bg.png')+');'" class="main_width wallet">
  60. <view class="wallet_top">
  61. <image style="width: 36upx;height: 36upx;margin-right: 15upx;" src="../../static/my/wallet.png">
  62. </image>
  63. 我的钱包
  64. </view>
  65. <view class="wallet_bot">
  66. <view class="balance_box">
  67. <view class="balance_box1">账户余额</view>
  68. <view class="balance_box2"><text>{{(user_info.finance_balance).toFixed(2)}}</text>元</view>
  69. </view>
  70. <view class="balance_box">
  71. <view class="balance_box1">冻结{{sys_role==1?'金额':'押金'}}</view>
  72. <view class="balance_box2"><text>{{(user_info.finance_frozenBalance).toFixed(2)}}</text>元</view>
  73. </view>
  74. </view>
  75. <navigator url="wallet" class="wallet_to_wal">查看详情 ></navigator>
  76. </view>
  77. </view>
  78. <!-- 未登录展示 -->
  79. <view v-else @click="menu_click('quit')" class="no_login">未登录</view>
  80. <!-- 我的4种工单,只非商户显示,已登录成功展示 -->
  81. <view v-if="sys_role==0&&user_info.id" class="nav">
  82. <view @click="href_order(index)" :data-index="index" class="bar_view" :key="index"
  83. v-for="(item, index) in status_arr">
  84. <image style="width: 98upx;height: 98upx;" :src="serverUrlImgOrder+'order'+(index+1)+'.png'"></image>
  85. <view>
  86. {{item.name}}
  87. </view>
  88. <!-- 右上角提示小红点 -->
  89. <view v-if="status_num_arr[index]!=0" class="bar_view_num">{{status_num_arr[index]}}</view>
  90. </view>
  91. </view>
  92. <view style="background-color: #F4F4F4;height: 20upx;"></view>
  93. <!-- 竖向菜单 -->
  94. <view style="margin-bottom: 50upx;margin-top: 16upx;" class="main_width my_bg_box">
  95. <view style="width: 92%;margin-left: 4%;overflow: hidden;">
  96. <view
  97. v-if="(item.need_login&&user_info.id)||!item.need_login||(isTrader2==1&&item.key=='verify'&&biz_trader2id!='')"
  98. @click="menu_click(item.key)" class="menu_item" :key="item.key" v-for="(item, index) in menu">
  99. <view style="display: flex;align-items: center;">
  100. <image style="width: 32upx;height: 32upx;margin-right: 20upx;"
  101. :src="'../../static/my/'+item.icon+'.png'"></image>
  102. <view style="color: #666666;">{{sys_role==0?item.name:item.name_mer||item.name}}</view>
  103. </view>
  104. <view style="color: #666666;">></view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import commonData from '../../commonData.js'
  112. import commonFun from '../../commonFun.js'
  113. import trailerStars from '../../components/starts/index.vue'
  114. export default {
  115. data() {
  116. return {
  117. biz_trader2id: '', //现场经理id
  118. loading: true, //我的个人信息加载中...
  119. status_num_arr: [0, 0, 0, 0, 0, 0], //工单tab右上角红底数字
  120. serverUrlImgOrder: this.serverUrl + 'show/',
  121. isTrader2: 2,
  122. FOREND_TOKEN: '', //是否包括登录信息
  123. user_info: {}, //用户信息
  124. sys_role: commonData.sys_role, //角色
  125. // verify_type: 0, //认证状态,0代表未实名认证,1代表个人认证,1代表企业认证
  126. serverUrlImg: commonFun.serverUrl,
  127. menu: [], //竖向菜单
  128. status_arr: commonData.order_status_arr_merchant, //订单类型数组
  129. role_col: [ //角色数组,【0,1】与role对应。menu表示纵向菜单的key数组
  130. {
  131. menu: ['resumeCheck?allow=1', 'appraisal', 'activity', 'makeMoney',
  132. 'toRecruit',
  133. 'about', 'service/index', 'quit'
  134. ],
  135. name: '用户端',
  136. },
  137. {
  138. menu: ['appraisal',
  139. 'toMember',
  140. 'about', 'service/index', 'quit'
  141. ],
  142. name: '商户端',
  143. },
  144. {
  145. menu: [
  146. 'verify',
  147. 'toMember',
  148. 'about', 'service/index', 'quit'
  149. ],
  150. name: '现场经理',
  151. }
  152. ],
  153. }
  154. },
  155. methods: {
  156. // 去个人信息页面
  157. to_per_info() {
  158. if (this.sys_role == 1) {
  159. uni.navigateTo({
  160. url: 'perInfo'
  161. })
  162. } else {
  163. if (this.user_info.nickname || this.user_info.profile_photo) {
  164. uni.navigateTo({
  165. url: 'perInfo'
  166. })
  167. } else {
  168. uni.getUserProfile({
  169. desc: "获取昵称和头像",
  170. success: (res) => {
  171. console.log('获取昵称和头像')
  172. console.log(res.userInfo)
  173. commonFun.requestUrl('&WsAjaxBiz=Worker&WsAjaxAction=registerInfo', {
  174. biz_catalog: 1,
  175. nickname: res.userInfo.nickName,
  176. profile_photo: res.userInfo.avatarUrl,
  177. }, res => {
  178. uni.navigateTo({
  179. url: 'perInfo'
  180. })
  181. })
  182. },
  183. fail: (err) => {
  184. console.log(err)
  185. uni.showToast({
  186. icon: "none",
  187. title: '获取昵称和头像失败'
  188. })
  189. uni.navigateTo({
  190. url: 'perInfo'
  191. })
  192. }
  193. })
  194. }
  195. }
  196. },
  197. // 去实名认证
  198. to_verify() {
  199. uni.navigateTo({
  200. url: this.sys_role == 0 ? './authentication' : './authentication_merchant'
  201. })
  202. },
  203. // 订单跳转
  204. href_order(e) {
  205. uni.navigateTo({
  206. url: '../order/index?status=' + e
  207. })
  208. },
  209. // 前往评价页面
  210. to_appraisal(e) { //0查看对我的评价,1查看我的评价
  211. if (e == 0) {
  212. uni.navigateTo({
  213. url: './appraisal?type=' + (this.sys_role == 0 ? 3 : 2) + '&id=' + this.user_info.id
  214. })
  215. } else {
  216. uni.navigateTo({
  217. url: './appraisal?type='
  218. })
  219. }
  220. },
  221. // 竖向菜单跳转
  222. menu_click(e) {
  223. if (this.FOREND_TOKEN == '' && e == 'verify') {
  224. uni.showModal({
  225. content: '请登录后扫码核销',
  226. success: (res) => {
  227. if (res.confirm) {
  228. uni.navigateTo({
  229. url: '../login/index?isTrader2=1'
  230. })
  231. }
  232. }
  233. })
  234. return
  235. }
  236. console.log(e)
  237. if (e == 'quit') { //退出登录
  238. uni.showModal({
  239. title: '确认退出?',
  240. success: (res) => {
  241. if (res.confirm) {
  242. uni.setStorageSync('baseUser', '')
  243. uni.setStorageSync('bizWorker', '')
  244. uni.setStorageSync('FOREND_TOKEN', '')
  245. uni.navigateTo({
  246. url: '../login/index?isTrader2=' + this.isTrader2
  247. })
  248. return
  249. }
  250. return
  251. }
  252. })
  253. return
  254. } else if (e == 'toRecruit') { //非商家跳转到商家
  255. uni.navigateToMiniProgram({
  256. appId: 'wx8c230ea00ceb8676',
  257. path: 'pages/merchant/index',
  258. })
  259. return
  260. } else if (e == 'toMember') { //商家跳转到非商家
  261. uni.navigateToMiniProgram({
  262. appId: 'wxcd35a60de7b5942a',
  263. path: 'pages/index/index',
  264. })
  265. return
  266. } else if (e == 'about') {
  267. uni.navigateTo({
  268. url: '../login/web?index=3'
  269. })
  270. return
  271. }
  272. uni.navigateTo({
  273. url: './' + e
  274. })
  275. },
  276. // 获取个人信息
  277. get_info() {
  278. if (this.isTrader2 == 1 || this.FOREND_TOKEN == '') {
  279. uni.stopPullDownRefresh()
  280. return
  281. }
  282. uni.showLoading({
  283. title: '加载中...',
  284. mask: true,
  285. })
  286. this.loading = true
  287. commonFun.get_user_info(res => {
  288. if (res.status) {
  289. uni.hideLoading()
  290. let user_info = res.data.Result
  291. this.user_info = user_info
  292. // 右上角红点数字
  293. this.status_num_arr = [
  294. this.user_info.ss_waitEnrollTotal,
  295. this.user_info.ss_workingTotal,
  296. this.user_info.ss_waitSettleTotal,
  297. 0,
  298. this.user_info.ss_unreadWKTotal_ALL,
  299. ]
  300. uni.setStorageSync('USER_INFO', this.user_info)
  301. console.log('我的页面获取个人信息')
  302. console.log(this.user_info)
  303. this.loading = false
  304. } else {
  305. console.log('获取个人信息失败')
  306. this.user_info = {}
  307. this.FOREND_TOKEN = ''
  308. }
  309. uni.stopPullDownRefresh()
  310. })
  311. },
  312. //现场经理抢夺授权
  313. grant(recruitId) {
  314. let params = {
  315. bizCatalog: 'RecruitEntity',
  316. handleMode: 'grabDelegate',
  317. recruitId,
  318. }
  319. console.log('抢夺授权请求参数')
  320. console.log(params)
  321. uni.showLoading({
  322. title: '加载中...',
  323. mask: true
  324. })
  325. commonFun.requestUrl('&WsAjaxBiz=Trader2&WsAjaxAction=entityDataHandle', params,
  326. res => {
  327. if (res.status) {
  328. console.log('核销页面抢夺授权结果返回')
  329. console.log(res.data.Result)
  330. this.biz_trader2id = res.data.Result
  331. }
  332. uni.hideLoading()
  333. }, false, true)
  334. },
  335. },
  336. onShow() {
  337. let isTrader2 = uni.getStorageSync('isTrader2') || 2 //设置isTrader2为是否是现场经理
  338. let FOREND_TOKEN = uni.getStorageSync('FOREND_TOKEN')
  339. this.isTrader2 = isTrader2
  340. if (this.isTrader2 == 1) {
  341. this.grant(uni.getStorageSync('recruitId'))
  342. }
  343. this.FOREND_TOKEN = FOREND_TOKEN
  344. this.get_info()
  345. // 渲染竖向菜单
  346. this.menu = this.role_col[isTrader2 == 1 ? 2 : commonData.sys_role]['menu'].map(item => {
  347. for (let i in commonData.my_menu_collect) {
  348. if (commonData.my_menu_collect[i]['key'] === item) {
  349. return commonData.my_menu_collect[i]
  350. }
  351. }
  352. })
  353. },
  354. onPullDownRefresh() {
  355. this.get_info()
  356. },
  357. onLoad() {},
  358. components: {
  359. trailerStars
  360. },
  361. }
  362. </script>
  363. <style>
  364. @import url("index.css");
  365. </style>