UserCenter.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <template>
  2. <view>
  3. <customNav :shownav="false" title="" titledetl=""></customNav>
  4. <view class="contentV">
  5. <view class="nodetail" @click="userIconsel">
  6. <view class="viewinrow">
  7. <netImage class="userIcon" width="120" height="120" bradius="60" :mysrc="avatar" mymode="scaleToFill"></netImage>
  8. <view class="">
  9. <view class="viewinrow">
  10. <image class="vipicon" src="/static/images/VIP (1)@3x.png" mode="widthFix"></image>
  11. <view class="userName">{{phone}}</view>
  12. </view>
  13. <text class="usernont">{{nickName}}</text>
  14. </view>
  15. </view>
  16. <image class="fanhuiimg" src="/static/images/fanhui@3x.png" mode="widthFix"></image>
  17. </view>
  18. </view>
  19. <view class="">
  20. <view style="width: 100%;height: 50rpx;background-color: #40AE36;"></view>
  21. <view class="actBTVn" style="margin-top: -50rpx;">
  22. <view class="actbt" @click="wodeshoucang">
  23. <view class="ddbticon">
  24. <image class="bticonb" src="/static/meishi/shouchang@3x.png" mode="widthFix"></image>
  25. </view>
  26. <view class="acttextw textfontB5">
  27. <text >{{$t('index.shouchang')}}</text>
  28. </view>
  29. </view>
  30. <view class="actbt" @click="wodezhuji">
  31. <view class="ddbticon">
  32. <image class="bticonb" src="/static/meishi/zhuji@3x.png" mode="widthFix"></image>
  33. </view>
  34. <view class="acttextw textfontB5">
  35. <text >{{$t('index.zhuji')}}</text>
  36. </view>
  37. </view>
  38. <view class="actbt" @click="listClick(1)">
  39. <view class="ddbticon">
  40. <image class="bticonb" src="/static/meishi/shouhdz@3x.png" mode="widthFix"></image>
  41. </view>
  42. <view class="acttextw textfontB5">
  43. <text >{{$t('index.shouhuodz')}}</text>
  44. </view>
  45. </view>
  46. <view class="actbt" @click="lianxikf">
  47. <view class="ddbticon">
  48. <image class="bticonb" src="/static/meishi/zaixiankf@3x.png" mode="widthFix"></image>
  49. </view>
  50. <view class="acttextw textfontB5">
  51. <text >{{$t('order.lianxikef')}}</text>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="actBTVn" style="padding-top: 18rpx;">
  56. <view class="actbt" @click="yinsizhc">
  57. <view class="ddbticon">
  58. <image class="bticonb" src="/static/meishi/yinsizhc@3x.png" mode="widthFix"></image>
  59. </view>
  60. <view class="acttextw textfontB5">
  61. <text >{{$t('user.yinsizhc')}}</text>
  62. </view>
  63. </view>
  64. <view class="actbt">
  65. </view>
  66. <view class="actbt" >
  67. </view>
  68. <view class="actbt" >
  69. </view>
  70. <view class="actbt" >
  71. </view>
  72. </view>
  73. </view>
  74. <view class="contentInRowC" style="margin-top: 80rpx;">
  75. <text class="dangqbb" @click="tuichudengl">{{$t('user.tuichudl')}}</text>
  76. </view>
  77. <view class="contentInRowC" style="margin-top: 40rpx;">
  78. <text class="sanchuzh" @click="zhuxiaozhangh">{{$t('user.zhuxiaozhh')}}</text>
  79. </view>
  80. <view class="contentInRowC" style="margin-top: 50rpx;">
  81. <text style="font-size: 26rpx;">{{$t('user.dangqianbb')}}: v{{appversionN}}</text>
  82. </view>
  83. <popViewGG :tips="$t('index.zhoubianfw')" :show="showpop" :acttips="$t('order.queding')" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
  84. <picker-view :indicator-style="indicatorStyle" :value="pvalue" @change="bindChange" class="picker-view">
  85. <picker-view-column>
  86. <view class="item" v-for="(item,index) in range" :key="index">{{item}}</view>
  87. </picker-view-column>
  88. </picker-view>
  89. </popViewGG>
  90. </view>
  91. </template>
  92. <script>
  93. import api from "@/pages/api/api.js"
  94. export default {
  95. data() {
  96. return {
  97. range: ["3Km","5Km","10Km","15Km","20Km"],
  98. showpop:false,
  99. indicatorStyle: 'height: 50px;',
  100. pvalue: [0],
  101. juli:3,
  102. goods:[],
  103. token:'',
  104. login:false,
  105. userInfo:[],
  106. phone:'',
  107. userType:'',
  108. nickName:this.$t('index.dengluzhuce'),
  109. avatar:'',
  110. isShangjia:false,
  111. appversionN:'',
  112. scrollHeight:0
  113. }
  114. },
  115. onLoad() {
  116. var info = uni.getSystemInfoSync();
  117. this.appversionN=info.appVersion;
  118. this.scrollHeight=info.windowHeight*(750/info.windowWidth)-440-info.statusBarHeight*(750/info.windowWidth);
  119. },
  120. onShow() {
  121. var that =this;
  122. try {//读取
  123. that.token = uni.getStorageSync("token");
  124. //console.log('2222',that.token)
  125. if(that.token == '' || that.token == undefined || that.token == null){
  126. that.login=false;
  127. that.phone='';
  128. that.nickName=that.$t('index.dengluzhuce');
  129. that.avatar='';
  130. return;
  131. }
  132. else{
  133. that.login=true;
  134. that.getUserMsg(that.token);
  135. return;
  136. }
  137. } catch(e){//错误
  138. return;
  139. }
  140. },
  141. methods: {
  142. gouwuche(){
  143. console.log("gouwuche-----");
  144. uni.switchTab({
  145. url:'/pages/OrderList/buy/gouwuche'
  146. })
  147. },
  148. wodeshoucang(){
  149. if(this.login){
  150. uni.navigateTo({
  151. url:'/pages/OrderList/buy/myCollection?listType=1'
  152. })
  153. }else{
  154. uni.navigateTo({
  155. url:'/pages/UserCenter/LoginView'
  156. })
  157. }
  158. },
  159. wodezhuji(){
  160. if(this.login){
  161. uni.navigateTo({
  162. url:'/pages/OrderList/buy/myCollection?listType=2'
  163. })
  164. }else{
  165. uni.navigateTo({
  166. url:'/pages/UserCenter/LoginView'
  167. })
  168. }
  169. },
  170. listClick(e){
  171. switch(e){
  172. case 1:
  173. if(this.login){
  174. uni.navigateTo({
  175. url:'/pages/UserCenter/dizhi/dizhilist'
  176. })
  177. }else{
  178. uni.navigateTo({
  179. url:'/pages/UserCenter/LoginView'
  180. })
  181. }
  182. break;
  183. case 2:
  184. break;
  185. case 3:
  186. uni.navigateTo({
  187. url:'/pages/kefuzhongxin/fuwuleixing'
  188. })
  189. break;
  190. case 4://语言
  191. uni.navigateTo({
  192. url:'/pages/UserCenter/yonghushezhi/duoyuyan'
  193. })
  194. break;
  195. case 5://选择服务距离
  196. this.showpop=true;
  197. break;
  198. case 6://外送员
  199. break;
  200. case 7:
  201. if(this.login){
  202. uni.navigateTo({
  203. url:'/pages/UserCenter/yonghushezhi/shezhi'
  204. })
  205. }else{
  206. uni.navigateTo({
  207. url:'/pages/UserCenter/LoginView'
  208. })
  209. }
  210. break;
  211. case 8:
  212. uni.navigateTo({
  213. url:'/pages/UserCenter/yonghushezhi/bangzhu'
  214. })
  215. break;
  216. }
  217. },
  218. userIconsel(){
  219. if(this.login){
  220. //用户信息编辑页
  221. uni.navigateTo({
  222. url:'/pages/UserCenter/userinfoSet'
  223. })
  224. }else{
  225. uni.navigateTo({
  226. url:'/pages/UserCenter/LoginView'
  227. })
  228. }
  229. },
  230. getUserMsg(token){
  231. //console.log('getUserMsg')
  232. api('getUserMsg',{
  233. },res=>{
  234. //console.log(res.data)
  235. if(res.data.code==200){
  236. this.userInfo=res.data.data;
  237. this.phone=res.data.data.phone;
  238. this.nickName=res.data.data.nickName;
  239. this.avatar=res.data.data.avatar;
  240. //console.log('this.avatar',this.avatar)
  241. uni.setStorageSync('userInfo',res.data.data);
  242. if(res.data.data.userType==1){
  243. this.isShangjia=true;
  244. }
  245. }
  246. },failc=>{
  247. //console.log('getadvertis----',failc)
  248. })
  249. },
  250. bindChange (e) {
  251. var val = e.detail.value[0];
  252. console.log(val)
  253. if(val==0){
  254. this.juli=3;
  255. }
  256. else{
  257. this.juli=5*val;
  258. }
  259. },
  260. chooseCancel(){
  261. this.showpop=false;
  262. // this.juli=3000
  263. uni.setStorageSync('FuWujuli',this.juli);
  264. console.log(this.juli);
  265. },
  266. tuichudengl(){
  267. var that = this;
  268. uni.showModal({
  269. title: that.$t('api.message'),
  270. content: that.$t('user.querentcdq'),
  271. cancelText:that.$t('order.quxiao'),
  272. confirmText:that.$t('comp.queren'),
  273. success: function (res) {
  274. if (res.confirm) { //这里是点击了确定以后
  275. uni.setStorageSync('userInfo','');
  276. uni.setStorageSync('token','');
  277. getApp().globalData.token='';
  278. that.disconectGoeasy();
  279. uni.navigateTo({
  280. url:'/pages/UserCenter/LoginView'
  281. })
  282. } else { //这里是点击了取消以后
  283. console.log('用户点击取消')
  284. }
  285. }
  286. })
  287. },
  288. lianxikf(){
  289. uni.navigateTo({
  290. url:'/pages/kehufuwu/kefuMsgList?ddId='
  291. })
  292. },
  293. zhuxiaozhangh(){
  294. var that = this;
  295. uni.showModal({
  296. title: that.$t('user.zhuxiaozhh'),
  297. content: that.$t('user.zhuxiaodqzh'),
  298. cancelText:that.$t('order.quxiao'),
  299. confirmText:that.$t('comp.queren'),
  300. success: function (res) {
  301. if (res.confirm) { //这里是点击了确定以后
  302. this.updatazuxiao();
  303. } else { //这里是点击了取消以后
  304. console.log('用户点击取消')
  305. }
  306. }
  307. })
  308. },
  309. updatazuxiao(){
  310. var that = this;
  311. api('deleuser',{
  312. },res=>{
  313. console.log(res)
  314. uni.setStorageSync('userInfo','');
  315. uni.setStorageSync('token','');
  316. that.disconectGoeasy();
  317. uni.navigateTo({
  318. url:'/pages/UserCenter/LoginView'
  319. })
  320. },failc=>{
  321. //console.log('getadvertis----',failc)
  322. })
  323. },
  324. disconectGoeasy(){
  325. this.goEasy.disconnect({
  326. onSuccess: function(){
  327. console.log("GoEasy disconnect successfully.")
  328. getApp().globalData.goEasycnt=false;
  329. },
  330. onFailed: function(error){
  331. console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
  332. }
  333. });
  334. },
  335. yinsizhc(){
  336. uni.navigateTo({
  337. url:'/pages/index/mindex/yinszhengc'
  338. })
  339. },
  340. openWebView(index){
  341. var url=''
  342. if(index==1){
  343. url='https://cityexpress168.com.vn/bao-mat-thong-tin'
  344. }
  345. if(index==2){
  346. url='https://cityexpress168.com.vn/dieu-khoan-su-dung'
  347. }
  348. if(index==3){
  349. url='https://cityexpress168.com.vn/quy-che-hoat-dong'
  350. }
  351. if(index==4){
  352. url='https://cityexpress168.com.vn/quy-trinh-giai-quyet-tranh-chap-khieu-nai'
  353. }
  354. if(index==5){
  355. url='https://cityexpress168.com.vn/dia-chi-cong-ty'
  356. }
  357. uni.navigateTo({
  358. url:'/pages/UserCenter/OpenWebview?url='+url
  359. })
  360. },
  361. }
  362. }
  363. </script>
  364. <style>
  365. page{
  366. background-color: #F2F3F7;
  367. }
  368. .contentV{
  369. width: 100%;
  370. background-color: #40AE36;
  371. }
  372. .viewinrow{
  373. display: flex;
  374. flex-direction: row;
  375. align-items: center;
  376. }
  377. .nodetail{
  378. display: flex;
  379. flex-direction: row;
  380. justify-content: space-between;
  381. align-items: center;
  382. background-color: #40AE36;
  383. padding: 30rpx;
  384. }
  385. .userIcon{
  386. margin: 20rpx;
  387. width: 120rpx;
  388. height: 120rpx;
  389. border-radius: 60rpx;
  390. background-color: white;
  391. }
  392. .vipicon{
  393. width: 30rpx;
  394. }
  395. .userName{
  396. font-size: 30rpx;
  397. padding-left: 16rpx;
  398. color: white;
  399. }
  400. .usernont{
  401. font-size: 26rpx;
  402. color: white;
  403. padding-left: 16rpx;
  404. }
  405. .usernameCt{
  406. padding-left: 10rpx;
  407. text-align: left;
  408. font-size: 22rpx;
  409. line-height: 32rpx;
  410. }
  411. .fanhuiimg{
  412. width: 30rpx;
  413. height: 30rpx;
  414. margin-right: 50rpx;
  415. }
  416. .huiyuanxct{
  417. margin-top: 30rpx;
  418. width: 94%;
  419. margin-left: 3%;
  420. }
  421. .actBTVshang{
  422. width: 70%;
  423. padding-left: 15%;
  424. display: flex;
  425. flex-direction: row;
  426. justify-content:space-between;
  427. align-items: center;
  428. background-color: #40AE36;
  429. }
  430. .actBTV{
  431. width: 100%;
  432. display: flex;
  433. flex-direction: row;
  434. justify-content:space-between;
  435. align-items: center;
  436. background-color: #40AE36;
  437. }
  438. .actBTVn{
  439. margin-left: 3%;
  440. width: 94%;
  441. display: flex;
  442. flex-direction: row;
  443. justify-content:space-between;
  444. align-items: center;
  445. background-color: white;
  446. border-radius: 10rpx;
  447. box-shadow: -2rpx 2rpx 5rpx lightgrey;
  448. }
  449. .actbt{
  450. width: 25%;
  451. height: 160rpx;
  452. margin-top: 10rpx;
  453. align-items: center;
  454. justify-content: center;
  455. }
  456. .bticon{
  457. width: 80rpx;
  458. }
  459. .bticonb{
  460. width: 70rpx;
  461. }
  462. .acttext{
  463. color: white;
  464. text-align: center;
  465. }
  466. .acttextw{
  467. color: black;
  468. text-align: center;
  469. }
  470. .dangdanrukouT{
  471. height: 62rpx;
  472. background-color: #40AE36;
  473. }
  474. .dingdantext{
  475. width: 100%;
  476. font-size: 30rpx;
  477. padding-left: 20rpx;
  478. padding-top: 20rpx;
  479. background-color: white;
  480. }
  481. .ddactbt{
  482. width: 20%;
  483. height: 120rpx;
  484. flex-direction: column;
  485. align-items: center;
  486. justify-content: center;
  487. }
  488. .ddbticon{
  489. width: 100%;
  490. height: 80rpx;
  491. display: flex;
  492. align-items: center;
  493. justify-content: center;
  494. }
  495. .ddtext{
  496. text-align: center;
  497. font-size: 20rpx;
  498. color: black;
  499. }
  500. .listcontent{
  501. margin-left: 3%;
  502. width: 94%;
  503. display: flex;
  504. box-shadow: -4rpx 6rpx 2rpx lightgrey;
  505. }
  506. .picker-view {
  507. width: 750rpx;
  508. height: 300rpx;
  509. margin-top: 10rpx;
  510. }
  511. .item {
  512. line-height: 100rpx;
  513. text-align: center;
  514. }
  515. .dangqbb{
  516. width:80%;
  517. text-align: center;
  518. font-size: 36rpx;
  519. height: 80rpx;
  520. line-height: 80rpx;
  521. color: white;
  522. background-color:#40AE36;
  523. border-radius: 10rpx;
  524. }
  525. .sanchuzh{
  526. width:80%;
  527. text-align: center;
  528. font-size: 36rpx;
  529. height: 80rpx;
  530. line-height: 80rpx;
  531. color: white;
  532. background-color:crimson;
  533. border-radius: 10rpx;
  534. }
  535. </style>