| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template id="com-card-secret">
- <div class="com-card-secret">
- <el-card class="edit-card-secretd" shadow="never">
- <div slot="header" class="clearfix">
- <div class="card-title card-secretd-title">虚拟卡密<span class="card-secretd-sub-title"></span></div>
- </div>
- <el-form :model="form" size="small">
- <!-- 虚拟卡密开始 -->
- <el-form-item label="赠送卡密" label-width="80px">
- <el-select size="small" style="min-width: 350px" v-model="form.cate_id"
- placeholder="状态">
- <el-option v-if="data.no_use_num > 0" v-for="(data,index) in cate_list" :label="data.name+'(已经使用'+data.use_num+',未使用'+data.no_use_num+')'" :value="data.id" :key="data.id"></el-option>
- </el-select>
- </el-form-item>
- <!-- 虚拟卡密结束 -->
- </el-form>
- </el-card>
- </div>
- </template>
- <script>
- Vue.component('com-card-secret', {
- template: "#com-card-secret",
- props: {
- goods_id: {
- type: Number | String,
- default: 0
- }
- },
- data() {
- return {
- form: {
- cate_id: '',
- },
- cate_list:[],
- }
- },
- watch: {
- form:{
- deep:true,
- immediate: true,
- handler(value){
- this.$emit("select", {CardSecret: this.form});
- }
- }
- },
- mounted: function() {
- this.cardsecret();
- },
- methods: {
- //优惠券列表
- cardsecret() { console.log(11111);
- request({
- params: {
- r: 'card-secret/goods/edit',
- goods_id: this.goods_id,
- },
- method: 'get',
- }).then(e => { console.log(3333);
- if (e.data.code == 0 && !isEmpty(e.data.data)) {
- this.cate_list = e.data.data.cate_list;
- if(this.cate_list){
- var status = 0;
- $.each(this.cate_list,function($k,$v){
- if(this.cate_id == $v.cate_id && $v.no_use_num >0){
- status = 1;
- }
- });
- if(status){
- this.form.cate_id = e.data.data.cate_id;
- }else{
- this.form.cate_id = '';
- }
- }
- }
- })
- },
- }
- });
- </script>
- <style>
- .com-card-secret{
- margin-bottom:20px;
- }
- </style>
|