Browse Source

完成删除订单功能

LXT-NJ\Admin 1 year ago
parent
commit
73a2df6aad

+ 26 - 3
pages/dingdan/index.vue

@@ -5,14 +5,14 @@
 		<tm-tabs align="split" class="qiehuan1" v-model="activeIndex" :list="list2" range-key="title" @change="changeTab"></tm-tabs>
 		<div class="zhuti shangpin">
 			<tm-sheet class="jiaoxi" style="" v-for="item in test">
-				<tm-cartCellListFood class="shuliang" :typeclick="typeclick" :mdata="item" v-on:sure="goSure(item.id)" v-on:Eval="goEval(item.id)"  :cart-num.sync="item.buy"></tm-cartCellListFood>
+				<tm-cartCellListFood class="shuliang" :typeclick="typeclick" :mdata="item" v-on:sure="goSure(item.id)" v-on:Eval="goEval(item.id)" @shanchu="goShanChu(item.id)" :cart-num.sync="item.buy"></tm-cartCellListFood>
 			</tm-sheet>
 		</div>
 		<view class="empty" v-if="isEmpty">
 			暂无内容~
 		</view>
 		<view class="bottom" v-if="isBottom">
-			没有更多~
+			没有更多~
 		</view>
 		<!-- 弹出层消息 -->
 		<tm-message ref="toast"></tm-message>
@@ -120,7 +120,30 @@ export default {
 					console.log(res.data.data.data,'订单列表');
 			})
 		},
-	  goSure(ids){
+	  goShanChu(ids){
+			let that=this;
+			myRequest({
+			url:'/api/order/deleteOrder',
+			method:'post',
+			data:{
+				id:ids
+			}
+			}).then(res=>{
+				if(res.data.code==200){
+					that.$refs.toast.show({
+						model: 'success',
+						label: res.data.msg
+					})
+					that.getOrderList()
+				}else{
+					that.$refs.toast.show({
+						model: 'error',
+						label: res.data.msg
+					})
+				}
+			})
+		},
+		goSure(ids){
 	  	let that=this;
 	  	myRequest({
 	  	url:'/api/Order/receipt',

+ 8 - 1
tm-vuetify/components/tm-cartCellListFood/tm-cartCellListFood.vue

@@ -17,7 +17,7 @@
 				<view class="title  text-size-s text-weight-b text-overflow-2" style="line-height: 32rpx;"
 					:class="[black_tmeme ? 'bk' : '',]">
 					{{mdata[keyMap['title']]}}
-					<image v-if="typeclick==4" class="shanchu" src="/static/img/94.png"></image>
+					<image v-if="typeclick==4" class="shanchu" src="/static/img/94.png" @click="shanchu(mdata)" ></image>
 				</view>
 				<view style="min-height: 64rpx;">
 					<view v-if="!dense&&mdata[keyMap['label']]"
@@ -246,6 +246,13 @@
 			this.cNum = this.mdata.buy;
 		},
 		methods: {
+			// 删除订单
+			shanchu(data){
+				console.log(data,'3');
+				this.$emit('shanchu', {
+					data: data
+				});
+			},
 			// 付款
 			goPay(data,type){
 				console.log(data);