dingdanjiesuan.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  1. <template>
  2. <view class="contentV">
  3. <customNav :shownav="true" :title="$t('index.xiadanzhifu')" titledetl=""></customNav>
  4. <view class="ctinrow">
  5. <view class="topSwichV" :style="{backgroundColor:Bcolor}" @click="peisong">
  6. <view class="contentColumnC">
  7. <image class="toppz" src="/static/images/bianzu1.png" mode="widthFix"></image>
  8. <text class="toppztext" :style="{color:Tcolor}">{{$t('order.peisong')}}</text>
  9. </view>
  10. </view>
  11. <view class="topSwichV" :style="{backgroundColor:Bcolorr}" @click="ziqu">
  12. <view class="contentColumnC">
  13. <image class="toppz" src="/static/images/mendianziqu.png" mode="widthFix"></image>
  14. <text class="toppztext" :style="{color:Tcolorr}">{{$t('order.ziqu')}}</text>
  15. </view>
  16. </view>
  17. <view class="topSwichV" :style="{backgroundColor:Bcolorrr}" @click="tangshi">
  18. <view class="contentColumnC">
  19. <image class="toppz" src="/static/images/tangshih.png" mode="widthFix"></image>
  20. <text class="toppztext" :style="{color:Tcolorrr}">{{$t('shouye.tangshi')}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. <text class="linesp"></text>
  25. <view v-if="showAdrr==0" class="contentColumn contentSpace">
  26. <view class="contentInRowL" style="align-items: start;" @click="changaddr">
  27. <image style="width: 60rpx;height: 44rpx;" src="/static/images/dizhil@3x.png" mode=""></image>
  28. <text class="textfontB5">{{dizhiID.address}}</text>
  29. </view>
  30. <view class="contentInRowL">
  31. <text class="textfontB5" style="color: darkgray;margin-left: 44rpx;margin-top: 10rpx;">{{dizhiID.name}} {{dizhiID.phone}}</text>
  32. </view>
  33. </view>
  34. <view v-if="showAdrr==2" class="contentInRowR" style="margin-top: 20rpx;width: 92%;margin-bottom: 20rpx;" @click="inputZuohao">
  35. <text style="color:black;font-size: 28rpx;margin-right: 16rpx;">用餐桌號</text>
  36. <text v-if="zuohao.length==0" style="font-weight: bold;color: black;font-size: 34rpx;text-decoration: underline;">用餐桌號?</text>
  37. <text v-if="zuohao.length!=0" style="font-weight: bold;color: black;font-size: 34rpx;text-decoration: underline;">{{zuohao}}</text>
  38. </view>
  39. <text class="linesp"></text>
  40. <text class="linesp"></text>
  41. <uni-list>
  42. <uni-list-item :title="$t('index.goodslist')"></uni-list-item>
  43. </uni-list>
  44. <view v-for="(items,indexs) in gouwuche">
  45. <view class="contentInRowL" style="align-items: center;">
  46. <netImage style="margin-left: 12rpx;margin-top: 10rpx;" width="60" height="60" bradius="30" :mysrc="items.logo" mymode="scaleToFill"></netImage>
  47. <text style="margin-left: 10rpx;margin-right: 10rpx;">{{items.posName}}</text>
  48. </view>
  49. <view v-for="(item,findex) in items.food">
  50. <view class="spnodetail">
  51. <view class="">
  52. <myImage class="spIcon" :mysrc="item.image" mymode="scaleToFill"></myImage>
  53. </view>
  54. <view style="width: 82%;">
  55. <view class="actBTV">
  56. <view style="font-size: 30rpx;width: 100%;">
  57. <text class="text2row" style="width: 100%;">{{item.name}}</text>
  58. </view>
  59. <view class="contentInRowL">
  60. <image v-if="item.number>0" class="imageRJ" src="/static/meishi/jianh.png" mode="aspectFit" @click="jiajian(indexs,findex,-1)"></image>
  61. <text v-if="item.number>0" class="textR">{{item.number}}</text>
  62. <image class="imageR" src="/static/meishi/jiah.png" mode="aspectFit" @click="jiajian(indexs,findex,1)"></image>
  63. </view>
  64. </view>
  65. <view class="actBTV">
  66. <view style="font-size: 26rpx;color: blueviolet;">{{$t('shangpin.shoujia')}}: {{$formPr(item.price+item.otherPrice)}}{{$t('locale.huobidw')}}</view>
  67. <view class="xiaoji" style="font-size: 28rpx;color: brown;">{{$t('shangpin.xiaoji')}}: {{$formPr((item.price+item.otherPrice)*item.number)}}{{$t('locale.huobidw')}}</view>
  68. </view>
  69. <view class="viewinrow" >
  70. <text class="kouweisku">{{arraytoStr(item.ask)}}</text>
  71. </view>
  72. <view v-if="item.beizhu" class="">
  73. <text style="font-size: 30rpx;color:#00A6FF;">{{item.beizhu}}</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <text class="linesp"></text>
  80. <text class="linesp"></text>
  81. <view class="contentInRowS shifdf" @click="shifodaofu">
  82. <view class="contentInRowC">
  83. <image style="width: 50rpx;height: 50rpx;" src="/static/images/payflact@3x.png" mode="scaleToFill"></image>
  84. <text class="shifdftext" :style="shifoudf==0?'color:darkgray;':'color:fuchsia;'">{{$t('index.huodaofukan')}}</text>
  85. </view>
  86. <image v-if="shifoudf==1" style="width: 50rpx;height: 50rpx;" src="/static/images/dagoul.png" mode="scaleToFill"></image>
  87. </view>
  88. <text class="linesp"></text>
  89. <text class="linesp"></text>
  90. <uni-list>
  91. <uni-list-item :title="$t('order.beizhu')"></uni-list-item>
  92. </uni-list>
  93. <textarea class="pinglun" :placeholder="$t('order.srddbz')" :value="remarks" @input="sumfontnum"></textarea>
  94. <text class="linesp"></text>
  95. <text class="linesp"></text>
  96. <uni-list>
  97. <uni-list-item :title="$t('order.shangpinxj')" :rightText="$formPr(spxj)+$t('locale.huobidw')" />
  98. <uni-list-item :title="$t('order.peisongfei')" :rightText="$formPr(psf)+$t('locale.huobidw')"/>
  99. <uni-list-item :title="$t('order.youhuijine')" :rightText="$formPr(hyyh)+$t('locale.huobidw')"/>
  100. </uni-list>
  101. <text class="linesp"></text>
  102. <text class="linesp"></text>
  103. <uni-list>
  104. <uni-list-item :title="$t('order.zhifujine')" :rightText="$formPr(zje)+$t('locale.huobidw')"/>
  105. </uni-list>
  106. <text class="linesp"></text>
  107. <text class="linesp"></text>
  108. <view class="delbtct">
  109. <view class="delbt" @click="qufukuan">
  110. <text >{{actTitle}}</text>
  111. </view>
  112. </view>
  113. <text class="linesp"></text>
  114. <popViewGG :tips="$t('order.zhifufangshi')" :show="zffsS" :showbotom="false" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
  115. <view class="contentColumnC" style="width: 100%;background-color: whitesmoke;">
  116. <view class="zhifbut" style="background-color: deeppink;" @click="huodaofukuan">{{$t('index.huodaofukan')}}</view>
  117. </view>
  118. </popViewGG>
  119. <uni-popup ref="alertDialog" type="dialog">
  120. <uni-popup-dialog ref="inputClose" mode="input" title="用餐桌號" :value="zuohao" :placeholder="inputNote" :confirmText="$t('comp.queren')" :cancelText="$t('order.quxiao')" @confirm="dialogConfirm"></uni-popup-dialog>
  121. </uni-popup>
  122. </view>
  123. </template>
  124. <script>
  125. import api from "@/pages/api/api.js"
  126. export default {
  127. data() {
  128. return {
  129. userid:0,
  130. ddId:'',
  131. rId:'',
  132. showAdrr:0,
  133. gouwuche:[],
  134. Bcolor:'lightgreen',
  135. Bcolorr:'lightgray',
  136. Bcolorrr:'lightgray',
  137. Tcolor:'black',
  138. Tcolorr:'darkgray',
  139. Tcolorrr:'darkgray',
  140. actTitle:this.$t('order.querendd'),
  141. actType:0,
  142. remarks:'',
  143. spxj:0.00,
  144. psf:0.00,
  145. hyyh:0.00,
  146. zje:0.00,
  147. jvli:0.00,
  148. dizhiID:'',
  149. addrList:[],
  150. isGetyunfei:false,
  151. orderDetl:'',
  152. shifoudf:1,
  153. scale:1,
  154. mpImage:'',
  155. showpop:false,
  156. zffsS:false,
  157. keyixd:true,
  158. zuohao:'',
  159. inputNote:'請填寫桌號'
  160. }
  161. },
  162. onLoad(option) {
  163. var gwc = uni.getStorageSync('gouwuche');
  164. if(''==gwc||null==gwc||undefined==gwc){
  165. this.gouwuche=[];
  166. return
  167. }
  168. else{
  169. this.gouwuche = JSON.parse(gwc);
  170. this.jisuanjiner();
  171. }
  172. this.userid=option.userid;
  173. },
  174. onShow() {
  175. var temp=uni.getStorageSync("peisongdizhi");
  176. if(undefined==temp||null==temp||''==temp ){
  177. this.dizhiID='';
  178. this.getaddressList();
  179. }
  180. else{
  181. this.dizhiID= temp;
  182. this.mpImage=this.dizhiID.annexes;
  183. }
  184. this.isGetyunfei = false;
  185. if(this.dizhiID==''){
  186. this.getaddressList();
  187. }
  188. else{
  189. console.log('4444')
  190. this.kaishichuliyunfei();
  191. }
  192. },
  193. methods: {
  194. //----------------------------------------------------------------------------
  195. //选择配送、堂食、自取
  196. peisong(){
  197. if(this.actType>0){
  198. return;
  199. }
  200. this.showAdrr=0;
  201. this.Bcolor='lightgreen';
  202. this.Bcolorr='lightgray';
  203. this.Bcolorrr='lightgray';
  204. this.Tcolor='black';
  205. this.Tcolorr='darkgray';
  206. this.Tcolorrr='darkgray';
  207. this.jisuanjiner();
  208. },
  209. ziqu(){
  210. if(this.actType>0){
  211. return;
  212. }
  213. this.showAdrr=1;
  214. this.Bcolor='lightgray';
  215. this.Bcolorr='lightgreen';
  216. this.Bcolorrr='lightgray';
  217. this.Tcolor='darkgray';
  218. this.Tcolorr='black';
  219. this.Tcolorrr='darkgray';
  220. this.psf=0;
  221. this.jisuanjiner();
  222. },
  223. tangshi(){
  224. this.showAdrr=2;
  225. this.Bcolor='lightgray';
  226. this.Bcolorr='lightgray';
  227. this.Bcolorrr='lightgreen';
  228. this.Tcolor='darkgray';
  229. this.Tcolorr='darkgray';
  230. this.Tcolorrr='black';
  231. this.psf=0;
  232. this.jisuanjiner();
  233. },
  234. inputZuohao(){
  235. this.$refs.alertDialog.open('center');
  236. },
  237. dialogConfirm(name){
  238. console.log(name);
  239. this.zuohao = name;
  240. },
  241. //地址管理
  242. changaddr(){
  243. uni.navigateTo({
  244. url:'/pages/UserCenter/dizhi/dizhilist'
  245. })
  246. },
  247. getaddressList(){
  248. api('getaddressList',{
  249. },r=>{
  250. this.addrList=r.data.data;
  251. console.log(this.addrList);
  252. if(this.dizhiID!=''){
  253. console.log('3333')
  254. // this.kaishichuliyunfei();
  255. }
  256. else{
  257. if(this.addrList.length>0){
  258. console.log('2222')
  259. this.dizhiID=this.addrList[0];
  260. this.mpImage=this.dizhiID.annexes;
  261. this.kaishichuliyunfei();
  262. }
  263. }
  264. },failc=>{
  265. //console.log('getadvertis----',failc)
  266. })
  267. },
  268. peisongfangshi(){
  269. },
  270. selectImage(){
  271. console.log('selectImage');
  272. this.$refs.yhdslCropper.chooseImage();
  273. },
  274. uploadImg(e) {
  275. console.log('------------uploadImg:',e)
  276. this.spImage = e;
  277. var that = this;
  278. uni.uploadFile({
  279. url: this.$upImagurl, //上传图片api
  280. filePath: e,
  281. name: 'file',
  282. header:{
  283. //"Authorization": userinfo.token
  284. },
  285. success: (res) => {
  286. let group = JSON.parse(res.data);
  287. that.mpImage=group.data;
  288. console.log(group)
  289. api('ADDaddress',{
  290. id:that.dizhiID.id,
  291. annexes:that.mpImage
  292. },
  293. res=>{
  294. if(res.data.code==200){
  295. that.dizhiID.annexes=that.mpImage;
  296. uni.setStorageSync("peisongdizhi",that.dizhiID);
  297. }
  298. console.log('getGoodsDetail:',res);
  299. },failc=>{
  300. //console.log('getadvertis----',failc)
  301. })
  302. uni.showToast({
  303. title:that.$t('mend.shangccg'),
  304. icon:"success"
  305. })
  306. }
  307. });
  308. },
  309. //商品编辑
  310. jiajian(indexs,index,state){//调整商品数量
  311. if(this.actType>0){
  312. return;
  313. }
  314. var goumail=this.gouwuche[indexs].food[index].number;
  315. goumail=goumail+state;
  316. if(goumail==0){
  317. this.gouwuche[indexs].food.splice(index,1);
  318. if(this.gouwuche[indexs].food.length==0){
  319. this.gouwuche.splice(indexs,1);
  320. this.jisuanjiner();
  321. return;
  322. }
  323. }
  324. else{
  325. this.gouwuche[indexs].food[index].number=goumail;
  326. }
  327. console.log(goumail);
  328. var goumaijine = 0;
  329. for (var j=0;j<this.gouwuche[indexs].food.length;j++) {
  330. var food = this.gouwuche[indexs].food[j];
  331. var yidongjine=food.number*(parseFloat(food.price)+parseFloat(food.otherPrice));
  332. goumaijine = goumaijine+yidongjine;
  333. }
  334. this.gouwuche[indexs].foodAmount=goumaijine;
  335. this.jisuanjiner();
  336. },
  337. jisuanjiner(){
  338. if(this.isGetyunfei&&this.showAdrr==0){
  339. this.yunfeiheji();
  340. }
  341. else{
  342. this.psf=0;
  343. }
  344. this.spxj = 0;
  345. for(var i=0;i<this.gouwuche.length;i++){
  346. var item = this.gouwuche[i];
  347. var yidongjine=item.foodAmount;
  348. this.spxj = this.spxj+yidongjine;
  349. this.gouwuche[i].type=this.showAdrr;//订单类型:0外送,1自取,2堂食
  350. }
  351. this.hyyh=0;
  352. this.zje=0;
  353. this.hyyh=parseInt(this.hyyh);
  354. this.zje=(this.spxj+this.psf)-this.hyyh;
  355. this.zje=parseInt(this.zje);
  356. },
  357. //支付方式
  358. shifodaofu(){
  359. return;
  360. if(this.actType>1){
  361. return;
  362. }
  363. if(this.shifoudf==0){
  364. this.shifoudf=1;
  365. }
  366. else{
  367. this.shifoudf=0;
  368. }
  369. if(this.actType==1&&this.shifoudf==1){
  370. this.actTitle = this.$t('index.huodaofukan');
  371. uni.showToast({
  372. title: this.$t('order.xuanzezhif'),
  373. icon: 'none',
  374. duration: 2500
  375. })
  376. }
  377. else if(this.actType==1&&this.shifoudf==0){
  378. this.actTitle = this.$t('order.quzhifu');
  379. }
  380. console.log(this.shifoudf)
  381. },
  382. sumfontnum(e){
  383. this.remarks=e.target.value;
  384. },
  385. chooseCancel(){//关闭弹框
  386. this.showpop=false;
  387. this.zffsS=false;
  388. console.log('chooseCancel');
  389. },
  390. arraytoStr(arry){//数组拼接字符串
  391. var str='';
  392. if(arry.length>0){
  393. for(var i=0;i<arry.length;i++){
  394. str=str+arry[i]+'; ';
  395. }
  396. }
  397. return str;
  398. },
  399. qufukuan(){//点击去付款
  400. if(this.gouwuche.length==0){
  401. uni.showToast({
  402. title: this.$t('comp.qingxzsp'),
  403. icon: 'none',
  404. duration: 2500
  405. })
  406. return;
  407. }
  408. if(this.keyixd==false){
  409. uni.showToast({
  410. title: this.$t('mend.dianjiastatedy'),
  411. icon: 'none',
  412. duration: 2500
  413. })
  414. return;
  415. }
  416. if(this.actType==2){//已经支付过了!!
  417. return;
  418. }
  419. if(this.actType==1){//未支付,跳转支付
  420. this.zffsS=true;
  421. return;
  422. }
  423. var data;
  424. if(this.ddId.length>0){
  425. console.log('已经生成订单,不能重复提交');
  426. }
  427. else{
  428. this.ddId='99'+ new Date().valueOf();
  429. }
  430. var cretim=getApp().globalData.sj();
  431. var dizhi = '';
  432. if(this.showAdrr==0){
  433. if(this.dizhiID==''){
  434. uni.showToast({
  435. title: this.$t('order.shdz'),
  436. icon: 'none',
  437. duration: 3500
  438. })
  439. return;
  440. }
  441. if(!this.isGetyunfei){
  442. uni.showToast({
  443. title: this.$t('order.hqyfsb'),
  444. icon: 'none',
  445. duration: 3500
  446. })
  447. return;
  448. }
  449. dizhi = this.dizhiID.id
  450. this.zuohao = '';
  451. }
  452. if(this.showAdrr==1){
  453. this.zuohao = '';
  454. }
  455. if(this.showAdrr==2){
  456. }
  457. data={
  458. "ddId":this.ddId,//单号
  459. "shdzId":dizhi, //收货地址ID
  460. "tableNum":this.zuohao, //桌号
  461. "totalAmount":this.zje,//订单金额
  462. "actualPayAmount":this.zje,//实付金额
  463. "paymentMethod":"1",//支付方式1货到付款,
  464. "items":this.gouwuche,//商品清单
  465. "xiadanjiaoyan":2,//下单版本校验
  466. "type":this.showAdrr,
  467. "remarks":this.remarks,//订单的整单备注
  468. };
  469. console.log(getApp().globalData.token);
  470. this.addorder(data);
  471. },
  472. addorder(data){
  473. var that = this;
  474. uni.showLoading({
  475. title:'Loading...',
  476. mask:true
  477. })
  478. console.log('createOrder',data);
  479. api('createOrder',data,
  480. r=>{
  481. console.log(r);
  482. uni.hideLoading();
  483. if(r.data.code==200){
  484. this.qingkonggouwuche();
  485. this.ddId=data.ddId;
  486. this.rId=r.data.data.id;
  487. this.orderDetl=r.data.data;
  488. if(this.shifoudf==0){
  489. this.actType = 1;
  490. this.zffsS=true;
  491. //跳转订单详情页
  492. uni.redirectTo({
  493. url:'/pages/OrderList/MainOrderDetail/MainOrderDetail?ddid='+this.ddId
  494. })
  495. }
  496. else{
  497. this.actType = 1;
  498. this.actTitle = that.$t('index.huodaofukan');
  499. //到付订单,直接更新支付状态
  500. //跳转订单详情页
  501. uni.redirectTo({
  502. url:'/pages/OrderList/MainOrderDetail/MainOrderDetail?ddid='+this.ddId
  503. })
  504. }
  505. }
  506. else{
  507. uni.showToast({
  508. title: r.data.msg,
  509. icon: 'none',
  510. duration: 2000
  511. })
  512. }
  513. },failc=>{
  514. uni.hideLoading();
  515. //console.log('getadvertis----',failc)
  516. })
  517. },
  518. huodaofukuan(){//货到付款
  519. this.shifoudf=1;
  520. this.zffsS=false;
  521. uni.showLoading({
  522. title:'Loading...',
  523. mask:true
  524. })
  525. var that = this;
  526. api('setorderuzt',{
  527. id:this.rId,
  528. "collectPayment":this.shifoudf
  529. },res=>{
  530. console.log('setorderuzt:',res)
  531. uni.hideLoading();
  532. if(res.data.code==200){
  533. this.actType = 2;
  534. this.actTitle = that.$t('order.yizhifu');
  535. uni.redirectTo({
  536. url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
  537. })
  538. }
  539. else{
  540. if(res.data.msg){
  541. uni.showToast({
  542. title: res.data.msg,
  543. icon: 'none',
  544. duration: 2000
  545. })
  546. }
  547. }
  548. },failc=>{
  549. uni.hideLoading();
  550. //console.log('getadvertis----',failc)
  551. })
  552. },
  553. setorderuzt(){
  554. var that = this;
  555. api('setorderuzt',{
  556. id:this.rId,
  557. state:1
  558. },res=>{
  559. this.actType = 2;
  560. this.actTitle = that.$t('order.yizhifu');
  561. uni.redirectTo({
  562. url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
  563. })
  564. },failc=>{
  565. //console.log('getadvertis----',failc)
  566. })
  567. },
  568. getorderDetl(){
  569. var that = this;
  570. api('getorderxq',{
  571. ddid:this.ddId
  572. },r=>{
  573. this.orderDetl=r.data.data;
  574. if(this.orderDetl.state==1){
  575. that.actType = 2;
  576. that.actTitle = that.$t('order.yizhifu');
  577. uni.redirectTo({
  578. url:'/pages/OrderList/OrderDetail?ddid='+this.ddId+'&isShangjia=0'
  579. })
  580. }
  581. },failc=>{
  582. //console.log('getadvertis----',failc)
  583. })
  584. },
  585. qingkonggouwuche(){
  586. uni.setStorageSync('gouwuche','');
  587. return;
  588. },
  589. //计算运费
  590. kaishichuliyunfei(){
  591. this.isGetyunfei = false;
  592. for(var i=0;i<this.gouwuche.length;i++){
  593. this.jisuanJuli(i);
  594. }
  595. },
  596. jisuanJuli(index){
  597. var item = this.gouwuche[index];
  598. var that = this;
  599. var latlng1=''+this.dizhiID.latitude+','+this.dizhiID.longitude;
  600. var latlng2=''+item.lat+','+item.lng;
  601. // var latlng1='10.715641,106.73932';//''+lat+','+lng;
  602. // var latlng2='10.754999,106.735601';//''+this.mendianMs.latitude+','+this.mendianMs.longitude;
  603. api('getluxianjvli',{
  604. latlng1:latlng1,
  605. latlng2:latlng2,
  606. id:this.userid
  607. },r=>{
  608. console.log('getjuliForyunfeiHT',r);
  609. if(r.data.code==200){
  610. if(r.data.data[0]){
  611. var legs =r.data.data[0].legs;
  612. if(legs[0]){
  613. var juli = legs[0].distance.value;
  614. console.log("juli:",juli);
  615. item.jvli = juli;
  616. that.gouwuche[index] = item;
  617. that.jisuanyunfei(index)
  618. return;
  619. }
  620. }
  621. }
  622. },failc=>{
  623. //console.log('getadvertis----',failc)
  624. })
  625. },
  626. jisuanyunfei(index){
  627. var item = this.gouwuche[index];
  628. var that = this;
  629. api('getZuiyyfei',{
  630. quli:JSON.stringify(item.jvli)
  631. },r=>{
  632. console.log(r);
  633. if(r.data.code!=200){
  634. return;
  635. }
  636. var yunfei = parseInt(r.data.data.freight);
  637. if(yunfei>0){
  638. }
  639. else{
  640. yunfei=0;
  641. }
  642. item.freight = yunfei;
  643. item.amount = item.foodAmount + yunfei;
  644. that.gouwuche[index] = item;
  645. if(index==that.gouwuche.length-1){
  646. that.yunfeiheji();
  647. this.jisuanjiner();
  648. }
  649. },failc=>{
  650. //console.log('getadvertis----',failc)
  651. })
  652. },
  653. yunfeiheji(){
  654. this.psf = 0;
  655. for(var i=0;i<this.gouwuche.length;i++){
  656. var item = this.gouwuche[i];
  657. this.psf =this.psf+ item.freight;
  658. }
  659. console.log("this.psf:",this.psf);
  660. this.isGetyunfei = true;
  661. },
  662. //-----------------------------------------------------------------------------
  663. }
  664. }
  665. </script>
  666. <style lang="scss">
  667. page{
  668. background-color: #F2F3F7;
  669. }
  670. .contentSpace{
  671. margin-left:4%;
  672. margin-top: 20rpx;
  673. width: 92%;
  674. margin-bottom: 20rpx;
  675. }
  676. .contentV{
  677. width:100%;
  678. position: relative;
  679. }
  680. .linesp{
  681. width:100%;
  682. height: 8rpx;
  683. background-color: aliceblue;
  684. }
  685. .pinglun{
  686. margin: 16rpx;
  687. padding: 10rpx;
  688. width:92%;
  689. height: 100rpx;
  690. border-radius: 15rpx;
  691. border: 2rpx solid lightgray;
  692. }
  693. .delbtct{
  694. margin-left: 10%;
  695. margin-top: 20rpx;
  696. padding-bottom: 30rpx;
  697. width:80%;
  698. }
  699. .delbt{
  700. text-align: center;
  701. font-size: 36rpx;
  702. width:100%;
  703. height: 80rpx;
  704. line-height: 80rpx;
  705. color: white;
  706. background-color:#40AE36;
  707. border-radius: 10rpx;
  708. }
  709. .ctinrow{
  710. margin-top: 20rpx;
  711. margin-left: 10%;
  712. width:80%;
  713. height: 140rpx;
  714. display: flex;
  715. flex-direction:row;
  716. align-items: center;
  717. justify-content: space-between;
  718. }
  719. .topSwichV{
  720. height: 110rpx;
  721. width: 110rpx;
  722. border-radius: 10rpx;
  723. display: flex;
  724. flex-direction: row;
  725. align-items: center;
  726. justify-content: center;
  727. padding: 5rpx;
  728. }
  729. .toppz{
  730. width: 80rpx;
  731. }
  732. .toppztext{
  733. font-size: 30rpx;
  734. }
  735. .spnodetail{
  736. display: flex;
  737. flex-direction: row;
  738. align-items: center;
  739. background-color: white;
  740. margin-top: 20rpx;
  741. margin-bottom: 20rpx;
  742. margin-left: 20rpx;
  743. }
  744. .spIcon{
  745. margin: 20rpx;
  746. width: 90rpx;
  747. height: 90rpx;
  748. }
  749. .xiaoji{
  750. margin-left: auto;
  751. margin-right: 30rpx;
  752. }
  753. .actBTV{
  754. width: 100%;
  755. display: flex;
  756. flex-direction: row;
  757. justify-content:space-between;
  758. align-items: center;
  759. }
  760. .viewinrow{
  761. display: flex;
  762. flex-direction: row;
  763. align-items: center;
  764. width: 100%;
  765. }
  766. .kouweisku{
  767. padding-right: 10rpx;
  768. color: chocolate;
  769. font-size: 26rpx;
  770. }
  771. .shifdf{
  772. height: 90rpx;
  773. width: 90%;
  774. margin-left: 5%;
  775. align-items: center;
  776. }
  777. .shifdftext{
  778. margin-left: 30rpx;
  779. font-size: 30rpx;
  780. }
  781. .picker-view {
  782. width: 750rpx;
  783. height: 300rpx;
  784. margin-top: 10rpx;
  785. }
  786. .item {
  787. line-height: 100rpx;
  788. text-align: center;
  789. }
  790. .zhifbut{
  791. text-align:center;
  792. margin-top: 12rpx;
  793. margin-bottom: 12rpx;
  794. width: 80%;
  795. border-radius: 10rpx;
  796. color: white;
  797. line-height: 70rpx;
  798. }
  799. .imageRJ{
  800. width: 40rpx;
  801. height: 40rpx;
  802. margin-right: 8rpx;
  803. }
  804. .imageR{
  805. width: 40rpx;
  806. height: 40rpx;
  807. margin-right: 30rpx;
  808. }
  809. .textR{
  810. font-size: 26rpx;
  811. margin-left: 6rpx;
  812. margin-right: 6rpx;
  813. }
  814. </style>