index.vue 23 KB

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