| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692 |
- <template>
- <view class="">
- <view class="drawer">
- <view class="topContentV">
- <mynavbar class="mynavbarV" :title="Btitle" titledetl="" :interestBT="0" :mycartBT="1" v-on:Enavbarsel="navbarsel"></mynavbar>
- <view class="toptalbar">
- <view v-for="(item,index) in tableList">
- <text :class="toptableindex==index?'tableLab tableselect':'tableLab'" @click="tableselct(item.value,index)">{{item.text}}</text>
- </view>
- </view>
- </view>
- </view>
- <view v-if="isLogin" class="content4 listView">
- <foodlistItem :orderlist="orderlist" v-on:ERefresh="Refresh"></foodlistItem>
- </view>
-
- <view v-if="!isLogin" class="contentColumnC" style="margin-top: 260rpx;">
- <image class="weidenglu" src="/static/msdshj/qishouIM.png" mode="aspectFit"></image>
- <text class="xuacyuA"> </text>
- <view class="contentColumnC" style="width: 100%;">
- <view class="texing">
- <view class="contentInRowL" style="align-items: center;">
- <uni-icons custom-prefix="custom-icon" color="#386EF5" type="checkbox" size="22"></uni-icons>
- <text class="textfontB3">{{$t('user.hailiangdd')}}</text>
- </view>
- <view class="contentInRowL" style="align-items: center;margin-top: 20rpx;">
- <uni-icons custom-prefix="custom-icon" color="#386EF5" type="checkbox" size="22"></uni-icons>
- <text class="textfontB3">{{$t('user.caozuojid')}}</text>
- </view>
- <view class="contentInRowL" style="align-items: center;margin-top: 20rpx;">
- <uni-icons custom-prefix="custom-icon" color="#386EF5" type="checkbox" size="22"></uni-icons>
- <text class="textfontB3">{{$t('user.shirkek')}}</text>
- </view>
- </view>
- </view>
-
- <view class="contentColumnC texing" style="width: 100%;">
- <text class="textfontB3">美食達</text>
- <text class="textfontB3">{{$t('user.chengyaojm')}}</text>
- </view>
-
- </view>
- <view v-if="isLogin">
- <view v-if="orderlist.length==0&&isLogin" class="contentColumnC">
- <image class="weishimingImage" src="/static/images/dingdan1@3x.png" mode="widthFix"></image>
- <text class="meiyouText">{{$t('order.dangqmydd')}}</text>
- </view>
- </view>
-
- <view style="height: 20rpx;"></view>
- <popViewGG :tips="$t('user.xiazaijindu')" :show="show" :maskClosable="false" :isCancel="false">
- <view class="words">
- <text>{{$t('user.xiazaizhong')}} {{percentVal}}%</text>
- </view>
- </popViewGG>
- <uni-popup style="z-index: 999;" ref="popYsxy" type="center" :isMaskClick="false" :safeArea="true">
- <ysxyView v-on:EagrResult="agrResult"></ysxyView>
- </uni-popup>
- </view>
- </template>
- <script>
- import mynavbar from "@/pages/component/mynavbar/mynavbar.vue";
-
- import api from "@/pages/api/api.js"
-
- export default {
- components:{
- mynavbar
- },
- data() {
- return {
- formData: {
- status: 'loading', // 加载状态
- },
- tipShow: false ,// 是否显示顶部提示框
- Btitle:"",
- isLogin:false,
- token:'',
- mendid:'',
- mendianList:[],
- versionMSG:[],
- appVersionCode:0,
- updateUrl:'',
- tishigx:true,
- show:false,
- percentVal:'',
- orderlist:[],
- tableList:[],
- toptableindex:0,
- state:'z01',
- page:1,
- timer:null
- }
- },
- onLoad() {
- var info = uni.getSystemInfoSync();
- //console.log(info);
- this.appVersionCode=info.appVersionCode;
- },
- onReady() {
- var yszche=uni.getStorageSync('yszche');
- if(1!=yszche){
- this.$refs.popYsxy.open('center');
- uni.hideTabBar();
- }
- },
- onShow() {
- this.tableList=[
- { value: 1, text: this.$t('order.daishouli') },
- { value: 2, text: this.$t('order.daichuchan') },
- { value: 5, text: this.$t('order.yichuchan') },
- { value: 6, text: this.$t('order.shouhou') },
- ];
-
- var yszche=uni.getStorageSync('yszche');
- if(1!=yszche){
- return;
- }
- this.getVersion();
- this.token = uni.getStorageSync("token");
- console.log('------11this.token',this.token)
- if(this.token == '' || this.token == undefined || this.token == null){
- // uni.navigateTo({
- // url:'/pages/UserCenter/LoginView'
- // })
- this.isLogin=false;
- return;
- }
- else{
- this.isLogin=true;
- this.chongxindenglu();
- }
-
-
- this.mendid = uni.getStorageSync("mendid");
- this.getMymendianlist();
- if(this.tishigx){
- this.tishigx=false;
- }
- else{
- this.getstoreorderlist(1,this.state);
- }
- this.timerAct();
- },
- onHide() {
- this.clearTimer();
- },
- methods: {
- getMymendianlist(){
- //this.formData.status = 'more'
- this.tipShow = true
-
- api('getMymendianlist',{},
- r=>{
- this.mendianList=r.data.data;
- console.log(this.mendianList);
- if(this.mendid==''||undefined==this.mendid||null==this.mendid){
- if(this.mendianList&&this.mendianList.length>0){
- this.mendid=this.mendianList[0].id;
- this.Btitle=this.mendianList[0].posName;
- }
- }
- else{
- this.chonsemendian();
- }
- this.getstoreorderlist(1,this.state);
- },failc=>{
- //console.log('getadvertis----',failc)
- uni.stopPullDownRefresh()
- this.tipShow = false
- });
- },
- chonsemendian(){
- for(var i=0;i<this.mendianList.length;i++){
- var mend = this.mendianList[i];
- if(mend.id==this.mendid){
- this.Btitle=mend.posName;
- return;
- }
- }
- this.mendid=this.mendianList[0].id;
- this.Btitle=this.mendianList[0].posName;
- },
- tableselct(id,index){
-
- if(!this.isLogin){
- uni.navigateTo({
- url:'/pages/UserCenter/LoginView'
- })
- return;
- }
- console.log('tableselct',index)
- this.toptableindex=index;
- this.state = id;
- this.page = 1;
- if(id==1){
- this.state='z01';
- }
- if(id==2){
- this.state='z23';
- }
- if(id==6){
- this.state='z678911';
- }
- this.getstoreorderlist(1,this.state);
- },
- timerAct(){
- this.clearTimer();
- var that = this;
- that.timer = setInterval(() => {
- //console.log('setInterval',that.toptableindex)
- if(that.toptableindex==0||that.toptableindex==1){
- that.Refresh();
- }
- }, 20000);
- },
- clearTimer() {
- // clearTime
- if (this.timer) {
- clearInterval(this.timer);
- this.timer = null;
- }
- },
- Refresh(){
- this.getstoreorderlist(1,this.state);
- },
- navbarsel(item){
- console.log(item);
- if(item==1){
- uni.switchTab({
- url: '/pages/UserCenter/UserCenter'
- });
- return
- }
- if(item==2){
- if(!this.isLogin){
- uni.navigateTo({
- url:'/pages/UserCenter/LoginView'
- })
- return;
- }
- uni.navigateTo({
- url:'/pages/UserCenter/mendian/xuanzemendian'
- })
- return
- }
- },
-
- getstoreorderlist(page,state){
- console.log('-----------',state,this.mendid)
- if(state<0){
- state = '';
- }
- if(state=='z23'){
- this.getdaichucan(page,state,0);
- return;
- }
- if(state==5){
- this.getdaichucan(page,'',1);
- return;
- }
- this.formData.status = 'more'
- this.tipShow = true
- uni.showLoading({
- title:'Loading...',
- mask:true
- })
- console.log(state,this.mendid)
- api('getstoreorderlist',{
- page:page,
- size:10,
- state:state,
- mdId:this.mendid
- },
- r=>{
- console.log(r);
- uni.hideLoading();
- if(page!=1){
- if(r.data.data){
- if(r.data.data.length>0){
- var temp = this.orderlist;
- for(var i=0;i<r.data.data.length;i++){
- temp.push(r.data.data[i]);
- }
- // this.orderlist=[];
- // this.orderlist.push(temp);
- this.orderlist=temp;
- }
- else{
- this.status = 'noMore';
- }
- }
- else{
- this.status = 'noMore';
- }
- }
- else{
- // this.orderlist=[];
- // this.orderlist.push(r.data.data);
- this.orderlist=r.data.data;
- this.status = 'more';
- }
- uni.stopPullDownRefresh();
- this.tipShow = false;
- },failc=>{
- uni.hideLoading();
-
- uni.stopPullDownRefresh()
- this.tipShow = false
- });
- },
-
- getdaichucan(page,state,diningStatus){
- uni.showLoading({
- title:'Loading...',
- mask:true
- })
- this.formData.status = 'more'
- this.tipShow = true;
-
- api('getstoreorderlist',{
- page:page,
- size:10,
- state:state,//空或z23
- diningStatus:diningStatus,//0h或1
- mdId:this.mendid
- },
- r=>{
- console.log(r);
- uni.hideLoading();
- if(page!=1){
- if(r.data.data){
- if(r.data.data.length>0){
- var temp = this.orderlist;
- for(var i=0;i<r.data.data.length;i++){
- temp.push(r.data.data[i]);
- }
- // this.orderlist=[];
- // this.orderlist.push(temp);
- this.orderlist=temp;
- }
- else{
- this.status = 'noMore';
- }
- }
- else{
- this.status = 'noMore';
- }
- }
- else{
- // this.orderlist=[];
- // this.orderlist.push(r.data.data);
- this.orderlist=r.data.data;
- this.status = 'more';
- }
- uni.stopPullDownRefresh();
- this.tipShow = false;
- },
- failc=>{
- uni.hideLoading();
- uni.stopPullDownRefresh()
- this.tipShow = false
- });
- },
- /**
- * 下拉刷新回调函数
- */
- onPullDownRefresh() {
- this.getstoreorderlist(1,this.state);
- this.page=1;
- },
- /**
- * 上拉加载回调函数
- */
- onReachBottom() {
- console.log('onReachBottom')
- this.page=this.page+1;
- this.getstoreorderlist(this.page,this.state);
- },
-
- chongxindenglu(){
- var that =this;
- try {//读取
- that.token = uni.getStorageSync("token");
- getApp().globalData.token = that.token;
- if(this.token == '' || this.token == undefined || this.token == null){
- // uni.navigateTo({
- // url:'/pages/UserCenter/LoginView'
- // })
- return;
- }
- else{
- this.gengxintoken(that.token);
- return;
- }
- } catch(e){//错误
- return;
- }
- },
- gengxintoken(token){
- api('refreshToken',{
- },
- r=>{
- console.log('gengxintoken',r)
- if(r.data.code==200){
- this.isLogin=true;
- uni.setStorageSync("token",r.data.data);
- getApp().globalData.token = r.data.data;
- this.getUserMsg(r.data.data);
- }
- else{
- uni.navigateTo({
- url:'/pages/UserCenter/LoginView'
- })
- }
- },failc=>{
- uni.hideLoading();
- uni.stopPullDownRefresh()
- this.tipShow = false
- });
-
- },
- getUserMsg(token){
- //console.log('getUserMsg')
- api('getUserMsg',{
- },
- r=>{
- console.log(r.data)
- if(r.data.code==200){
- let items = JSON.stringify(r.data.data);
- uni.setStorageSync('userInfo',items);
- this.getCID();
- }
- },failc=>{
- console.log(failc)
- });
- },
-
- getCID(){
- var cid = uni.getStorageSync("cid");
- if(cid==''||cid==null||cid==undefined){
- var that = this;
- uni.getPushClientId({
- success: (res) => {
- //console.log('客户端推送标识:',res.cid)
- uni.setStorageSync("cid",res.cid);
- var usdata = {
- "cid":res.cid,
- };
- that.updataUserMsg(usdata);
- },
- fail(err) {
- console.log(err)
- }
- });
- }
- else{
- var usdata = {
- "cid":cid,
- };
- this.updataUserMsg(usdata)
- }
-
- },
- updataUserMsg(data){
-
- api('updataUserMsg',data,
- res=>{
- console.log(res)
- uni.navigateBack({
- delta:1,//返回层数,2则上上页
- })
- },failc=>{
- //console.log('getadvertis----',failc)
-
- });
-
- },
-
- agrResult(state){//隐私协议
- console.log(state);
- if(state==0){
- if (plus.os.name.toLowerCase() === 'android') {
- console.log('ios');
- plus.runtime.quit();
- }
- else{
- console.log('ios');
- plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
- }
- }
- if(state==1){
- uni.showTabBar();
- this.$refs.popYsxy.close();
- uni.setStorageSync('yszche',1);
- this.chongxindenglu();
- }
- if(state==2){
- uni.navigateTo({
- url:'/pages/index/mindex/yinszhengc'
- })
- }
- },
- //自动更新
- getVersion(){
- return;
- var info = uni.getSystemInfoSync();
- console.log(info);
- if(info.platform.toLowerCase() != 'android'){
- return;
- }
- var appVersionCode = info.appVersionCode;
- var that = this;
-
- api('getversion',{
- platform:'0',
- name:'CTE.cooperate'
- },
- res=>{
- console.log(res);
- if(res.data.data){
- var versionMSG=res.data.data;
- if(appVersionCode<versionMSG.version){
- uni.showModal({
- cancelText: that.$t('order.quxiao'), // 取消按钮的文字
- confirmText: that.$t('index.shengji'), // 确认按钮的文字
- title: that.$t('api.message'),
- content: that.$t('index.yiyouxinban'),
- success: function (res) {
- if (res.confirm) { //这里是点击了确定以后
- var updateUrl='http://backend.cityexpress168.com.vn/androidApk/CTE.cooperate.apk';
- that.gengxinApp(updateUrl);
- } else { //这里是点击了取消以后
- console.log('用户点击取消')
- }
-
- }
- })
- }
- }
- },failc=>{
- //console.log('getadvertis----',failc)
-
- });
- },
- gengxinApp(url){
- console.log(url);
- var that = this;
- var dtask = plus.downloader.createDownload(
- url,
- {
- method: "GET"
- }, (d, status) => {
- console.log(status,d);
- if (status == 200) {
- plus.runtime.install(d.filename)
- } else {
- plus.nativeUI.alert('fail!' + status)
- }
- });
- dtask.start();
- var prg = 0;//进度数字化
- var show= plus.nativeUI.showWaiting("Loading...");
- var percentVal;
- dtask.addEventListener('statechanged',function(task,status){
- //console.log(task);
- switch(task.state){//根据下载状态调整其显示内容
- case 1:
- percentVal = "Loading……";
- show.setTitle("Loading……");
- break;
- case 2:
- percentVal = "Connected";
- show.setTitle("Connected");
- break;
- case 3:
- percentVal = parseInt((parseFloat(task.downloadedSize) / parseFloat(task.totalSize)) * 100);
- show.setTitle("Loading:" + percentVal + "%");
- break;
- case 4:
- plus.nativeUI.closeWaiting();
-
- break;
- }
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .contentbg{
- margin-top: 140rpx;
- }
- .mynavbarV{
- z-index: 999;
- background-color: #40AE36;
- }
- .topContentV{
- position: fixed;
- padding-top: 40rpx;
- width: 750upx;
- left: 0;
- right: 0;
- top: 0;
- z-index: 999;
- background-color: #40AE36;
- }
- .toptalbar{
- display: flex;
- flex-direction: row;
- justify-content:space-between;
- align-items: center;
- background-color: #40AE36;
- padding-top: 10rpx;
- height: 90rpx;
- margin-left: 6rpx;
- margin-right: 6rpx;
- }
- .tableLab{
- width: 24%;
- text-align: center;
- margin-left: 14rpx;
- height: 90rpx;
- line-height: 28rpx;
- font-size: 24rpx;
- color: white;
- }
- .tableselect{
- border-bottom-width: 6rpx;
- border-bottom-style:solid;
- border-bottom-color:white;
- color: white;
- font-size: 28rpx;
- }
-
- .weidenglu{
- width: 600rpx;
- height: 600rpx;
- }
- .xuacyuA{
- font-size: 26rpx;
- font-family: 'zrht';
- font-weight: bold;
- letter-spacing: 4rpx;
- margin-left: 160rpx;
- margin-top: 80rpx;
- }
- .texing{
- font-size: 24rpx;
- font-weight: bold;
- font-family: 'zrht';
- //width: 600rpx;
- letter-spacing: 2rpx;
- margin-top: 40rpx;
- color: #40AE36;
- align-items: center;
- justify-content: flex-start;
- }
- //抽屉实现
- .drawer{
- width: 100%;
- padding-left: 0;
- position: absolute;
- background-color: white;
- }
-
- .words{
- width: 100%;
- text-align: center;
- font-size: 30rpx;
- height: 80rpx;
- line-height: 80rpx;
- }
-
- .listView{
- margin-top: 290rpx;
- margin-bottom: 20rpx;
- }
-
- .weishimingImage{
- width: 30%;
- margin-top: 340rpx;
- }
- .meiyouText{
- font-size: 28rpx;
- font-weight: bold;
- color: black;
- }
-
- </style>
|