dingdanjiesuan.vue 21 KB

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