<template>
	<view>
		<view class="alijusstart fotct font14 height40p backcor9 fcor333">
			<view class="width40">卡券名称</view>
			<view class="width20">销售价格</view>
			<view class="width20">库存数量</view>
			<view class="width20">销售数量</view>
		</view>
		
		<view v-if="agtcardlist == '' " class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
		</view>
		<view class="width96 alijusstart fotct font14 height45 fcor666 mart5  bor-botm1 marb5" :key="index"
			v-for="(item,index) in agtcardlist" @click="jumpcarddes(item.id)">
			<view class="width40">{{item.couponName}}</view>
			<view class="width20">{{item.salesPrice}}元</view>
			<view class="width20">{{item.stockCount}}</view>
			<view class="width20">{{item.salesCount}}</view>
		</view>
	</view>
</template>

<script>
	import {
		getCouponByAgent
	} from '../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				imgadres: 'noorder.png',
				imagewxUrl: app.globalData.imageWxImg,
				agtcardlist: [],
				agentid: ''
			}
		},
		onLoad(options) {
			this.agentid = options.agid;
			this.getCouponByAgent();
		},
		methods: {
			//查询卡列表
			getCouponByAgent() {
				uni.showLoading({
					title: '加载中...'
				})
				let datas = {
					agentId: this.agentid,
					pageNum: 1,
					pageSize: 999
				}
				getCouponByAgent(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						this.agtcardlist = res.return_data.list;
					}
				})
			},
			//跳转分发记录
			jumpcarddes(item) {
				uni.navigateTo({
					url: '../agentcardsDetails/agentcardsDetails?couponAgentId='+item
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
