foodlistItem.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <view style="">
  3. <view style="width: 100%;" v-for="(item,index) in orderlist" >
  4. <view class="spnodetail">
  5. <view style="width: 100%;" @click="gotoDetail(item.ddId)">
  6. <view class="actBTV" >
  7. <view class="textfontB4" style="margin-left: 20rpx;">{{item.ddId}}</view>
  8. <view v-if="item.type==0" class="textfontB4" style="color: brown;margin-right: 30rpx;">{{$t('order.peisong')}}</view>
  9. <view v-if="item.type==1" class="textfontB4" style="color: brown;margin-right: 30rpx;">{{$t('order.ziqu')}}</view>
  10. <view v-if="item.type==2" class="textfontB4" style="color: brown;margin-right: 30rpx;">{{$t('shouye.tangshi')}}</view>
  11. </view>
  12. <view class="actBTV">
  13. <text v-if="item.collectPayment==1" class="jiedanBtdf">{{$t('index.huodaofukan')}}</text>
  14. <text v-if="item.collectPayment!=1" class="jiedanBtdf">線上付款</text>
  15. <view class="textfontB4" style="color: blueviolet;margin-left: 20rpx;">{{$t('order.dingdanjin')}}: {{getspjr(item)}}{{$t('locale.huobidw')}}</view>
  16. </view>
  17. <!-- <view v-if="item.type==0" class="actBTV">
  18. <view class="textfontB4" style="color: blueviolet;margin-left: 20rpx;">{{$t('order.dingdanjin')}}: {{getspjr(item)}}{{$t('locale.huobidw')}}</view>
  19. <view v-if="item.state>0" class="xiaoji textfontB4" style="color: brown;">{{$t('order.yizhifu')}}</view>
  20. <view v-if="item.state==0" class="xiaoji textfontB4" style="color: brown;">{{$t('order.weizhifu')}}</view>
  21. </view> -->
  22. <view v-if="item.activity" class="actBTV">
  23. <view class="contentInRowL" style="margin-left:20rpx;">
  24. <text class="textfontB4">{{$t('index.youhuiq')}}: </text>
  25. <text class="textfontB4" style="padding-left: 20rpx;">{{item.activity.salesName}}</text>
  26. </view>
  27. <text class="xiaoji textfontB4">{{getyhjr(item)}}</text>
  28. </view>
  29. <view class="actBTV" >
  30. <view class="textfontB4" style="color: brown;margin-left: 20rpx;">{{$t('order.xiadanshijian')}}: {{item.cretim}}</view>
  31. </view>
  32. <view v-if="item.type==0" class="actBTV" >
  33. <view v-if="item.delryTime!=''" class="textfontB4" style="color: blueviolet;margin-left: 20rpx;">{{$t('order.yuyueshijian')}}: {{item.delryTime}}</view>
  34. </view>
  35. <view v-for="(itemf,index) in item.food" >
  36. <view class="contentInRowL bottomline">
  37. <!-- <myImage class="spIcon" :mysrc="itemf.image" mymode="scaleToFill" ></myImage> -->
  38. <netImage class="spIcon" width="90" height="90" bradius="4" :mysrc="itemf.image" mymode="scaleToFill"></netImage>
  39. <view class="contentColumn">
  40. <text class="textfontB3">{{itemf.name}}</text>
  41. <view class="contentInRowS">
  42. <view class="contentInRowL ">
  43. <text class="kouweisku textfontB3">{{arraytoStr(itemf.ask)}}</text>
  44. </view>
  45. <text class="textfontB3">{{itemf.number}}({{$t('order.jian')}})</text>
  46. </view>
  47. <view v-if="item.beizhu" class="">
  48. <text style="font-size: 30rpx;color:#00A6FF;">{{item.beizhu}}</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view v-if="item.delryTime!=''" class="actBTV">
  54. <text class="kouweisku textfontB3" style="margin-left: 20rpx;">{{$t('order.yuyueshijian')}}</text>
  55. <view>
  56. <text class="kouweisku textfontB3" style="margin-right: 30rpx;">{{item.delryTime}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. <view v-if="item.activity" class="contentColumnC psfnote">
  61. <text v-if="item.activity.salesType!=0" class="textfontB5" style="color:white;padding: 6rpx;">{{$t('order.sjyhts')}}</text>
  62. </view>
  63. <view class="contentInRowC actView">
  64. <text v-if="item.state==1" class="acttext textfontB3" @click="dowithdingdan(2,item)">{{$t('order.shouli')}}</text>
  65. <text v-if="item.state==0&&item.collectPayment==1" class="acttext textfontB3" @click="dowithdingdan(2,item)">{{$t('order.shouli')}}</text>
  66. <text v-if="item.diningStatus==0&&(item.state==2||item.state==3)" class="acttext textfontB3" @click="dowithdingdan(-3,item)">{{$t('order.chuchan')}}</text>
  67. <text v-if="item.diningStatus==1&&(item.state==2||item.state==3)&&item.type!=1" class="acttextB textfontB3">{{$t('order.peisongquchan')}}</text>
  68. <text v-if="item.type==1&&item.diningStatus==1&&item.collectPayment==1&&(item.state==2||item.state==3)" class="acttext textfontB3" @click="dowithdingdan(-4,item)">{{$t('order.shoukuan')}}</text>
  69. <text v-if="item.state==4" class="acttextB textfontB3" >{{$t('order.peisongzhong')}}</text>
  70. <text v-if="item.state==5" class="acttextB textfontB3" >{{$t('order.yiwancheng')}}</text>
  71. <text v-if="item.state==6&&item.collectPayment!=1" class="acttext textfontB3" @click="dowithdingdan(7,item)">{{$t('order.shifoutyjj')}}</text>
  72. <text v-if="item.state==7" class="acttextB textfontB3" >{{$t('order.yituikuan')}}</text>
  73. <text v-if="item.state==8" class="acttextB textfontB3" >{{$t('order.jujuetuiK')}}</text>
  74. <text v-if="item.state==9" class="acttextB textfontB3" >{{$t('order.kefujs')}}</text>
  75. <text v-if="item.state==11" class="acttextB textfontB3" >{{$t('order.shouhwc')}}</text>
  76. <text v-if="item.state==12" class="acttextB textfontB3" >{{$t('order.songda')}}</text>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 提示窗示例 -->
  81. <uni-popup ref="alertDialog" type="dialog" :isMaskClick="true" @maskClick="maskClick">
  82. <uni-popup-dialog type="NOMLE" :cancelText="quxiao" :confirmText="queren" :title="noteMsg.title" :content="noteMsg.msg" @confirm="dialogConfirm"
  83. @close="dialogClose"></uni-popup-dialog>
  84. </uni-popup>
  85. <view>
  86. <uni-popup ref="popPay" type="center" :isMaskClick="truefalse" :safeArea="truefalse">
  87. <tuikanPop :refund_fee="refund_fee" v-on:Etuikanresult="tuikanresult"></tuikanPop>
  88. </uni-popup>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import api from "@/pages/api/api.js"
  94. export default {
  95. name:"foodlistItem",
  96. props:{
  97. orderlist:''
  98. },
  99. data() {
  100. return {
  101. atcText:'',
  102. noteMsg:{
  103. title:'',
  104. msg:''
  105. },
  106. quxiao:'',
  107. queren:'',
  108. state:-1,
  109. rid:-1,
  110. truefalse:true,
  111. refundObj:'',
  112. refund_fee:0
  113. };
  114. },
  115. watch:{
  116. orderlist(val){
  117. ;
  118. }
  119. },
  120. methods:{
  121. getspjr(obj){
  122. var jinr=0;
  123. var yunfei = 0;
  124. if(obj.type!=0){
  125. yunfei=obj.freight;
  126. }
  127. if(obj.activity){
  128. if(obj.activity.salesType=="0"){
  129. if(obj.discountAmount){
  130. if(yunfei>obj.discountAmount){
  131. jinr=obj.amount-(yunfei-obj.discountAmount);
  132. }
  133. else{
  134. jinr =obj.amount-yunfei;
  135. }
  136. }else{
  137. jinr =obj.amount-yunfei;
  138. }
  139. }
  140. else{
  141. jinr =obj.amount-yunfei;
  142. }
  143. }
  144. else{
  145. jinr =obj.amount-yunfei;
  146. }
  147. jinr=parseInt(jinr);
  148. return this.$formPr(jinr);
  149. },
  150. getyhjr(obj){
  151. var jinr=0;
  152. if(obj.discountAmount){
  153. jinr=obj.discountAmount;
  154. }
  155. jinr=parseInt(jinr);
  156. return '-'+this.$formPr(jinr)+this.$t('locale.huobidw');
  157. },
  158. arraytoStr(arry){
  159. var str='';
  160. if(arry.length>0){
  161. for(var i=0;i<arry.length;i++){
  162. str=str+arry[i]+'; ';
  163. }
  164. }
  165. return str;
  166. },
  167. gotoDetail(e){
  168. console.log(e);
  169. uni.navigateTo({
  170. url:'/pages/OrderList/OrderDetail?ddid='+e+'&isShangjia=1'
  171. })
  172. },
  173. getOrderType(type){
  174. if(type==0){
  175. this.ordertypename=this.$t('order.peisong');
  176. }
  177. else if(type==1){
  178. this.ordertypename=this.$t('order.ziqu');
  179. }
  180. else{
  181. this.ordertypename=this.$t('shouye.tangshi');
  182. }
  183. },
  184. dowithdingdan(state,obj){
  185. var note='';
  186. this.quxiao=this.$t('index.quxiao');
  187. this.queren=this.$t('index.queren');
  188. switch(state){
  189. case 2:
  190. note=this.$t('mend.shifoushouli')+obj.ddId+'?';
  191. this.noteMsg.title=this.$t('order.shouli');
  192. this.noteMsg.msg=note;
  193. break;
  194. case -3:
  195. note=this.$t('mend.shifwanch')+obj.ddId+'?';
  196. this.noteMsg.title=this.$t('order.chuchan');
  197. this.noteMsg.msg=note;
  198. this.refundObj=obj;
  199. break;
  200. case -4:
  201. note=this.$t('mend.shifwcshk')+obj.ddId+'?';
  202. this.noteMsg.title=this.$t('order.shoukuan');
  203. this.noteMsg.msg=note;
  204. break;
  205. case 7://退款
  206. this.refundObj=obj;
  207. this.refund_fee=obj.amount;
  208. this.$refs.popPay.open('center');
  209. return;
  210. }
  211. this.state=state;
  212. this.rid=obj.id;
  213. this.$refs.alertDialog.open('center');
  214. },
  215. dialogConfirm() {
  216. console.log('点击确认')
  217. if(this.state==-3){
  218. this.upchucanState(this.rid);
  219. }
  220. else if(this.state==-4){
  221. this.upstoreorderState(5,this.rid);
  222. }else{
  223. this.upstoreorderState(this.state,this.rid);
  224. }
  225. },
  226. dialogClose() {
  227. console.log('点击取消')
  228. },
  229. maskClick(){
  230. console.log('maskClick');
  231. this.$refs.alertDialog.close();
  232. },
  233. upstoreorderState(state,ddid){
  234. api('setorderuzt',{
  235. id:ddid,
  236. state:state
  237. },
  238. r=>{
  239. console.log('gengxintoken',r)
  240. if(r.data.code==200){
  241. this.$emit('ERefresh');
  242. }
  243. else{
  244. uni.showToast({
  245. title:r.data.msg,
  246. icon: 'none',
  247. duration: 2500
  248. })
  249. }
  250. },failc=>{
  251. });
  252. },
  253. upchucanState(ddid){
  254. api('setorderuzt',{
  255. id:ddid,
  256. state:this.refundObj.state,
  257. diningStatus:1
  258. },
  259. r=>{
  260. console.log('gengxintoken',r)
  261. this.$emit('ERefresh');
  262. },failc=>{
  263. });
  264. },
  265. tuikanresult(refund_fee){
  266. this.$refs.popPay.close();
  267. if(refund_fee==-1){//取消
  268. return;
  269. }
  270. if(refund_fee==-2){//拒绝退款
  271. this.upstoreorderState(8,this.refundObj.id);
  272. return;
  273. }
  274. if(this.refundObj.collectPayment==1){
  275. this.upstoreorderState(10,this.refundObj.id);
  276. return;
  277. }
  278. this.quanertuikuan(refund_fee);
  279. },
  280. //部分退款
  281. quanertuikuan(refund_fee){
  282. console.log('quanertuikuan');
  283. api('setorderuzt',{
  284. 'order_id':this.refundObj.ddId, //需要退款的订单号
  285. 'amount': parseInt(refund_fee), //退款金额
  286. 'trantype': '03', //退款类型:02全额退款,03部份退款
  287. 'illustrate':'部分退款',
  288. 'trans_date':'20231218114102',
  289. "transaction":'14248219' //交易号,不存在可为空
  290. },
  291. res=>{
  292. console.log('gengxintoken',r)
  293. if(res.data.code==200){
  294. if(res.data.data.vnp_ResponseCode=='00'){
  295. uni.showToast({
  296. title:this.$t('order.tuikuanchg'),
  297. icon: 'none',
  298. duration: 2500
  299. })
  300. this.upstoreorderState(7,this.refundObj.id);
  301. }else if(res.data.data.vnp_ResponseCode=='94'){
  302. uni.showToast({
  303. title:this.$t('order.tuikuanchg'),
  304. icon: 'none',
  305. duration: 2500
  306. })
  307. this.upstoreorderState(7,this.refundObj.id);
  308. }
  309. else{
  310. uni.showToast({
  311. title: res.data.data.vnp_Message,
  312. icon: 'none',
  313. duration: 2500
  314. })
  315. }
  316. }
  317. else{
  318. uni.showToast({
  319. title: res.data.msg,
  320. icon: 'none',
  321. duration: 2500
  322. })
  323. }
  324. },failc=>{
  325. });
  326. },
  327. }
  328. }
  329. </script>
  330. <style>
  331. .actBTV{
  332. width: 100%;
  333. margin-top: 10rpx;
  334. display: flex;
  335. flex-direction: row;
  336. justify-content:space-between;
  337. align-items: center;
  338. }
  339. .psfnote{
  340. width: 92%;
  341. margin-left: 4%;
  342. margin-top: 16rpx;
  343. border-radius: 10rpx;
  344. background-color: crimson;
  345. margin-bottom: 16rpx;
  346. }
  347. .spnodetail{
  348. display: flex;
  349. flex-direction: column;
  350. align-items: flex-start;
  351. margin-top: 16rpx;
  352. background-color: whitesmoke;
  353. border-radius: 16rpx;
  354. }
  355. .spIcon{
  356. margin: 20rpx;
  357. width: 90rpx;
  358. height: 90rpx;
  359. }
  360. .xiaoji{
  361. margin-left: auto;
  362. margin-right: 30rpx;
  363. }
  364. .kouweisku{
  365. color: chocolate;
  366. padding-right: 12rpx;
  367. }
  368. .actView{
  369. width: 100%;
  370. height: 76rpx;
  371. background-color:lavender;
  372. border-radius: 0 0 16rpx 16rpx;
  373. }
  374. .acttext{
  375. color: #006AFF;
  376. width: 100%;
  377. text-align: center;
  378. }
  379. .acttextB{
  380. color: #1A1A1A;
  381. width: 100%;
  382. text-align: center;
  383. }
  384. .jiedanBt{
  385. padding: 10rpx;
  386. color:white;
  387. background-color: #006AFF;
  388. border-radius: 8rpx;
  389. box-shadow: 0rpx 0rpx 10rpx 0rpx #006AFF;
  390. }
  391. .jiedanBtdf{
  392. margin-left: 20rpx;
  393. font-size: 26rpx;
  394. padding: 10rpx;
  395. color:white;
  396. background-color: #1A1A1A;
  397. border-radius: 8rpx;
  398. box-shadow: 0rpx 0rpx 2rpx 0rpx #1A1A1A;
  399. }
  400. .bottomline{
  401. border:solid darkgray;
  402. border-width: 0rpx 0rpx 1rpx 0rpx;
  403. margin-top: 10rpx;
  404. }
  405. </style>