index.vue 12 KB

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