mindex.vue 21 KB

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