mindex.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  1. <template>
  2. <view class="drawer">
  3. <mynavbar class="mynavbarV" :title="Btitle" :titledetl="Btitledetl" :interestBT="0" :mycartBT="1" v-on:Enavbarsel="navbarsel"></mynavbar>
  4. <view :style="{marginTop: vMtop+'rpx'}">
  5. <swiperImgs v-if="cuxiaoImge.length>0" style="margin-top: 20rpx;" width="750" height="380" :imageList="cuxiaoImge"></swiperImgs>
  6. <listitemB ref="flList" v-on:Efenleixuanze="fenleixuanze"></listitemB>
  7. <!-- <fenleiList ref="fwfenlei" v-on:Efwflxuanze="fwflxuanze"></fenleiList> -->
  8. <listItemD v-on:Emendianxuanze="mendianxuanze" :mendianList="mendianList" :title="$t('index.remenct')"></listItemD>
  9. <!-- <listItemC ref="flList" v-on:Efenleixuanze="fenleixuanze"></listItemC> -->
  10. </view>
  11. <view class="contentColumnC" style="margin-top: 10rpx;">
  12. <view class="contentInRowS" style="width: 92%;">
  13. <view class="contentColumnC" @click="BtStatesl(-1)">
  14. <text class="toptext" :style="BtState==-1?'color:#40AE36':'color:black'">附近美食</text>
  15. <text class="motext" :style="BtState==-1?'background-color:#40AE36;color:white':'background-color:white;color:darkgray'">猜你喜欢</text>
  16. </view>
  17. <!-- <text style="height: 60rpx;width: 2rpx;background-color:darkgray;"></text> -->
  18. <!-- <view class="contentColumnC" @click="BtStatesl(3)">
  19. <text class="toptext" :style="BtState==3?'color:#40AE36':'color:black'">最快</text>
  20. <text class="motext" :style="BtState==3?'background-color:#40AE36;color:white':'background-color:white;color:darkgray'">距离最近</text>
  21. </view>
  22. <text style="height: 60rpx;width: 2rpx;background-color: cadetblue;"></text>
  23. <view class="contentColumnC" @click="BtStatesl(2)">
  24. <text class="toptext" :style="BtState==2?'color:#40AE36':'color:black'">优惠</text>
  25. <text class="motext" :style="BtState==2?'background-color:#40AE36;color:white':'background-color:white;color:darkgray'">折扣最低</text>
  26. </view>
  27. <text style="height: 60rpx;width: 2rpx;background-color: cadetblue;"></text>
  28. <view class="contentColumnC" @click="BtStatesl(0)">
  29. <text class="toptext" :style="BtState==0?'color:#40AE36':'color:black'">人气</text>
  30. <text class="motext" :style="BtState==0?'background-color:#40AE36;color:white':'background-color:white;color:darkgray'">大家在买</text>
  31. </view> -->
  32. </view>
  33. <!-- <view class="contentColumnC" style="margin-top: 16rpx;">
  34. <view class="item_content" v-for="(item,index) in fjmendian" @click="mendianxuanze(item.id)">
  35. <imageconver :isremen="true" :isyouhui="false" :youhuinote="''" class="mainimage" :imagSrc="item.image"></imageconver>
  36. <view class="titletext textfontB3">
  37. <text>{{item.posName}}</text>
  38. </view>
  39. <text class="Dishes">{{item.area}}</text>
  40. <view class="price textfontB5">
  41. <text>{{$t('index.manX')}} {{$formPr(item.posPrice)}}{{$t('locale.huobidw')}}</text>
  42. </view>
  43. </view>
  44. </view> -->
  45. <view class="contentColumnC" style="margin-top: 16rpx;">
  46. <view class="item_content" v-for="(item,index) in fjmendian" @click="mendianxuanze(item.id)">
  47. <view class="contentInRowS">
  48. <netImage width="130" height="130" :mysrc="item.logo" mymode="scaleToFill"></netImage>
  49. <view class="contentColumn" style="width:520rpx ;">
  50. <text class="text2row" style="font-size: 30rpx;">{{item.posName}}</text>
  51. <view class="contentInRowS">
  52. <text style="font-size: 26rpx;color: brown;">{{item.pingf}}分</text>
  53. <text style="font-size: 26rpx;color: green;">月售{{item.ddsl}}+</text>
  54. </view>
  55. <view class="contentInRowS">
  56. <text style="font-size: 26rpx;color:dimgrey;">{{item.posPrice}}起送</text>
  57. <text style="font-size: 26rpx;">距离{{item.juli}}Km</text>
  58. </view>
  59. <view class="contentInRowL">
  60. <text class="notTextA" style="font-size: 28rpx;">新客优惠</text>
  61. <text class="notTextA" style="font-size: 28rpx;">超好吃</text>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="">
  66. <scroll-view scroll-view scroll-x="true" >
  67. <view class="item_list">
  68. <view v-for="(item1, index) in item.foodList">
  69. <view class="itemA_content">
  70. <netImage width="130" height="130" :mysrc="item1.image" mymode="scaleToFill"></netImage>
  71. <view class="contentColumnC title">
  72. <text class="text2row" >{{item1.name}}</text>
  73. <text>{{item1.price}}</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <popViewGG :tips="$t('user.xiazaijindu')" :show="show" :maskClosable="false" :isCancel="false">
  84. <view class="words">
  85. <text>{{$t('user.xiazaizhong')}} {{percentVal}}%</text>
  86. </view>
  87. </popViewGG>
  88. <popViewGG :tips="$t('index.dizhixuanz')" :show="showaddrs" :maskClosable="true" :isCancel="true" :acttips="$t('index.qitadizhi')" @chooseCancel="chooseCancel" @ClickCancel="ClickCancel">
  89. <view class="contentColumnC" style="width: 90%;margin-left: 5%;">
  90. <view class="itemView" v-for="(item,index) in addrList" @click="addrselct(item)">
  91. <text class="addrV textfontB5">{{item.address}}</text>
  92. </view>
  93. </view>
  94. </popViewGG>
  95. <uni-popup style="z-index: 999;" ref="popYsxy" type="center" :isMaskClick="false" :safeArea="true">
  96. <ysxyView v-on:EagrResult="agrResult"></ysxyView>
  97. </uni-popup>
  98. </view>
  99. </template>
  100. <script>
  101. import mynavbar from "@/pages/component/mynavbar/mynavbar.vue";
  102. import listItemC from "@/pages/component/listItemC/listItemC.vue";
  103. import listItemD from "@/pages/component/listItemD/listItemD.vue";
  104. import listitemB from "@/pages/component/listitemB/listitemB.vue";
  105. import api from "@/pages/api/api.js"
  106. export default {
  107. components:{
  108. mynavbar,
  109. listItemC,
  110. listItemD,
  111. listitemB
  112. },
  113. data() {
  114. return {
  115. cuxiaoImge:[],
  116. systemLocale: '',
  117. applicationLocale: '',
  118. Btitle:'',
  119. Btitledetl:'',
  120. latitude:10.721347,
  121. longitude:106.713463,
  122. addrList:[],
  123. open: false,
  124. isActive: false,
  125. goods:[],
  126. mendianList:[],
  127. readonly:true,
  128. versionMSG:[],
  129. appVersionCode:0,
  130. updateUrl:'',
  131. tishigx:true,
  132. show:false,
  133. showaddrs:false,
  134. percentVal:'',
  135. juli:0,
  136. searchBrH:120,
  137. vMtop:0,
  138. BtState:-1,
  139. fjmendian:[],
  140. page:1
  141. }
  142. },
  143. onLoad() {
  144. //this.ringoffImCall();
  145. var tempjuli=uni.getStorageSync('FuWujuli');
  146. if(''==tempjuli||null==tempjuli||undefined==tempjuli){
  147. this.juli=10;
  148. }
  149. else{
  150. this.juli=tempjuli;
  151. }
  152. var info = uni.getSystemInfoSync();
  153. //console.log(info);
  154. this.appVersionCode=info.appVersionCode;
  155. this.statusBarHeight=info.statusBarHeight*4+60;
  156. this.vMtop=this.statusBarHeight+this.searchBrH;
  157. var yszche=uni.getStorageSync('yszche');
  158. if(1!=yszche){
  159. }
  160. else{
  161. var tempjuli=uni.getStorageSync('FuWujuli');
  162. if(''==tempjuli||null==tempjuli||undefined==tempjuli){
  163. this.juli=10;
  164. }
  165. else{
  166. this.juli=tempjuli;
  167. }
  168. uni.setStorageSync("latitude",this.latitude);
  169. uni.setStorageSync("longitude",this.longitude);
  170. // this.gethostmendianlist(1);
  171. this.MYgetLocation();
  172. }
  173. },
  174. onReady() {
  175. var yszche=uni.getStorageSync('yszche');
  176. if(1!=yszche){
  177. this.$refs.popYsxy.open('center');
  178. uni.hideTabBar();
  179. }
  180. else{
  181. }
  182. // this.$refs.fwfenlei.getfenleiList();
  183. },
  184. onShow() {
  185. var yszche=uni.getStorageSync('yszche');
  186. if(1!=yszche){
  187. return;
  188. }
  189. this.cuxiaoList();
  190. var tempjuli=uni.getStorageSync('FuWujuli');
  191. if(''==tempjuli||null==tempjuli||undefined==tempjuli){
  192. this.juli=10;
  193. }
  194. else{
  195. this.juli=tempjuli;
  196. }
  197. console.log('this.juli',this.juli)
  198. this.chongxindenglu();
  199. if(this.tishigx){
  200. this.tishigx=false;
  201. }
  202. else{
  203. this.gettempLocate();
  204. this.$refs.flList.getmendianfenlei();
  205. //this.$refs.fwfenlei.getfenleiList();
  206. }
  207. },
  208. methods: {
  209. checkdingdan(){
  210. //getApp().globalData.iosfl(1);
  211. },
  212. cuxiaoList(){
  213. this.cuxiaoImge=['/static/background/lunbo1.png','/static/background/lunbo1.png','/static/background/lunbo1.png'];
  214. return;
  215. api('cuxiaoList',{
  216. mdId:'',
  217. price:''
  218. },r=>{
  219. //console.log('-----------',r)
  220. if(r.data.code==200){
  221. this.cuxiaoImge=[];
  222. var objs = r.data.data;
  223. for(var i=0;i<objs.length;i++){
  224. var obj=objs[i];
  225. if(obj.poster&&obj.poster.length>0){
  226. this.cuxiaoImge.push(obj.poster);
  227. }
  228. }
  229. }
  230. },failc=>{
  231. //console.log('getadvertis----',failc)
  232. })
  233. },
  234. //获取自己最近收货地址
  235. getzuijinaddress(latitude,longitude){
  236. api('getzuijinaddress',{
  237. latitude:latitude,
  238. longitude:longitude
  239. },res=>{
  240. if(res.data.code!=200){
  241. return;
  242. }
  243. this.addrList=res.data.data;
  244. console.log('11113');
  245. },failc=>{
  246. //console.log('getadvertis----',failc)
  247. })
  248. },
  249. //获取当前定位
  250. MYgetLocation(){
  251. console.log('MYgetLocation');
  252. var that = this;
  253. uni.getLocation({
  254. type:"wgs84", //默认为 wgs84 返回 gps 坐标//谷歌地图使用 wgs84 坐标,其他地图使用 gcj02 坐标
  255. geocode: "true",
  256. isHighAccuracy: "true",
  257. accuracy: "best", // 精度值为20m
  258. success: function (res) {
  259. console.log("定位获取:", res);
  260. that.latitude=res.latitude;
  261. that.longitude=res.longitude;
  262. var latlon= that.latitude+','+that.longitude;
  263. // that.Btitle=latlon;
  264. uni.setStorageSync("latitude",that.latitude);
  265. uni.setStorageSync("longitude",that.longitude);
  266. // that.gethostmendianlist(1);
  267. that.getMeishidafjmd(0,1);
  268. that.getzuijinaddress(that.latitude,that.longitude);
  269. that.getAreaCode(latlon);
  270. },
  271. fail(err) {
  272. console.log(err);
  273. if(that.Btitledetl==''){
  274. // uni.navigateTo({
  275. // url:'/pages/UserCenter/map/map?state=0'
  276. // })
  277. // uni.navigateTo({
  278. // url:'/pages/UserCenter/map/mapN?state=0'
  279. // })
  280. uni.showToast({
  281. title:that.$t('api.dingweishibai'),
  282. icon: 'none',
  283. duration: 3000
  284. })
  285. }
  286. }
  287. });
  288. },
  289. //获取地图选点返回
  290. gettempLocate(){
  291. var that =this;
  292. try {//读取
  293. var data = uni.getStorageSync("userAddrLocation");
  294. if(''==data || undefined==data || null==data){
  295. // that.gethostmendianlist(1);
  296. that.getMeishidafjmd(0,1);
  297. that.getzuijinaddress(that.latitude,that.longitude);
  298. return;
  299. }
  300. else{
  301. that.latitude=data.latitude;
  302. that.longitude=data.longitude;
  303. uni.setStorageSync("latitude",that.latitude);
  304. uni.setStorageSync("longitude",that.longitude);
  305. that.Btitle=data.name;
  306. that.Btitledetl=data.address;
  307. // that.gethostmendianlist(1);
  308. that.getMeishidafjmd(0,1);
  309. uni.setStorageSync('userAddrLocation',"");
  310. uni.setStorageSync('tempLocation','');
  311. that.getzuijinaddress(that.latitude,that.longitude);
  312. return;
  313. }
  314. } catch(e){//错误
  315. return;
  316. }
  317. },
  318. //获取附近地址
  319. getAreaCode(latlng){
  320. var userId = uni.getStorageSync('userId');
  321. var that = this;
  322. api('getAddr',{
  323. latlng:latlng,
  324. id:userId
  325. },res=>{
  326. //console.log('getAreaCode',res);
  327. if(res.data.code!=200){
  328. return;
  329. }
  330. this.Btitle=res.data.data.name;
  331. this.Btitledetl=res.data.data.address;
  332. },failc=>{
  333. //console.log('getadvertis----',failc)
  334. })
  335. },
  336. dowithAddr(r,type){
  337. console.log(r);
  338. if(type==0){
  339. if(r.result.pois.length>0){
  340. this.Btitledetl=r.result.formatted_address;
  341. }
  342. }
  343. else if(type==1){
  344. if(r.results.length>0){
  345. this.Btitledetl=r.results[1].vicinity;
  346. }
  347. }
  348. },
  349. //
  350. navbarsel(item){
  351. console.log('navbarsel')
  352. if(item==1){
  353. if(this.addrList.length>0){
  354. this.showaddrs=true;
  355. }
  356. else{
  357. uni.navigateTo({
  358. url:'/pages/UserCenter/map/Chazhaodizhi'
  359. })
  360. // uni.navigateTo({
  361. // url:'/pages/UserCenter/map/mapN?state=0'
  362. // })
  363. }
  364. }
  365. if(item==2){
  366. uni.navigateTo({
  367. url:'/pages/shanpinxungou/shangpin/shangpinList/shangpinList'
  368. })
  369. }
  370. },
  371. addrselct(item){
  372. this.latitude=item.latitude;
  373. this.longitude=item.longitude;
  374. uni.setStorageSync("latitude",this.latitude);
  375. uni.setStorageSync("longitude",this.longitude);
  376. this.Btitle='';
  377. this.Btitledetl=item.address;
  378. // this.gethostmendianlist(1);
  379. this.getMeishidafjmd(0,1);
  380. this.showaddrs=false;
  381. },
  382. chooseCancel(){
  383. this.showaddrs=false;
  384. },
  385. ClickCancel(){
  386. this.showaddrs=false;
  387. console.log('ClickCancel');
  388. uni.navigateTo({
  389. url:'/pages/UserCenter/map/Chazhaodizhi'
  390. })
  391. // uni.navigateTo({
  392. // url:'/pages/UserCenter/map/mapN?state=0'
  393. // })
  394. },
  395. //获取附近热门门店
  396. gethostmendianlist(type){//0按照评分查询,1按照热度查询,2按照新开店时间查询
  397. console.log(this.longitude,this.latitude)
  398. var that = this;
  399. api('getPfStore',{
  400. longitude:this.longitude,
  401. latitude:this.latitude,
  402. page:1,
  403. juli:this.juli,
  404. type:type
  405. },res=>{
  406. console.log('getPfStore-----',res);
  407. if(res.data.code==200){
  408. this.mendianList=res.data.data;
  409. }
  410. },failc=>{
  411. uni.showToast({
  412. title: that.$t('api.wangluoshibai'),
  413. icon: 'none',
  414. duration: 2500
  415. })
  416. })
  417. this.BtStatesl(this.BtState);
  418. },
  419. //获取附近门店
  420. getmendianlist(latitude,longitude){
  421. var that = this;
  422. that.fjmendian=[];
  423. api('getmendianlist',{
  424. longitude:longitude,
  425. latitude:latitude,
  426. page:1,
  427. area:'',
  428. sort:'',
  429. juli:that.juli
  430. },res=>{
  431. //console.log('11',res);
  432. if(res.data.data.length>0){
  433. that.fjmendian=res.data.data;
  434. }
  435. else{
  436. console.log('数据空')
  437. }
  438. },failc=>{
  439. uni.showToast({
  440. title: that.$t('api.wangluoshibai'),
  441. icon: 'none',
  442. duration: 2500
  443. })
  444. })
  445. },
  446. //美食达 获取附近门店
  447. getMeishidafjmd(type,page){
  448. var that = this;
  449. var language = uni.getStorageSync('language');
  450. if(language=='yuenan'){
  451. language='vi';
  452. }
  453. if(language=='zh-Hans'){
  454. language='zh-CN';
  455. }
  456. if(language=='zh-Hant'){
  457. language='zh-TW';
  458. }
  459. api('getStoreList',{
  460. longitude:this.longitude,
  461. latitude:this.latitude,
  462. page:page,
  463. flId:type,
  464. language:language
  465. },res=>{
  466. console.log('getMeishidafjmd:',res.data.data.records);
  467. if(res.data.data.records.length>0){
  468. if(page==1){
  469. that.fjmendian=res.data.data.records;
  470. }
  471. else{
  472. var temp = that.fjmendian;
  473. for(var i=0;i<res.data.data.records.length;i++){
  474. temp.push(res.data.data.records[i]);
  475. }
  476. that.fjmendian=temp;
  477. }
  478. }
  479. else{
  480. console.log('数据空')
  481. if(that.page>1){
  482. that.page=that.page-1;
  483. }
  484. }
  485. },failc=>{
  486. uni.showToast({
  487. title: that.$t('api.wangluoshibai'),
  488. icon: 'none',
  489. duration: 2500
  490. })
  491. })
  492. },
  493. fenleixuanze(e){
  494. uni.navigateTo({
  495. url:'/pages/shanpinxungou/shangjia/shangjia?id='+e+'&latitude='+this.latitude+'&longitude='+this.longitude
  496. })
  497. return;
  498. },
  499. fwflxuanze(e){
  500. // uni.navigateTo({
  501. // url:'/pages/imcall/audioPush?caller=0&&playUrl='
  502. // })
  503. // return;
  504. // var token = uni.getStorageSync("token");
  505. // console.log('2222',token)
  506. // if(token == '' || token == undefined || token == null){
  507. // uni.navigateTo({
  508. // url:'/pages/UserCenter/LoginView'
  509. // })
  510. // return;
  511. // }
  512. // uni.navigateTo({
  513. // url:'/pages/dache/DdcheshouyeN?type=3'
  514. // })
  515. // return;
  516. uni.navigateTo({
  517. url:'/pages/index/fuwuleixingList?serverType='+e+'&latitude='+this.latitude+'&longitude='+this.longitude
  518. })
  519. return;
  520. },
  521. mendianxuanze(id){
  522. uni.navigateTo({
  523. url:'/pages/shanpinxungou/shangjia/shangjiaView?id='+id+'&isShangjia=0'
  524. })
  525. },
  526. chongxindenglu(){
  527. var token = getApp().globalData.token;
  528. //console.log('chongxindenglu111',token);
  529. if(token == '' || token == undefined || token == null){
  530. //console.log('chongxindenglu1112222');
  531. return;
  532. }
  533. else{
  534. //console.log('chongxindenglu111333');
  535. this.gengxintoken(token);
  536. return;
  537. }
  538. },
  539. gengxintoken(token){
  540. api('refreshToken',{
  541. token:getApp().globalData.token
  542. },res=>{
  543. if(res.data.code==200){
  544. //console.log('refreshToken',res)
  545. getApp().globalData.token = res.data.data;
  546. uni.setStorageSync("token",res.data.data);
  547. this.getCID();
  548. }
  549. else{
  550. getApp().globalData.token = '';
  551. uni.setStorageSync("token",'');
  552. console.log('refreshToken',res)
  553. }
  554. },failc=>{
  555. //console.log('getadvertis----',failc)
  556. })
  557. },
  558. getCID(){
  559. var cid = uni.getStorageSync("cid");
  560. //console.log('客户端推送标识:',cid)
  561. if(cid==''||cid==null||cid==undefined){
  562. var that = this;
  563. uni.getPushClientId({
  564. success: (res) => {
  565. console.log('客户端推送标识:',res.cid)
  566. // uni.showToast({
  567. // title:'客户端推送标识1:'+res.cid,
  568. // icon: 'none',
  569. // duration: 4000
  570. // })
  571. uni.setStorageSync("cid",res.cid);
  572. that.updataUserMsg(res.cid);
  573. },
  574. fail(err) {
  575. uni.showToast({
  576. title:'获取推送标识失败',
  577. icon: 'none',
  578. duration: 4000
  579. })
  580. console.log(err)
  581. }
  582. });
  583. }
  584. else{
  585. this.updataUserMsg(cid)
  586. }
  587. },
  588. updataUserMsg(cid){
  589. api('updataUserMsg',{//159b0921b7ab3eb4f93a184d973b9fcb
  590. "cid":cid,
  591. },res=>{
  592. console.log('updataUserMsg:',cid,res.data)
  593. },failc=>{
  594. //console.log('getadvertis----',failc)
  595. })
  596. },
  597. //---------------------------------------------------
  598. agrResult(state){//隐私协议
  599. console.log(state);
  600. if(state==0){
  601. if (plus.os.name.toLowerCase() === 'android') {
  602. console.log('ios');
  603. plus.runtime.quit();
  604. }
  605. else{
  606. console.log('ios');
  607. // const threadClass = plus.ios.importClass("NSThread");
  608. // const mainThread = plus.ios.invoke(threadClass, "mainThread");
  609. // plus.ios.invoke(mainThread, "exit");
  610. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  611. }
  612. }
  613. if(state==1){
  614. uni.showTabBar();
  615. this.$refs.popYsxy.close();
  616. uni.setStorageSync('yszche',1);
  617. var yszche=uni.getStorageSync('yszche');
  618. console.log(yszche);
  619. this.MYgetLocation();
  620. this.$refs.flList.getmendianfenlei();
  621. }
  622. if(state==2){
  623. uni.navigateTo({
  624. url:'/pages/index/mindex/yinszhengc'
  625. })
  626. }
  627. },
  628. ringoffImCall(){
  629. api('ringoff',{
  630. },res=>{
  631. console.log(res)
  632. },failc=>{
  633. //console.log('getadvertis----',failc)
  634. })
  635. },
  636. //-------------------------------------------------
  637. BtStatesl(index){//附近 好评 新店
  638. this.BtState=index;
  639. if(index==-1||index==3){
  640. this.getmendianlist(this.latitude,this.longitude);
  641. return;
  642. }
  643. this.getPfStore(this.BtState);
  644. },
  645. //查询附近高评分门店等----------------------------------------------------------
  646. getPfStore(type){//0按照评分查询,1按照热度查询,2按照新开店时间查询
  647. this.fjmendian=[];
  648. var that = this;
  649. api('getPfStore',{
  650. longitude:this.longitude,
  651. latitude:this.latitude,
  652. page:1,
  653. juli:this.juli,
  654. type:type
  655. },res=>{
  656. //console.log('getPfStore-----',res);
  657. if(res.data.code==200){
  658. this.fjmendian=res.data.data;
  659. }
  660. },failc=>{
  661. uni.showToast({
  662. title: that.$t('api.wangluoshibai'),
  663. icon: 'none',
  664. duration: 2500
  665. })
  666. })
  667. },
  668. //自动更新
  669. getVersion(){
  670. var info = uni.getSystemInfoSync();
  671. console.log(info);
  672. if(info.platform.toLowerCase() != 'android'){
  673. return;
  674. }
  675. var appVersionCode = info.appVersionCode;
  676. var that = this;
  677. api('getversion',{
  678. platform:'0',
  679. name:'CTE'
  680. },res=>{
  681. console.log(res);
  682. if(res.data.data){
  683. var versionMSG=res.data.data;
  684. if(appVersionCode<versionMSG.version){
  685. uni.showModal({
  686. cancelText: that.$t('order.quxiao'), // 取消按钮的文字
  687. confirmText: that.$t('index.shengji'), // 确认按钮的文字
  688. title: that.$t('api.message'),
  689. content: that.$t('index.yiyouxinban'),
  690. success: function (res) {
  691. if (res.confirm) { //这里是点击了确定以后
  692. var updateUrl='http://backend.amazeway.com.cn/androidApk/CTE.apk';
  693. that.gengxinApp(updateUrl);
  694. } else { //这里是点击了取消以后
  695. console.log('用户点击取消')
  696. }
  697. }
  698. })
  699. }
  700. }
  701. },failc=>{
  702. //console.log('getadvertis----',failc)
  703. });
  704. },
  705. gengxinApp(url){
  706. console.log(url);
  707. var that = this;
  708. var dtask = plus.downloader.createDownload(
  709. url,
  710. {
  711. method: "GET"
  712. }, (d, status) => {
  713. console.log(status,d);
  714. if (status == 200) {
  715. plus.runtime.install(d.filename)
  716. } else {
  717. plus.nativeUI.alert('fail!' + status)
  718. }
  719. });
  720. dtask.start();
  721. var prg = 0;//进度数字化
  722. var show= plus.nativeUI.showWaiting("Loading...");
  723. var percentVal;
  724. dtask.addEventListener('statechanged',function(task,status){
  725. //console.log(task);
  726. switch(task.state){//根据下载状态调整其显示内容
  727. case 1:
  728. percentVal = "Loading……";
  729. show.setTitle("Loading……");
  730. break;
  731. case 2:
  732. percentVal = "Connected";
  733. show.setTitle("Connected");
  734. break;
  735. case 3:
  736. percentVal = parseInt((parseFloat(task.downloadedSize) / parseFloat(task.totalSize)) * 100);
  737. show.setTitle("Loading:" + percentVal + "%");
  738. break;
  739. case 4:
  740. plus.nativeUI.closeWaiting();
  741. break;
  742. }
  743. });
  744. },
  745. },
  746. /**
  747. * 上拉加载回调函数
  748. */
  749. onReachBottom() {
  750. console.log('onReachBottom')
  751. this.page=this.page+1;
  752. this.getMeishidafjmd(0,this.page);
  753. },
  754. }
  755. </script>
  756. <style scoped lang="scss">
  757. .contentbg{
  758. margin-top: 240rpx;
  759. }
  760. .mynavbarV{
  761. position: fixed;
  762. left: 0;
  763. right: 0;
  764. top: 0;
  765. z-index: 9998;
  766. //background-color: #00A6FF;
  767. background-image: url("/static/background/indextopB.png");
  768. /* background-image: url("/static/images/wodetop.jpg"); */
  769. background-size: cover;
  770. background-position: center bottom;
  771. }
  772. .drawer{
  773. width: 100%;
  774. padding-bottom: 100rpx;
  775. position: absolute;
  776. background-color: whitesmoke;
  777. }
  778. .words{
  779. width: 100%;
  780. text-align: center;
  781. font-size: 30rpx;
  782. height: 80rpx;
  783. line-height: 80rpx;
  784. }
  785. .itemView{
  786. background-color: white;
  787. height: 80rpx;
  788. width: 100%;
  789. margin: 10rpx;
  790. padding: 16rpx;
  791. display: flex;
  792. flex-direction: row;
  793. align-items: center;
  794. justify-content:flex-start;
  795. border-radius: 20rpx;
  796. box-shadow: 0rpx 0rpx 10rpx 0rpx darkgray;
  797. }
  798. .addrV{
  799. color: black;
  800. overflow: hidden;
  801. text-overflow: ellipsis;
  802. display: -webkit-box;
  803. -webkit-line-clamp: 2;
  804. -webkit-box-orient: vertical;
  805. }
  806. .tipyLBt{
  807. font-size: 28rpx;
  808. width: 33%;
  809. border-radius: 6px 0px 0px 6px;
  810. border: 2rpx solid lightgray;
  811. line-height: 64rpx;
  812. text-align: center;
  813. color: darkgray;
  814. }
  815. .tipyMBt{
  816. font-size: 28rpx;
  817. width: 33%;
  818. border: 2rpx solid lightgray;
  819. line-height: 64rpx;
  820. text-align: center;
  821. color: darkgray;
  822. }
  823. .tipyRBt{
  824. font-size: 28rpx;
  825. width: 33%;
  826. border-radius: 0px 6px 6px 0px;
  827. border: 2rpx solid lightgray;
  828. line-height: 64rpx;
  829. text-align: center;
  830. color: darkgray;
  831. }
  832. .item_content{
  833. background: white;
  834. width: 660rpx;
  835. margin-bottom: 30rpx;
  836. padding: 16rpx;
  837. border-radius: 16rpx;
  838. }
  839. .item_list{
  840. padding-left: 40rpx;
  841. display: flex;
  842. flex-direction: row;
  843. justify-content: flex-start;
  844. }
  845. .itemA_content{
  846. width: 150rpx;
  847. height: 220rpx;
  848. margin: 16rpx 0;
  849. padding: 14rpx;
  850. box-sizing: border-box;
  851. image{
  852. width: 130rpx;
  853. height:130rpx;
  854. background-color:whitesmoke;
  855. display: block;
  856. }
  857. .title{
  858. width: 100%;
  859. text-align: center;
  860. font-size: 24rpx;
  861. line-height: 30rpx;
  862. padding-top: 4rpx;
  863. }
  864. }
  865. .mainimage{
  866. width: 660rpx;
  867. height: 330rpx;
  868. display: block;
  869. border-radius: 16rpx;
  870. background-color:floralwhite;
  871. border: 1rpx solid lightgray;
  872. }
  873. .Dishes{
  874. width: 100%;
  875. text-align: left;
  876. color: darkgray;
  877. font-size: 26rpx;
  878. }
  879. .price{
  880. width: 100%;
  881. text-align: left;
  882. //line-height: 28rpx;
  883. color: black;
  884. }
  885. .titletext{
  886. padding-top: 8rpx;
  887. width: 100%;
  888. text-align: left;
  889. }
  890. .toptext{
  891. font-size: 30rpx;
  892. }
  893. .motext{
  894. padding-top: 4rpx;
  895. padding-bottom: 4rpx;
  896. font-size: 26rpx;
  897. padding-left: 10rpx;
  898. padding-right: 10rpx;
  899. line-height: 30rpx;
  900. border-radius: 15rpx;
  901. }
  902. .notTextA{
  903. padding: 6rpx;
  904. border-radius: 6rpx;
  905. border: 1rpx solid rosybrown;
  906. color: rosybrown;
  907. margin-left: 6rpx;
  908. }
  909. </style>