OrderList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <view class="">
  3. <customNav :shownav="false"></customNav>
  4. <view class="toptalbarCtv" :style="{top: statusBarHeight+'rpx'}">
  5. <view v-if="!iszhongwen" class="toptalbar">
  6. <view v-for="(item,index) in tableList">
  7. <view :class="index==toptableindex?'tableLab textfontB4 tableselect':'tableLab textfontS1'">
  8. <text @click="tableselct(item.value,index)">{{item.text}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view v-if="iszhongwen" class="toptalbar">
  13. <view v-for="(item,index) in tableList">
  14. <view :class="index==toptableindex?'tableLabzh textfontB4 tableselect':'tableLabzh textfontS1'">
  15. <text @click="tableselct(item.value,index)">{{item.text}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="list">
  21. <view class="tips" :class="{ 'tips-ani': tipShow }">{{$t('index.liebiaogengxin')}}</view>
  22. <uni-list>
  23. <uni-list-item :border="true" class="uni-list-item--waterfall" v-for="(item,index) in orderlist" :key="index" >
  24. <view slot="body" class="shop">
  25. <view v-if="item.store" class="item_content2">
  26. <view class="buyBT" style="margin-bottom: 10rpx;">
  27. <view class="buyBTL" @click="gotoDetail(item.ddId)">
  28. <netImage width="130" height="130" bradius="65" :mysrc="item.store.logo" mymode="scaleToFill"></netImage>
  29. <view class="contentColumn">
  30. <text class="dianpuming" >{{item.store.posName}}</text>
  31. <view class="item_content2" @click="gotoDetail(item.ddId)">
  32. <view class="buyBTL">
  33. <image class="xingxing" src="/static/images/time@3x.png" mode="widthFix"></image>
  34. <text class="pingfentext">{{item.cretim}}</text>
  35. </view>
  36. <view class="buyBTL">
  37. <text class="pingfentext">{{$t('order.danhao')}}: {{item.ddId}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <text class="stateText">{{getstate(item.state,item.type)}}</text>
  43. </view>
  44. <view class="contentColumn">
  45. <view class="contentInRowR" @click="gotoDetail(item.ddId)">
  46. <text class="pingfentext">{{$t('order.gong')}} {{item.food.length}} {{$t('order.jian')}}</text>
  47. <text v-if="item.type==0" class="pingfentext" style="margin-left: 20rpx;">{{$t('order.jiner')}}: {{$formPr(item.amount)}}{{$t('locale.huobidw')}}</text>
  48. <text v-if="item.type!=0" class="pingfentext" style="margin-left: 20rpx;">{{$t('order.jiner')}}: {{$formPr(item.amount-item.freight)}}{{$t('locale.huobidw')}}</text>
  49. </view>
  50. <view class="contentInRowL">
  51. <view v-if="item.collectPayment==0" class="buyBTR">
  52. <text v-if="item.state==0" class="youhuixinxi" @click="dowithdingdan(10,item.id,item.ddId)">{{$t('order.quxiaodingdan')}}</text>
  53. <text v-if="item.state==0&&item.collectPayment==0" class="quzhifuText" @click="dowithdingdan(1,item.id,item.ddId)">{{$t('order.quzhifu')}}</text>
  54. </view>
  55. <view v-if="item.collectPayment==1" class="buyBTR">
  56. <!-- <text v-if="item.state==1" class="youhuixinxi">{{$t('order.tuikuan')}}</text> -->
  57. <text class="youhuixinxi">{{$t('index.huodaofukan')}}</text>
  58. <!-- <text v-if="item.state>=1&&item.state<5" class="youhuixinxi" @click="dowithdingdan(6,item.id,item.ddId)">{{$t('order.shenqingtuikuan')}}</text> -->
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </uni-list-item>
  65. </uni-list>
  66. <!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
  67. <uni-load-more v-if="loading || status === 'noMore' " :status="status" />
  68. <!--</unicloud-db>-->
  69. </view>
  70. <uni-popup style="z-index: 999;" ref="popzhif" type="center" :isMaskClick="true" :safeArea="true">
  71. <view class="contentColumnC" style="width: 100%;background-color: whitesmoke;">
  72. <view style="height: 40rpx;"></view>
  73. <text>{{$t('order.zhifufangshi')}}</text>
  74. <text class="zhifbut" style="background-color: deeppink;" @click="huodaofukuan">{{$t('index.huodaofukan')}}</text>
  75. <text class="zhifbut" style="background-color:#00A6FF;" @click="getVNPay">VNPAY</text>
  76. <view style="height: 40rpx;"></view>
  77. </view>
  78. </uni-popup>
  79. </view>
  80. </template>
  81. <script>
  82. import api from "@/pages/api/api.js"
  83. export default {
  84. data() {
  85. return {
  86. // 数据表名
  87. //collection: 'opendb-mall-goods',
  88. // 查询字段,多个字段用 , 分割
  89. //field: 'goods_thumb,name,goods_tip,tag,goods_price,comment_count,month_sell_count,shop_name',
  90. formData: {
  91. status: 'loading', // 加载状态
  92. },
  93. tipShow: false ,// 是否显示顶部提示框
  94. tableList:[],
  95. orderlist:[],
  96. status:'more',
  97. loading:true,
  98. typeID:'',
  99. clickable:true,
  100. toptableindex:0,
  101. state:-1,
  102. ddid:'',
  103. orderxq:'',
  104. rid:'',
  105. page:1,
  106. iszhongwen:true,
  107. statusBarHeight:0,
  108. };
  109. },
  110. onLoad() {
  111. this.tableList=[
  112. { value: -1, text: this.$t('order.quanbudd') },
  113. { value: 0, text: this.$t('order.daifukuan') },
  114. { value: 1, text: this.$t('order.yizhifu') },
  115. { value: 3, text: this.$t('order.daishouhuo')},
  116. { value: 5, text: this.$t('order.yiwancheng')},
  117. { value: 6, text: this.$t('order.shouhou') },
  118. ];
  119. //this.getorderList(1,-1);
  120. this.formData.status = 'loading'
  121. var systemInfo = uni.getSystemInfoSync();
  122. this.statusBarHeight=systemInfo.statusBarHeight*2+30;
  123. var tmpstate = uni.getStorageSync("OrderList");
  124. if(''==tmpstate||undefined==tmpstate||null==tmpstate){
  125. uni.setStorageSync("OrderList",'');
  126. }
  127. else{
  128. if(tmpstate==1){
  129. this.state=1;
  130. this.toptableindex=2;
  131. }
  132. uni.setStorageSync("OrderList",'');
  133. }
  134. },
  135. onShow() {
  136. this.tableList=[
  137. { value: -1, text: this.$t('order.quanbudd') },
  138. { value: 0, text: this.$t('order.daifukuan') },
  139. { value: 1, text: this.$t('order.yizhifu') },
  140. { value: 3, text: this.$t('order.daishouhuo')},
  141. { value: 5, text: this.$t('order.yiwancheng')},
  142. { value: 6, text: this.$t('order.shouhou') },
  143. ];
  144. this.getorderList(1,this.state);
  145. var language = uni.getStorageSync('language');
  146. if('zh-Hans'==language){
  147. this.iszhongwen = true;
  148. }
  149. else{
  150. this.iszhongwen = false;
  151. }
  152. },
  153. methods: {
  154. tableselct(id,index){
  155. this.toptableindex=index;
  156. this.state = id;
  157. if(id==3){
  158. this.state='z23412';
  159. }
  160. if(id==6){
  161. this.state='z678911';
  162. }
  163. this.getorderList(1,this.state);
  164. },
  165. gotoDetail(e){
  166. console.log(e);
  167. uni.navigateTo({
  168. url:'/pages/OrderList/OrderDetail?ddid='+e+'&isShangjia=0'
  169. })
  170. // uni.navigateTo({
  171. // url:'/pages/OrderList/MainOrderDetail/MainOrderDetail'
  172. // })
  173. },
  174. getorderList(page,state){
  175. if(state<0){
  176. state='';
  177. }
  178. console.log(state);
  179. var that = this;
  180. this.formData.status = 'more'
  181. this.tipShow = true;
  182. uni.showLoading({
  183. mask:true
  184. });
  185. if(page==1){
  186. this.orderlist=[];
  187. }
  188. api('getorderList',{
  189. page:page,
  190. size:10,
  191. state:state
  192. },res=>{
  193. uni.hideLoading();
  194. console.log(res);
  195. if(page>1){
  196. if(res.data.data&&res.data.data.length>0){
  197. var temp = this.orderlist;
  198. for(var i=0;i<res.data.data.length;i++){
  199. temp.push(res.data.data[i]);
  200. }
  201. this.orderlist=temp;
  202. }
  203. else{
  204. this.status = 'noMore';
  205. }
  206. }
  207. else{
  208. this.orderlist=res.data.data;
  209. this.status = 'more';
  210. }
  211. uni.stopPullDownRefresh()
  212. this.tipShow = false
  213. },failc=>{
  214. uni.hideLoading();
  215. uni.stopPullDownRefresh();
  216. this.tipShow = false;
  217. uni.showToast({
  218. title: that.$t('api.wangluoshibai'),
  219. icon: 'none',
  220. duration: 2500
  221. })
  222. })
  223. },
  224. getstate(state,type){
  225. //未支付 0 已支付 1 已接单 2 骑手接单3 骑手取餐4 已完成5 申请退款6 同意退款7 拒绝退款8 客服介入9 作废10
  226. switch(state){
  227. case 0:
  228. return this.$t('order.weizhifu');
  229. case 1:
  230. return this.$t('order.daishouli');
  231. case 2:
  232. return this.$t('order.daichuchan');
  233. case 3:
  234. {
  235. if(type==0){
  236. return this.$t('order.daishouhuo');
  237. }
  238. return this.$t('order.daishiyong');
  239. }
  240. case 4:
  241. {
  242. if(type==0){
  243. return this.$t('order.daishouhuo');
  244. }
  245. return this.$t('order.daishiyong');
  246. }
  247. case 5:
  248. return this.$t('order.yiwancheng');
  249. case 6:
  250. return this.$t('order.shenqingtuikuan');
  251. case 7:
  252. return this.$t('order.tongyituik');
  253. case 8:
  254. return this.$t('order.jujuetuiK');
  255. case 9:
  256. return this.$t('order.kefujs');
  257. case 10:
  258. return this.$t('order.zuofei');
  259. case 11:
  260. return this.$t('order.shouhwc');
  261. case 12:
  262. return this.$t('order.songda');
  263. }
  264. },
  265. dowithdingdan(state,id,ddid){
  266. // this.setorderuzt(1,id);
  267. // return;
  268. for(var i=0;i<this.orderlist.length;i++){
  269. this.orderxq = this.orderlist[i];
  270. if(this.orderxq.id==id){
  271. break;
  272. }
  273. }
  274. var that = this
  275. if(state==1){
  276. console.log('调用支付完成支付');
  277. // this.ddid = ddid;
  278. // this.getVNPay();//支付链接不能重复利用
  279. this.rid=id;
  280. this.ddid = ddid;
  281. this.panduanbingzhifu(state,id,ddid);
  282. }
  283. if(state==6){//申请退款
  284. if(this.orderxq.state==1){
  285. console.log('quanertuikuan');
  286. that.quanertuikuan(this.orderxq);
  287. return;
  288. }
  289. uni.showModal({
  290. cancelText:that.$t('order.quxiao'),
  291. confirmText:that.$t('comp.queren'),
  292. title: that.$t('api.message'),
  293. content: that.$t('order.shifoushenq')+that.orderxq.ddId+that.$t('order.dingdantk')+'?',
  294. success: function (res) {
  295. if (res.confirm) { //这里是点击了确定以后
  296. that.setorderuzt(6,that.orderxq.id);
  297. } else { //这里是点击了取消以后
  298. console.log('用户点击取消')
  299. }
  300. }
  301. })
  302. return;
  303. }
  304. if(state==10){
  305. uni.showModal({
  306. cancelText:that.$t('order.quxiao'),
  307. confirmText:that.$t('comp.queren'),
  308. title: that.$t('api.message'),
  309. content: that.$t('order.shifouqx')+ddid+'?',
  310. success: function (res) {
  311. if (res.confirm) { //这里是点击了确定以后
  312. that.setorderuzt(state,id);
  313. } else { //这里是点击了取消以后
  314. console.log('用户点击取消')
  315. }
  316. }
  317. })
  318. }
  319. },
  320. panduanbingzhifu(state,id,ddid){
  321. console.log('panduanbingzhifu11111')
  322. this.$refs.popzhif.open('bottom');
  323. },
  324. setorderuzt(state,ddid){
  325. api('setorderuzt',{
  326. id:ddid,
  327. state:state
  328. },res=>{
  329. this.getorderList(1,this.state);
  330. },failc=>{
  331. //console.log('getadvertis----',failc)
  332. })
  333. },
  334. huodaofukuan(){
  335. this.$refs.popzhif.close();
  336. uni.showLoading({
  337. title:'Loading...',
  338. mask:true
  339. })
  340. api('setorderuzt',{
  341. id:this.rid,
  342. "collectPayment":1
  343. },res=>{
  344. console.log('setorderuzt:',res)
  345. uni.hideLoading();
  346. if(res.data.code==200){
  347. this.getorderList(1,this.state);
  348. }
  349. else{
  350. uni.showToast({
  351. title: res.data.msg,
  352. icon: 'none',
  353. duration: 2000
  354. })
  355. }
  356. },failc=>{
  357. uni.hideLoading();
  358. //console.log('getadvertis----',failc)
  359. })
  360. },
  361. getVNPay(){
  362. this.$refs.popzhif.close();
  363. },
  364. quanertuikuan(obj){
  365. console.log('quanertuikuan');
  366. api('VNtuikuan',{
  367. "order_id": obj.ddId, //需要退款的订单号
  368. "amount": parseInt(obj.amount), //退款金额
  369. "trantype": '02', //退款类型:02全额退款,03部份退款
  370. 'illustrate':'全额退款',
  371. "transaction":'' //交易号,不存在可为空
  372. },res=>{
  373. console.log('VNtuikuan',res);
  374. if(res.data.code==200){
  375. if(res.data.data.vnp_ResponseCode=='00'){
  376. uni.showToast({
  377. title:this.$t('order.tuikuanchg'),
  378. icon: 'none',
  379. duration: 2500
  380. })
  381. this.setorderuzt(7,obj.id);
  382. }else if(res.data.data.vnp_ResponseCode=='94'){
  383. uni.showToast({
  384. title:this.$t('order.tuikuanchg'),
  385. icon: 'none',
  386. duration: 2500
  387. })
  388. this.setorderuzt(7,obj.id);
  389. }
  390. else{
  391. uni.showToast({
  392. title: res.data.data.vnp_Message,
  393. icon: 'none',
  394. duration: 2500
  395. })
  396. }
  397. }
  398. else{
  399. uni.showToast({
  400. title: res.data.msg,
  401. icon: 'none',
  402. duration: 2500
  403. })
  404. }
  405. },failc=>{
  406. console.log('VNtuikuan',failc)
  407. })
  408. },
  409. },
  410. /**
  411. * 下拉刷新回调函数
  412. */
  413. onPullDownRefresh() {
  414. this.getorderList(1,this.state);
  415. this.page=1;
  416. },
  417. /**
  418. * 上拉加载回调函数
  419. */
  420. onReachBottom() {
  421. console.log('onReachBottom')
  422. this.page=this.page+1;
  423. this.getorderList(this.page,this.state);
  424. },
  425. };
  426. </script>
  427. <style lang="scss">
  428. @import '@/common/uni-ui.scss';
  429. page {
  430. display: flex;
  431. flex-direction: column;
  432. box-sizing: border-box;
  433. background-color: #efeff4;
  434. min-height: 100%;
  435. height: auto;
  436. }
  437. .toptalbarCtv{
  438. position: fixed;
  439. background-color: white;
  440. left: 0;
  441. right: 0;
  442. top: 0;
  443. z-index: 999;
  444. }
  445. .toptalbar{
  446. display: flex;
  447. flex-direction: row;
  448. justify-content:space-between;
  449. align-items: center;
  450. background-color: whitesmoke;
  451. padding-top: 20rpx;
  452. height: 64rpx;
  453. }
  454. .tableLab{
  455. text-align: center;
  456. margin-left: 14rpx;
  457. margin-right: 14rpx;
  458. height: 64rpx;
  459. color: darkgray;
  460. }
  461. .tableLabzh{
  462. text-align: center;
  463. margin-left: 14rpx;
  464. margin-right: 14rpx;
  465. height: 60rpx;
  466. color: darkgray;
  467. }
  468. .tableselect{
  469. border-bottom-width: 6rpx;
  470. border-bottom-style:solid;
  471. border-bottom-color:#40AE36;
  472. color: #40AE36;
  473. }
  474. .tips {
  475. margin-top: 90rpx;
  476. color: #67c23a;
  477. font-size: 14px;
  478. line-height: 40px;
  479. text-align: center;
  480. background-color: #f0f9eb;
  481. height: 0;
  482. opacity: 0;
  483. transform: translateY(-100%);
  484. transition: all 0.3s;
  485. }
  486. .tips-ani {
  487. transform: translateY(0);
  488. height: 40px;
  489. opacity: 1;
  490. }
  491. .shop {
  492. flex: 1;
  493. display: flex;
  494. flex-direction: column;
  495. justify-content: space-between;
  496. }
  497. // 默认加入 scoped ,所以外面加一层提升权重
  498. .list {
  499. .uni-list--waterfall {
  500. /* #ifndef H5 || APP-VUE */
  501. // 小程序 编译后会多一层标签,而其他平台没有,所以需要特殊处理一下
  502. /deep/ .uni-list {
  503. /* #endif */
  504. display: flex;
  505. flex-direction: row;
  506. flex-wrap: wrap;
  507. padding: 5rpx;
  508. box-sizing: border-box;
  509. /* #ifdef H5 || APP-VUE */
  510. // h5 和 app-vue 使用深度选择器,因为默认使用了 scoped ,所以样式会无法穿透
  511. /deep/
  512. /* #endif */
  513. .uni-list-item--waterfall {
  514. width: 50%;
  515. box-sizing: border-box;
  516. .uni-list-item__container {
  517. padding: 0rpx;
  518. flex-direction: column;
  519. }
  520. }
  521. /* #ifndef H5 || APP-VUE */
  522. }
  523. /* #endif */
  524. }
  525. }
  526. .item_content2{
  527. background: white;
  528. display: flex;
  529. flex-direction: column;
  530. width: 100%;
  531. }
  532. .buyct{
  533. display: flex;
  534. flex-direction: row;
  535. justify-content:flex-start;
  536. align-items: center;
  537. }
  538. .storeimage{
  539. width: 100%;
  540. height: 240rpx;
  541. }
  542. .buyimage{
  543. width: 200rpx;
  544. height: 160rpx;
  545. }
  546. .buyBT{
  547. display: flex;
  548. flex-direction: row;
  549. justify-content:space-between;
  550. align-items: center;
  551. }
  552. .buyBTR{
  553. display: flex;
  554. flex-direction: row;
  555. justify-content:flex-end;
  556. align-items: center;
  557. }
  558. .buyBTL{
  559. display: flex;
  560. flex-direction: row;
  561. justify-content:flex-start;
  562. align-items: center;
  563. }
  564. .msText{
  565. padding-left: 10rpx;
  566. text-align: left;
  567. font-size: 22rpx;
  568. line-height: 32rpx;
  569. width: 100%;
  570. }
  571. .dianpuming{
  572. font-size: 30rpx;
  573. line-height: 32rpx;
  574. height: 32rpx;
  575. font-weight: bold;
  576. }
  577. .xingxing{
  578. width: 30rpx;
  579. height: 30rpx;
  580. }
  581. .pingfentext{
  582. font-size: 26rpx;
  583. line-height: 40rpx;
  584. height: 40rpx;
  585. color:black;
  586. }
  587. .spnametext{
  588. font-size: 26rpx;
  589. line-height: 40rpx;
  590. height: 40rpx;
  591. padding-right: 20rpx;
  592. color:darkgray;
  593. }
  594. .youhuixinxi{
  595. font-size: 30rpx;
  596. padding: 6rpx;
  597. padding-left: 12rpx;
  598. padding-right: 12rpx;
  599. background-color: #F1F1F1;
  600. color: black;
  601. border-radius: 16rpx;
  602. margin-left: 20rpx;
  603. }
  604. .quzhifuText{
  605. font-size: 30rpx;
  606. padding: 6rpx;
  607. padding-left: 12rpx;
  608. padding-right: 12rpx;
  609. background-color: black;
  610. color: white;
  611. border-radius: 16rpx;
  612. margin-left: 20rpx;
  613. }
  614. .stateText{
  615. font-size: 26rpx;
  616. color: darkgray;
  617. }
  618. .zhifbut{
  619. text-align:center;
  620. margin-top: 12rpx;
  621. margin-bottom: 12rpx;
  622. width:660upx;
  623. border-radius: 10rpx;
  624. color: white;
  625. line-height: 70rpx;
  626. }
  627. </style>