OrderDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <view class="">
  3. <customNav :shownav="true" :title="$t('index.orderxq')" titledetl=""></customNav>
  4. <!-- <view class="mapcontent" :style="'height:'+mapHeight+'rpx;'">
  5. <mapView :pcovers="pcovers"></mapView>
  6. </view>
  7. <view class="contentV" :style="'margin-top:'+mapHeight+'rpx;'"> -->
  8. <view class="contentV">
  9. <label class="linesp"></label>
  10. <uni-list>
  11. <uni-list-item :title="posName" thumb="/static/images/shouye.png" thumb-size="sm" :rightText="ordertypename" ></uni-list-item>
  12. <uni-list-item v-if="orderxq.collectPayment==1" :title="$t('index.huodaofukan')" :rightText="$t('api.shi')"/>
  13. <uni-list-item v-if="orderxq.collectPayment==0" :title="$t('index.huodaofukan')" :rightText="$t('api.fou')"/>
  14. <uni-list-item :title="$t('order.zhuangtai')" :rightText="stateName"/>
  15. </uni-list>
  16. <view v-for="item in food">
  17. <view class="spnodetail">
  18. <view class="">
  19. <netImage class="spIcon" width="90" height="90" bradius="4" :mysrc="item.image" mymode="scaleToFill"></netImage>
  20. </view>
  21. <view style="width: 100%;">
  22. <view class="actBTV">
  23. <view style="font-size: 30rpx;">{{item.name}}</view>
  24. <view style="font-size: 28rpx;color: brown;margin-right: 30rpx;">X {{item.number}}</view>
  25. </view>
  26. <view class="actBTV">
  27. <view style="font-size: 26rpx;color: blueviolet;">{{$t('shangpin.shoujia')}}: {{$formPr(item.price+item.otherPrice)}}{{$t('locale.huobidw')}}</view>
  28. <view class="xiaoji" style="font-size: 28rpx;color: brown;">{{$t('shangpin.xiaoji')}}: {{$formPr((item.price+item.otherPrice)*item.number)}}{{$t('locale.huobidw')}}</view>
  29. </view>
  30. <view class="viewinrow" >
  31. <view class="kouweisku">{{arraytoStr(item.ask)}}</view>
  32. </view>
  33. <view v-if="item.beizhu" class="">
  34. <text style="font-size: 30rpx;color:#00A6FF;">{{item.beizhu}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <label class="linesp"></label>
  40. <uni-list v-if="ordertype==0">
  41. <!-- <uni-list-item :title="$t('index.peisongdizhi')" :rightText="address"/>
  42. <uni-list-item :title="$t('order.shoujianren')" :rightText="name"/>
  43. <uni-list-item :title="$t('order.lianxidianhua')" :rightText="phone"/> -->
  44. <uni-list-item :title="$t('order.yuyueshijian')" :rightText="orderxq.delryTime" />
  45. </uni-list>
  46. <uni-list v-if="ordertype!=0">
  47. <!-- <uni-list-item :title="$t('order.mendiandiz')" :rightText="address"/>
  48. <uni-list-item :title="$t('order.lianxidianhua')" :rightText="phone"/> -->
  49. <uni-list-item :title="$t('order.yuyueshijian')" :rightText="orderxq.delryTime" />
  50. </uni-list>
  51. <text class="linesp"></text>
  52. <uni-list>
  53. <uni-list-item :title="$t('order.shangpinxj')" :rightText="$formPr(spxji)+$t('locale.huobidw')" />
  54. <uni-list-item :title="$t('index.youhuiq')" :rightText="getcxname()"></uni-list-item>
  55. <uni-list-item :title="$t('order.youhuijine')" :rightText="getyhjr(orderxq)"/>
  56. <uni-list-item :title="$t('order.dingdanjin')" :rightText="getspjr(orderxq)"/>
  57. </uni-list>
  58. <view v-if="orderxq.activity" class="contentColumnC psfnote">
  59. <text v-if="orderxq.activity.salesType!=0" class="textfontB5" style="color:white;padding: 6rpx;">{{$t('order.sjyhts')}}</text>
  60. </view>
  61. <text class="linesp"></text>
  62. <uni-list>
  63. <!-- <uni-list-item :title="$t('order.dingdanxx')" thumb-size="sm"></uni-list-item> -->
  64. <uni-list-item :title="$t('order.danhao')+':'" :rightText="ddid" />
  65. <!-- <uni-list-item :title="$t('order.zhifufangshi')" rightText=""/> -->
  66. <uni-list-item :title="$t('order.xiadanshijian')" :rightText="cretim"/>
  67. </uni-list>
  68. <label class="linesp"></label>
  69. </view>
  70. <view v-if="orderxq.remarks!=''" class="contentInRowL contentV">
  71. <view class="contentColumn">
  72. <text class="textfontB4">{{$t('order.beizhu')}}:</text>
  73. <text class="pinglun textfontB5">{{orderxq.remarks}}</text>
  74. </view>
  75. </view>
  76. <view style="height: 40rpx;"></view>
  77. <view>
  78. <uni-popup ref="popPay" type="center" :isMaskClick="truefalse" :safeArea="truefalse">
  79. <tuikanPop :refund_fee="refund_fee" v-on:Etuikanresult="tuikanresult"></tuikanPop>
  80. </uni-popup>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. import {
  86. setorderuzt,
  87. VNtuikuan
  88. } from '@/pages/api/basic.js';
  89. import api from "@/pages/api/api.js"
  90. import uniList from '@/uni_modules/uni-list/uni-list.vue';
  91. import uniListItem from '@/uni_modules/uni-list-item/uni-list-item.vue';
  92. import uniAd from '@/uni_modules/uni-list-ad/uni-list-ad.vue';
  93. import uniChat from '@/uni_modules/uni-list-chat/uni-list-chat.vue';
  94. import popv from '@/pages/component/popViewA/popViewA.vue';
  95. export default {
  96. components:{
  97. uniList,uniListItem,uniAd,uniChat,popv
  98. },
  99. data() {
  100. return {
  101. ddid:'',
  102. orderxq:[],
  103. state:0,
  104. stateName:'',
  105. posName:'',
  106. telphone:'',
  107. food:[],
  108. amount:0,
  109. address:'',
  110. name:'',
  111. phone:'',
  112. Id:'',
  113. cretim:'',
  114. spxji:0,
  115. peisongfei:0,
  116. isshangjia:0,
  117. mendid:'',
  118. ordertype:0,
  119. mapHeight:0,
  120. pcovers:'',
  121. ordertypename:'',
  122. truefalse:true,
  123. refund_fee:0
  124. }
  125. },
  126. onLoad(option) {
  127. this.ddid = option.ddid;
  128. this.isshangjia = option.isShangjia;
  129. this.getstoreorderxq();
  130. var info = uni.getSystemInfoSync();
  131. console.log(info);
  132. this.mapHeight=info.windowHeight/2;
  133. },
  134. onShow() {
  135. },
  136. methods: {
  137. getcxname(){
  138. if(this.orderxq.activity){
  139. return this.orderxq.activity.salesName;
  140. }
  141. return '';
  142. },
  143. getspjr(obj){
  144. var jinr=0;
  145. var yunfei = 0;
  146. if(obj.type!=0){
  147. yunfei=obj.freight;
  148. }
  149. if(obj.activity){
  150. if(obj.activity.salesType=="0"){
  151. if(obj.discountAmount){
  152. if(yunfei>obj.discountAmount){
  153. jinr=obj.amount-(yunfei-obj.discountAmount);
  154. }
  155. else{
  156. jinr =obj.amount-yunfei;
  157. }
  158. }else{
  159. jinr =obj.amount-yunfei;
  160. }
  161. }
  162. else{
  163. jinr =obj.amount-yunfei;
  164. }
  165. }
  166. else{
  167. jinr =obj.amount-yunfei;
  168. }
  169. jinr=parseInt(jinr);
  170. return this.$formPr(jinr)+this.$t('locale.huobidw');
  171. },
  172. getyhjr(obj){
  173. var jinr=0;
  174. if(obj.discountAmount){
  175. jinr=obj.discountAmount;
  176. }
  177. jinr=parseInt(jinr);
  178. return '-'+this.$formPr(jinr)+this.$t('locale.huobidw');
  179. },
  180. arraytoStr(arry){
  181. var str='';
  182. if(arry.length>0){
  183. for(var i=0;i<arry.length;i++){
  184. str=str+arry[i]+'; ';
  185. }
  186. }
  187. return str;
  188. },
  189. getstoreorderxq(){
  190. api('getorderxq',{
  191. ddid:this.ddid
  192. },
  193. r=>{
  194. this.orderxq=r.data.data
  195. console.log('1---------1:',this.orderxq);
  196. this.dowithddxq();
  197. },failc=>{
  198. });
  199. },
  200. dowithddxq(){
  201. this.state=this.orderxq.state;
  202. this.posName=this.orderxq.store.posName;
  203. this.telphone = this.orderxq.store.telephone;
  204. this.food=this.orderxq.food;
  205. this.amount=this.orderxq.amount;
  206. this.peisongfei=this.orderxq.freight;
  207. if(this.orderxq.shaddress){
  208. this.address=this.orderxq.shaddress.address;
  209. this.name=this.orderxq.shaddress.name;
  210. this.phone=this.orderxq.shaddress.phone;
  211. }
  212. this.Id=this.orderxq.id;
  213. this.cretim=this.orderxq.cretim;
  214. this.spxji = 0;
  215. this.mendid = this.orderxq.store.id;
  216. for (var i=0;i<this.food.length;i++) {
  217. var item = this.food[i];
  218. this.spxji=this.spxji+(item.price+item.otherPrice)*item.number;
  219. }
  220. if(''==this.orderxq.delryTime||undefined==this.orderxq.delryTime||null==this.orderxq.delryTime){
  221. this.orderxq.delryTime=this.$t('order.jinkuaichuc');
  222. }
  223. this.dowithOrderstate();
  224. this.dowithMap();
  225. },
  226. dowithOrderstate(){
  227. switch(this.state){
  228. case 0:
  229. this.stateName = this.$t('order.daifukshij') +'14:28';
  230. break;
  231. case 1:
  232. this.stateName = this.$t('order.daishouli');
  233. break;
  234. case 2:
  235. this.stateName = this.$t('order.yishouli');
  236. break;
  237. case 3:
  238. this.stateName = this.$t('order.peisongzhong');
  239. break;
  240. case 4:
  241. this.stateName = this.$t('order.peisongzhong');
  242. break;
  243. case 5:
  244. this.stateName = this.$t('order.yiwancheng');
  245. break;
  246. case 6:
  247. this.stateName = this.$t('order.shenqingtuikuan');
  248. break;
  249. case 7:
  250. this.stateName = this.$t('order.tongyituik');
  251. break;
  252. case 8:
  253. this.stateName = this.$t('order.jujuetuiK');
  254. break;
  255. case 9:{
  256. if(this.orderxq.kefuState==0){
  257. this.stateName = this.$t('order.kefujs');
  258. break;
  259. }
  260. else{
  261. if(this.orderxq.kefuRepeat==0){
  262. if(this.orderxq.kefuState==0){
  263. this.stateName = this.$t('order.shouhwc');
  264. break;
  265. }
  266. if(this.orderxq.kefuState==1){
  267. this.stateName = this.$t('order.yishouli');
  268. break;
  269. }
  270. if(this.orderxq.kefuState==2){
  271. this.stateName = this.$t('order.daishouli');
  272. break;
  273. }
  274. }
  275. else{
  276. if(this.orderxq.repeatDdId){
  277. this.stateName = this.$t('order.chongpaidd')+':'+this.orderxq.repeatDdId;
  278. break;
  279. }
  280. else{
  281. this.stateName = this.$t('order.chongpaidd');
  282. break;
  283. }
  284. }
  285. }
  286. }
  287. case 10:
  288. this.stateName = this.$t('order.zuofei');
  289. break;
  290. case 11:
  291. this.stateName = this.$t('order.shouhwc');
  292. break
  293. case 12:
  294. this.stateName=this.$t('order.songda');
  295. break;
  296. }
  297. if(this.orderxq.type==0){
  298. this.ordertype = 0;
  299. this.ordertypename=this.$t('order.peisong');
  300. }
  301. else if(this.orderxq.type==1){
  302. this.ordertype = 1;
  303. this.ordertypename=this.$t('order.ziqu');
  304. if(this.state==3||this.state==4){
  305. this.stateName = this.$t('order.daiqucan');
  306. }
  307. }
  308. else{
  309. this.ordertype = 2;
  310. this.ordertypename=this.$t('shouye.tangshi');
  311. if(this.state==3||this.state==4){
  312. this.stateName = this.$t('order.daiqucan');
  313. }
  314. }
  315. },
  316. dowithMap(){
  317. this.pcovers=[{
  318. latitude: 39.909,
  319. longitude: 116.39742,
  320. iconPath: '/static/images/dizhil@3x.png'
  321. }, {
  322. latitude: 39.90,
  323. longitude: 116.39,
  324. iconPath: '/static/images/dizhil@3x.png'
  325. }]
  326. },
  327. callPhone(){
  328. var that = this;
  329. uni.showModal({
  330. title: that.$t('api.message'),
  331. content:that.$t('api.nqdbddh'),
  332. cancelText: that.$t('order.quxiao'), // 取消按钮的文字
  333. confirmText: that.$t('comp.queren'), // 确认按钮的文字
  334. success: function (res) {
  335. if (res.confirm) { //这里是点击了确定以后
  336. console.log(that.mendianMs.telphone)
  337. plus.device.dial(that.mendianMs.telphone, false );
  338. } else { //这里是点击了取消以后
  339. console.log('点击取消')
  340. }
  341. }
  342. })
  343. },
  344. choosebt(index){
  345. switch(index){
  346. case 1://去支付
  347. this.choosePay();
  348. break;
  349. case 2://修改订单
  350. break;
  351. case 3://取消订单
  352. var that = this;
  353. uni.showModal({
  354. title: that.$t('api.message'),
  355. content: that.$t('order.shifouqx')+ddid+that.$t('index.order')+'?',
  356. cancelText: that.$t('order.quxiao'), // 取消按钮的文字
  357. confirmText: that.$t('comp.queren'), // 确认按钮的文字
  358. success: function (res) {
  359. if (res.confirm) { //这里是点击了确定以后
  360. that.setorderuzt(10,that.Id);
  361. } else { //这里是点击了取消以后
  362. console.log('用户点击取消')
  363. }
  364. }
  365. })
  366. break;
  367. case 4://发表评论
  368. //this.setorderuzt(3,this.Id);
  369. uni.navigateTo({
  370. url:'/pages/OrderList/pinglun?mendid='+this.mendid+'&ddId='+this.ddid
  371. })
  372. break;
  373. case 5://申请退款
  374. this.refund_fee=this.amount;
  375. this.$refs.popPay.open('center');
  376. break;
  377. case 6://联系商家
  378. break;
  379. }
  380. },
  381. setorderuzt(state,id){
  382. api('setorderuzt',{
  383. id:id,
  384. state:state
  385. },
  386. r=>{
  387. this.getstoreorderxq();
  388. },failc=>{
  389. //console.log('getadvertis----',failc)
  390. });
  391. },
  392. tuikanresult(refund_fee){
  393. this.$refs.popPay.close();
  394. if(refund_fee==-1){//取消
  395. return;
  396. }
  397. if(refund_fee==-2){//拒绝退款
  398. this.setorderuzt(8,this.Id);
  399. return;
  400. }
  401. if(this.orderxq.collectPayment==1){
  402. this.setorderuzt(10,this.Id);
  403. return;
  404. }
  405. this.quanertuikuan(refund_fee);
  406. },
  407. //部分退款
  408. quanertuikuan(refund_fee){
  409. console.log('quanertuikuan');
  410. api('VNtuikuan',{
  411. "order_id": this.ddid, //需要退款的订单号
  412. "amount": parseInt(refund_fee), //退款金额
  413. "trantype": '03', //退款类型:02全额退款,03部份退款
  414. 'illustrate':'部分退款',
  415. "transaction":'' //交易号,不存在可为空
  416. },
  417. res=>{
  418. console.log('VNtuikuan',res);
  419. if(res.data.code==200){
  420. if(res.data.data.vnp_ResponseCode=='00'){
  421. uni.showToast({
  422. title:this.$t('order.tuikuanchg'),
  423. icon: 'none',
  424. duration: 2500
  425. })
  426. this.setorderuzt(7,this.Id);
  427. }else if(res.data.data.vnp_ResponseCode=='94'){
  428. uni.showToast({
  429. title:this.$t('order.tuikuanchg'),
  430. icon: 'none',
  431. duration: 2500
  432. })
  433. this.setorderuzt(7,this.Id);
  434. }
  435. else{
  436. uni.showToast({
  437. title: res.data.data.vnp_Message,
  438. icon: 'none',
  439. duration: 2500
  440. })
  441. }
  442. }
  443. else{
  444. uni.showToast({
  445. title: res.data.msg,
  446. icon: 'none',
  447. duration: 2500
  448. })
  449. }
  450. },failc=>{
  451. //console.log('getadvertis----',failc)
  452. });
  453. },
  454. }
  455. }
  456. </script>
  457. <style>
  458. page{
  459. background-color: #F2F3F7;
  460. }
  461. .mapcontent{
  462. position: fixed;
  463. left: 0;
  464. right: 0;
  465. top: 120rpx;
  466. z-index: 999;
  467. }
  468. .psfnote{
  469. width: 92%;
  470. margin-left: 4%;
  471. margin-top: 16rpx;
  472. border-radius: 10rpx;
  473. background-color: crimson;
  474. margin-bottom: 16rpx;
  475. }
  476. .contentV{
  477. margin-top: 30rpx;
  478. width:94%;
  479. margin-left: 3%;
  480. }
  481. .viewinrow{
  482. display: flex;
  483. flex-direction: row;
  484. align-items: center;
  485. }
  486. .topActV{
  487. width: 100%;
  488. height: 280rpx;
  489. background-color: white;
  490. }
  491. .topActVB{
  492. width: 100%;
  493. height: 260rpx;
  494. background-color: white;
  495. }
  496. .notext{
  497. padding-top: 10rpx;
  498. padding-left: 20rpx;
  499. font-size: 40rpx;
  500. color: #000;
  501. font-weight:bold;
  502. }
  503. .nodetail{
  504. height: 48rpx;
  505. margin-left: 10rpx;
  506. margin-right: 10rpx;
  507. margin-top: 10rpx;
  508. padding-left: 2rpx;
  509. flex-direction: row;
  510. align-items: center;
  511. justify-content: flex-start;
  512. background-color: #F1F1F1;
  513. font-size: 30rpx;
  514. }
  515. .xingimage{
  516. width: 36rpx;
  517. height: 36rpx;
  518. }
  519. .actBTV{
  520. width: 100%;
  521. display: flex;
  522. flex-direction: row;
  523. justify-content:space-between;
  524. align-items: center;
  525. }
  526. .actbt{
  527. width: 32%;
  528. height: 100rpx;
  529. margin-top: 10rpx;
  530. align-items: center;
  531. justify-content: center;
  532. }
  533. .ddbticon{
  534. margin-top: 16rpx;
  535. width: 100%;
  536. height: 80rpx;
  537. display: flex;
  538. align-items: center;
  539. justify-content: center;
  540. }
  541. .ddtext{
  542. margin-top: 14rpx;
  543. text-align: center;
  544. font-size: 26rpx;
  545. color: black;
  546. }
  547. .bticon{
  548. width: 60rpx;
  549. height: 60rpx;
  550. }
  551. .spnodetail{
  552. display: flex;
  553. flex-direction: row;
  554. align-items: center;
  555. background-color: white;
  556. margin-top: 10rpx;
  557. margin-bottom: 10rpx;
  558. }
  559. .spIcon{
  560. margin: 20rpx;
  561. width: 90rpx;
  562. height: 90rpx;
  563. }
  564. .xiaoji{
  565. margin-left: auto;
  566. margin-right: 30rpx;
  567. }
  568. .kouweisku{
  569. padding-left: 10rpx;
  570. color: chocolate;
  571. font-size: 26rpx;
  572. }
  573. .linesp{
  574. width: 100%;
  575. height: 8rpx;
  576. background-color: aliceblue;
  577. }
  578. .buyGoodsv{
  579. width: 100%;
  580. text-align: left;
  581. height: 60rpx;
  582. line-height: 60rpx;
  583. padding-left: 10rpx;
  584. flex-direction: row;
  585. align-items: center;
  586. justify-content: center;
  587. }
  588. .stattypeD{
  589. color: black;
  590. font-weight: bold;
  591. font-size: 26rpx;
  592. margin-left: 10rpx;
  593. }
  594. .stattypeA{
  595. color: darkgray;
  596. font-size: 26rpx;
  597. margin-left: 10rpx;
  598. }
  599. .stattype{
  600. font-size: 26rpx;
  601. margin-left: auto;
  602. margin-right: 40rpx;
  603. }
  604. .pinglun{
  605. margin: 16rpx;
  606. padding: 10rpx;
  607. width:660upx;
  608. border-radius: 15rpx;
  609. border: 2rpx solid lightgray;
  610. }
  611. </style>