orderCard.vue 5.36 KB
<template>
	<view class="orderCard" @click="goOrderDetaPage">
		<view class="flex justify-between align-center">
			<view class="flex align-center w80" @click.stop="goStorePage">
<!--				<u-icon name="/static/images/home/shopTitle.png" size="20"></u-icon>-->
        <view :style="{ backgroundImage: 'url(/static/images/home/shopTitle.png)', backgroundSize:'100% 100%',width:'20px',height:'20px', backgroundRepeat: 'no-repeat'}"></view>
				<view class="margin-left-xs overflow-one-lines">
					{{pageForm.fCzmc}}
				</view>
			</view>
			<view class="themeColor">
        {{ddDdzt.get(pageForm.fDdzt)}}
			</view>
		</view>
		<u-divider></u-divider>
		<view v-for="(item,index) of pageForm.ddxqList" :key="index" class="flex justify-between margin-top">
			<view class="" style="min-width: 80px;min-height: 80px">
				<u-image width="80px" height="80px" :src="item.fTp?item.fTp:'/static/images/gas-icon/gasicon.png'"></u-image>
			</view>
			<view class="w60 flex flex-direction  justify-between margin-left-sm">
				<view class="overflow-one-lines">
					{{ddPsfs.get(item.fSpmc)}}
				</view>
				<view class="text-sm text-gray overflow-one-lines">
					规格:{{item.fMs}}
				</view>
				<view class="text-lg text-bold overflow-one-lines">
					¥{{item.fDj}}
				</view>
			</view>
			<view class="flex flex-wrap justify-end">
				<view v-if="pageForm.fPsfs" :class="[pageForm.fPsfs=='自提'?'ztSty':'psSty','psfsSty']">
					{{pageForm.fPsfs}}</view>
				<view class="flex align-end">X{{item.fSl}}</view>
			</view>
		</view>
		<u-divider></u-divider>
		<view class="flex margin-top-lg">
			<view class="text-gray overflow-one-lines">
				订单编号:{{pageForm.fDddh}}
			</view>
		</view>
		<view class="flex margin-top-sm">
			<view class="text-gray">
				备注信息:{{pageForm.fMjly}}
			</view>
		</view>
		<view class="flex margin-top-lg margin-bottom-lg justify-end  ">
			<view class="text-gray">
				<!-- 共{{pageForm.ddxqList.length}}件商品 -->
				合计:
			</view>
			<view class="themeColor  overflow-one-lines">
				¥{{pageForm.fDdje}}
			</view>
		</view>
		<view class="flex justify-end">
      <view class="margin-left-sm" v-if="pageForm.fDdzt =='202' " @click.stop="goGasCancel">
        <u-button shape="circle" color="">取消订单</u-button>
      </view>
<!--			<view class="margin-left-sm" @click.stop="goGasDetailPage">-->
<!--				<u-button shape="circle" color="">再来一单</u-button>-->
<!--			</view>-->
			<!-- 	<view class="margin-left-sm">
				<u-button shape="circle" color="" @click.stop="reminderShipment">提醒发货</u-button>
			</view> -->
			<!-- 		<view class="margin-left-sm">
				<u-button shape="circle" color="#EA5504" @click.stop="customerService">联系客服</u-button>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {cancelOrder} from "../../../api/order";
  import {dd_zflx, dd_fkfs, dd_psfs, dd_zffs, dd_ddly, sys_sf, dd_ddzt} from "@/utils/enums";

  export default {
		components: {},
		props: {
			orderitem: Object
		},
		watch: {
			orderitem(val) {
				console.log('打印Val', val);
			}
		},
		data() {
			return {
        ddDdzt: new Map(Object.values(dd_ddzt).map(item => [item.code, item.info])),
        ddPsfs: new Map(Object.values(dd_psfs).map(item => [item.code, item.info])),
				pageForm: {
					fCzmc: '',
					fDdzt: '201',
					fDddh: '',
					ddxqList: [],
					fSpmc: '',
					fGg: '',
					fTp: '',
					fDdjg: '',
					fDj: '',
					fDdly: '',
					fSl: '',
					fCzid: '',
				}
			}
		},
		computed: {

		},
		onLoad() {
			// this.pageForm = {...this.orderItem};
		},
		created() {
			this.pageForm = {
				...this.orderitem
			};
      // this.$forceUpdate();
		},
		methods: {
		  //用户取消订单
      async goGasCancel(){
        let paramsData ={
          ddid: this.pageForm.id
        };
        this.$modal.confirm('确认取消订单?', '提示').then(async () => {
          let cancelOrderResult = await this.$api.orderApi.cancelOrder(paramsData);
          if(cancelOrderResult.code ==200){
            this.$modal.msgSuccess('订单取消成功!');
            this.pageForm.fDdzt ='207';
            this.$emit('orderCancel');
          }else {
            this.$modal.msgError('会员信息修改失败!');
          }
        }).catch(() => {
          console.log("取消");
        });

      },
			goStorePage() {
        let czid = this.pageForm.fCzid;
        console.log('打印czid',czid)
				uni.navigateTo({
					url: "/pages/home/storeDetails?czid="+czid
				})
			},
			goGasDetailPage() {
				uni.navigateTo({
					url: "/pages/home/gasDetail"
				})
			},
			goOrderDetaPage() {
				// console.log('打印this.pageForm.id', this.pageForm);
				uni.navigateTo({
					url: `/pages/order/orderDetail?id=${this.pageForm.id}`
				})
			},
			reminderShipment() {

			},
			customerService() {

			},
		}
	}
</script>

<style lang="scss" scoped>
	.orderCard {
		margin: 10px;
		padding: 10px;
		background: #fff;
		border-radius: 15px;

		.psfsSty {
			width: 70px;
			height: 23px;
			border-radius: 5px;
			text-align: center;
			line-height: 23px;
			font-size: 12px;
		}

		.ztSty {
			font-family: "苹方 中等", 苹方, sans-serif;
			font-weight: 400;
			font-style: normal;
			color: rgb(0, 174, 170);
			background-color: #e6f7f7;
		}

		.psSty {
			font-family: "苹方 中等", 苹方, sans-serif;
			font-weight: 400;
			font-style: normal;
			color: rgb(255, 165, 0);
			background-color: #fff6e6;
		}
	}
</style>