UserCenter.vue 14 KB

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