Authored by shuaiguo

Merge branch 'refs/heads/develop'

... ... @@ -19,7 +19,7 @@
"axios": "^0.15.3",
"bignumber.js": "^8.0.1",
"clipboard": "^1.5.12",
"dayjs": "^1.7.7",
"dayjs": "^1.8.21",
"iview": "^3.1.5",
"js-cookie": "^2.1.3",
"vue": "^2.5.2",
... ...
... ... @@ -5,8 +5,8 @@ class ResourceApi extends Api {
super();
}
list() {
return this._post('/ufoPlatform/resource/getResources', { size: 200 });
list(params) {
return this._post('/ufoPlatform/resource/getResources', params);
}
info(id) {
... ... @@ -15,6 +15,16 @@ class ResourceApi extends Api {
});
}
getResourceListByCode(code) {
return this._get('/ufoPlatform/resource/getResourcesByCode', {
code
})
}
updateResourceTime(data) {
return this._post('/ufoPlatform/resource/editOrUpdateResourcesTime', data);
}
editResource(data) {
return this._post('/ufoPlatform/resource/editResourceContentData', data);
}
... ...
... ... @@ -13,6 +13,15 @@
</i-radio>
</i-radio-group>
</div>
<!-- 一张图、两张图 自定义图片高度、宽度 -->
<Form v-if="isCustomImgSize" :label-width="50" class="size-container">
<Form-item label="宽度:">
<Input placeholder="请输入图片宽度" v-model="width"/>
</Form-item>
<Form-item label="高度:">
<Input placeholder="请输入图片高度" v-model="height"/>
</Form-item>
</Form>
<table class="banner-table">
<tbody>
<draggable v-model="value_" @start="drag=true" @end="drag=false">
... ... @@ -68,7 +77,8 @@ export default {
"type",
"templateName",
"size",
"isSelectAction"
"isSelectAction",
'isCustomImgSize'
],
filters: {
removeImageParams(url) {
... ... @@ -84,7 +94,9 @@ export default {
return {
type_: this.size || "0",
value_: this.handleData(util.clone(this.value)),
itemStyle: ""
itemStyle: "",
height: '',
width: '',
};
},
methods: {
... ... @@ -256,6 +268,10 @@ export default {
for (const i of Object.keys(temp)) {
result[i] = temp[i];
if(this.isCustomImgSize) {
result[i].height = this.height;
result[i].width = this.width;
}
}
return result;
... ... @@ -274,6 +290,8 @@ export default {
},
reSetType() {
this.type_ = "0";
this.height = '';
this.width = ''
},
reset() {
this.value_ = [];
... ... @@ -285,6 +303,15 @@ export default {
// console.log(newVal);
this.type_ = this.size || "0";
this.value_ = this.handleData(util.clone(newVal));
this.height = '';
this.width = '';
if(this.isCustomImgSize) {
const {height = '', width = ''} = this.value[0] || {};
if(height || width) {
this.height = height;
this.width = width;
}
}
}
},
components: {
... ... @@ -321,5 +348,9 @@ tr:hover {
padding: 20px;
min-width: 320px;
}
.size-container {
width: 30%;
}
</style>
... ...
... ... @@ -17,7 +17,8 @@
</FormItem>
<FormItem>
<h5-url v-if="action_ === 'go.h5'" v-model="url_"></h5-url>
<h5-url key="go.h5" v-if="action_ === 'go.h5'" v-model="url_"></h5-url>
<h5-url key="go.shuichannel" v-if="action_ === 'go.shuichannel'" v-model="url_"></h5-url>
<pool-url v-else-if="action_ === 'go.pool'" v-model="url_"></pool-url>
<detail-url v-else-if="action_ === 'go.detail'" v-model="url_"></detail-url>
<list-url v-else-if="action_ === 'go.list'" v-model="url_"></list-url>
... ... @@ -56,9 +57,7 @@ export default {
},
methods: {
initAction() {
let action = [];
if (this.type === "H5") {
action = [
let action = [
{
value: "go.h5",
label: "H5网页"
... ... @@ -78,26 +77,15 @@ export default {
{
value: "go.channel",
label: "首页频道Tab"
}
];
} else {
action = [
{
value: "go.h5",
label: "H5网页"
},
{
value: "go.pool",
label: "商品池"
},
{
value: "go.detail",
label: "商品详情"
},
{
value: "go.list",
label: "商品列表"
},
// go.subchannel go.shuichannel(新)
value: "go.shuichannel",
label: "二级频道跳转"
}
];;
if (this.type !== "H5") {
action = action.concat([
{
value: "go.calendar",
label: "发售日历页"
... ... @@ -114,11 +102,7 @@ export default {
value: "go.identifyList",
label: "鉴定服务"
},
{
value: "go.channel",
label: "首页频道Tab"
}
];
]);
}
return action;
},
... ... @@ -169,14 +153,16 @@ export default {
this.url_ = "";
} else if (newVal === "go.h5") {
this.url_ = "";
} else if (newVal === "go.calendar") {
} else if (newVal === "go.shuichannel") {
this.url_ = "";
}else if (newVal === "go.calendar") {
this.url_ = "https://m.yohobuy.com/?pagename=saleCalendar";
} else if (newVal === "go.hotlist") {
this.url_ = "https://m.yohobuy.com/?pagename=hotSale";
} else if (newVal === "go.bargainlist") {
// 砍价列表
this.url_ = "https://m.yohobuy.com/";
} else if ("go.identifyList") {
} else if (newVal === "go.identifyList") {
this.url_ = "https://m.yohobuy.com/?pagename=identifyList";
} else if (newVal === "go.channel") {
this.url_ = "https://m.yohobuy.com/?pagename=home";
... ...
export default "development";
\ No newline at end of file
export default "production";
\ No newline at end of file
... ...
import Service from './service';
import ResourceApi from '@/api/resource-api';
... ... @@ -8,8 +7,8 @@ class ResourceService extends Service {
this.api = new ResourceApi();
}
list() {
return this.api.list();
list(params) {
return this.api.list(params);
}
info(id) {
... ... @@ -41,6 +40,22 @@ class ResourceService extends Service {
});
}
listByCode(code) {
return this.api.getResourceListByCode(code);
}
updateResourceTimeStr({ id, publishTimeStr }) {
return this.api.updateResourceTime({ id, publishTimeStr });
}
createResourceTime({ code, publishTimeStr, id: copyFromId }) {
return this.api.updateResourceTime({ code, publishTimeStr, copyFromId });
}
deleteResourceTime({ id }) {
return this.api.updateResourceTime({ id, status: 0 });
}
editGoodsPool(data) {
return this.api.editGoodsPool(data);
}
... ... @@ -63,4 +78,4 @@ class ResourceService extends Service {
}
export default ResourceService;
\ No newline at end of file
export default ResourceService;
... ...
... ... @@ -9,14 +9,19 @@
<i-spin v-if="loading"></i-spin>
<i-form v-else ref="formCoupon" :rules="ruleValidate" :model="formData" :label-width="80">
<i-form-item class="form-group" label="优惠券类型"></i-form-item>
<i-form-item label="用户类型" prop="userType">
<radio-group v-model="formData.userType" @on-change="changeUserType">
<radio :label="1" :disabled="!!formData.id">买家</radio>
<radio :label="2" :disabled="!!formData.id">卖家</radio>
</radio-group>
</i-form-item>
<div :key="formData.userType">
<i-form-item label="优惠券类型" prop="couponType">
<i-select style="width: 100px;" v-model="formData.couponType" :disabled="readonly">
<i-option :value="0">请选择</i-option>
<i-option :value="100">活动券</i-option>
<i-option :value="110">运费券</i-option>
<i-option v-for="item in counponOptions" :value="item.value" :key="item.value">{{ item.label }}</i-option>
</i-select>
</i-form-item>
<i-form-item class="form-group" label="基本信息"></i-form-item>
<i-form-item label="Token" v-if="couponToken">{{couponToken}}</i-form-item>
<i-form-item label="名称" prop="couponName">
... ... @@ -59,12 +64,16 @@
></i-date-picker>
</i-form-item>
<i-form-item label="优惠券说明" prop="remark">
<i-input
type="textarea"
placeholder="优惠券使用条件简介"
:disabled="allreadonly"
v-model="formData.remark"
></i-input>
<i-row>
<i-col span="20">
<i-input
type="textarea"
placeholder="优惠券使用条件简介"
:disabled="allreadonly"
v-model="formData.remark"
></i-input>
</i-col>
</i-row>
</i-form-item>
<i-form-item class="form-group" label="使用条件"></i-form-item>
<i-form-item label="优惠条件" prop="useLimitType" style="display: inline-block; width: 100%">
... ... @@ -93,23 +102,49 @@
</i-form-item>
<i-form-item label="适用范围" prop="productLimitType">
<i-select style="width: 100px;" v-model="formData.productLimitType" :disabled="readonly">
<i-option :value="1">指定商品</i-option>
<i-option :value="2">全部商品</i-option>
<i-option :value="3">排除商品</i-option>
</i-select>
<radio-group v-model="formData.productLimitType" @on-change="changeProductType">
<radio v-for = "(val, key) in allowproductLimitTypeList" :key="formData.userType+key" :label="+key" :disabled="readonly">{{val}}</radio>
</radio-group>
</i-form-item>
<div :key="formData.productLimitType">
<i-form-item prop="brandVal" v-if="formData.productLimitType === 4">
<Select v-model="formData.brandVal" multiple style="width:300px" :disabled="readonly">
<Option v-for="item in brandList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</i-form-item>
<i-form-item :prop="cascaderData.prop" v-else-if="formData.productLimitType === 5 || formData.productLimitType === 6">
<i-row v-for="item in cascaderData.formData.items" :key="item.index" class="add-item">
<i-col span="16">
<Cascader :data="cascaderData.data" :disabled="readonly" v-model="item.value" :load-data="cascaderData.loadData"></Cascader>
</i-col>
<i-col span="4" offset="1" v-if="item.index > 1 && !readonly">
<i-button @click="handleRemove(cascaderData.formData, item.index)" type="error" size="small" ghost icon="md-close" shape="circle"></i-button>
</i-col>
</i-row>
<i-row v-if="!readonly">
<i-col span="10">
<i-button type="dashed" long @click="handleAdd(cascaderData.formData)" icon="md-add">添加项</i-button>
</i-col>
</i-row>
</i-form-item>
<i-form-item
prop="productLimitValue"
v-if="formData.productLimitType === 1 || formData.productLimitType === 3"
:prop="uploadProp"
:label="formData.productLimitType === 1 ? '' : '排除商品'"
>
<i-input
type="textarea"
:disabled="readonly"
placeholder="填写商品编码,多个商品编码用英文逗号分隔"
v-model="formData.productLimitValue"
></i-input>
<i-row>
<i-col span="20">
<i-input
type="textarea"
:key ="formData.productLimitType"
:disabled="readonly"
placeholder="填写商品编码,多个商品编码用英文逗号分隔"
v-model="formData[uploadProp]"
></i-input>
</i-col>
</i-row>
<i-poptip trigger="hover">
<div slot="content">
<p>1.上传文件必须是xlsx文件</p>
... ... @@ -125,6 +160,7 @@
</i-upload>
</i-poptip>
</i-form-item>
</div>
<!--<i-form-item label="禁用商品类型">
<checkbox-group v-model="formData.skupForbidTypeLable" @on-change="getCheckBox">
<checkbox label="现货" :disabled="readonly"></checkbox>
... ... @@ -136,33 +172,22 @@
</i-form-item>-->
<i-form-item label="可用商品类型">
<checkbox-group v-model="formData.skupAllowTypeLabel" @on-change="getCheckBox">
<!-- <checkbox label="线下店订单" :disabled="readonly"></checkbox>-->
<checkbox label="极速发货" :disabled="readonly"></checkbox>
<checkbox label="极速寄存" :disabled="readonly"></checkbox>
<checkbox label="预售" :disabled="readonly"></checkbox>
<checkbox label="瑕疵" :disabled="readonly"></checkbox>
<checkbox label="二手" :disabled="readonly"></checkbox>
<!-- <checkbox label="鉴定" :disabled="readonly"></checkbox>-->
<checkbox label="海外直邮" :disabled="readonly"></checkbox>
<checkbox label="现货发货" :disabled="readonly"></checkbox>
<checkbox label="现货寄存" :disabled="readonly"></checkbox>
<checkbox label="闪购发货" :disabled="readonly"></checkbox>
<checkbox label="闪购寄存" :disabled="readonly"></checkbox>
<checkbox v-for = "(val, key) in allowTypeLabelList" :key="formData.userType+key" :label="key" :disabled="readonly">{{val}}</checkbox>
</checkbox-group>
</i-form-item>
<i-form-item label="购买渠道" prop="useLimitType">
<i-form-item label="购买渠道" prop="businessClientLabel">
<checkbox-group v-model="formData.businessClientLabel" @on-change="getChannelCheckBox">
<checkbox label="UFO" :disabled="readonly"></checkbox>
<checkbox label="闲鱼" :disabled="readonly"></checkbox>
<checkbox v-for = "(val, key) in businessClientLabelMap" :key="key" :label="key" :disabled="readonly">{{val}}</checkbox>
</checkbox-group>
</i-form-item>
<i-form-item label="需要校验" prop="checkRequired">
<checkbox v-model="formData.isCheckRequired" :disabled="allreadonly" @on-change="getCheckRequired"></checkbox>
</i-form-item>
<i-form-item label="展示在详情页" prop="isShowInDetail">
<i-form-item v-if="isShowDetail" label="展示在详情页" prop="isShowInDetail">
<checkbox v-model="formData.isShowInDetail" :disabled="allreadonly" @on-change="setIsShowInDetail"></checkbox>
</i-form-item>
</div>
</i-form>
</i-modal>
</template>
... ... @@ -187,21 +212,36 @@ const forbidenLabelMap = {
5: "全新瑕疵",
3: "闪购"
};
const userCouponType = {
buyer: [{
value: 100,
label: '活动券'
},
{
value: 110,
label: '运费券'
}],
seller: [{
value: 100,
label: '活动券'
}]
}
const allowTypeMap = {
// '线下店订单': '2',
极速发货: "9-N",
极速寄存: "9-Y",
预售: "4",
瑕疵: "5",
二手: "6",
// '鉴定': '8',
海外直邮: "17",
现货发货: "1-N",
现货寄存: "1-Y",
闪购发货: "3-N",
闪购寄存: "3-Y"
const sellerAllowLabel = {
"1-N": "现货发货",
"4": "预售",
"5": "瑕疵",
"6": "二手",
};
const allowproductLimitTypeList = {
1: "指定商品",
2: "全部商品",
// 3: "排除商品",
4: "特定品牌",
5: "特定品类",
6: "特定系列"
}
const allowLabelMap = {
// '2': '线下店订单',
"9-N": "极速发货",
... ... @@ -216,51 +256,88 @@ const allowLabelMap = {
"3-N": "闪购发货",
"3-Y": "闪购寄存"
};
const businessClientTypeMap = {
UFO: "ufo",
闲鱼: "h5/xianyu"
};
const businessClientLabelMap = {
ufo: "UFO",
"h5/xianyu": "闲鱼"
};
export default {
components: {},
name: "ModalCreateCoupon",
data() {
return {
readonly: false,
allreadonly: false,
visiable: false,
loading: false,
posting: true,
uploadTxt: "",
couponToken: "",
formData: {
const initFormData = {
id: 0,
couponName: "",
couponType: 0,
couponNum: 0,
couponType: 0,
useNum: 1,
couponAmount: 0,
useLimitType: 0,
remark: "",
productLimitType: 2,
productLimitValue: "",
productLimitType: 2,
brandVal: [],
category: {
index: 1,
items: [{
index: 1,
value: []
}]
},
series: {
index: 1,
items: [{
index: 1,
value: []
}]
},
excludeProductIds: "",
useLimitValue: 0,
time: ["", ""],
receiveTime: ["", ""],
// skupForbidTypeLable:[],
// skupForbidType: ''
skupAllowTypeLabel: [],
skupAllowType: "",
businessClient: "",
businessClientLabel: [],
checkRequired: 0,
isCheckRequired: true,
isCheckRequired: false,
// 是否展示在详情页
isShowInDetail: false
isShowInDetail: false,
// skupForbidTypeLable:[],
// skupForbidType: ''
};
export default {
components: {},
name: "ModalCreateCoupon",
data() {
return {
readonly: false,
allreadonly: false,
visiable: false,
loading: false,
posting: true,
uploadTxt: "",
couponToken: "",
formData: {
userType: 1,
...initFormData
},
buyerFormDataCache: {
userType: 1,
...initFormData
},
sellerFormDataCache: {
userType: 2,
...initFormData
},
lastSelectType: 2,
excludeValCache: {
2: "",
3: "",
4: "",
5: "",
6: ""
},
allowproductLimitTypeList,
businessClientLabelMap,
brandList: [],
categoryList: [],
seriesList: [],
ruleValidate: {
couponType: {
required: true,
... ... @@ -334,7 +411,7 @@ export default {
}
},
productLimitValue: {
required: false,
required: true,
validator: (rule, value, callback) => {
const ids = (value || "").split(",");
... ... @@ -347,19 +424,100 @@ export default {
}
}
},
excludeProductIds: {
required: false,
validator: (rule, value, callback) => {
const ids = (value || "").split(",");
if (ids.some(id => (id ? !parseInt(id) : false))) {
callback(new Error("适用范围格式错误"));
} else {
callback();
}
}
},
brandVal: {
required: true,
validator: (rule, value, callback) => {
if (value.length > 0) {
callback();
} else {
callback(new Error("请选择品牌"));
}
}
},
category: {
required: true,
validator: (rule, value, callback) => {
if(value.items.length >0 && value.items[0].value.length > 0) { //保证至少有一组值
callback();
} else {
callback(new Error("请选择品类"));
}
}
},
series: {
required: true,
validator: (rule, value, callback) => {
if(value.items.length >0 && value.items[0].value.length > 0) { //保证至少有一组值
callback();
} else {
callback(new Error("请选择系列"));
}
}
},
productLimitType: {
required: true,
validator: (rule, value, callback) => {
if (value === 1 || value === 2 || value === 3) {
if (value > 0) {
callback();
} else {
callback(new Error("请选择类型"));
}
}
},
businessClientLabel: {
required: true,
validator: (rule, value, callback) => {
if (value.length > 0) {
callback();
} else {
callback(new Error("请选择购买渠道"));
}
}
}
}
};
},
computed: {
allowTypeLabelList: function() {
return this.formData.userType === 1 ? allowLabelMap : sellerAllowLabel
},
counponOptions: function() {
return this.formData.userType === 1 ? userCouponType.buyer : userCouponType.seller
},
isShowDetail: function() {
return this.formData.userType === 1 ? true : false
},
uploadProp: function() {
return this.formData.productLimitType === 1 ? 'productLimitValue' : 'excludeProductIds'
},
cascaderData: function() {
let cascaderObj = {}
if (this.formData.productLimitType === 5) {
cascaderObj.prop = "category"
cascaderObj.formData = this.formData.category
cascaderObj.data = this.categoryList
cascaderObj.loadData = this.loadCategoryData
}else if(this.formData.productLimitType === 6) {
cascaderObj.prop = "series"
cascaderObj.formData = this.formData.series
cascaderObj.data = this.seriesList
cascaderObj.loadData = this.loadSeriesData
}
return cascaderObj
}
},
methods: {
async show(id, readonly, allreadonly) {
// console.log(id)
... ... @@ -367,30 +525,12 @@ export default {
this.allreadonly = allreadonly;
this.posting = this.visiable = true;
this.$refs.formCoupon.resetFields();
for (let key in this.excludeValCache) {
this.excludeValCache[key] = ""
}
this.couponToken = "";
let initData = {
id: 0,
couponName: "",
couponNum: 0,
couponType: 0,
useNum: 1,
couponAmount: 0,
useLimitType: 0,
remark: "",
productLimitValue: "",
productLimitType: 2,
useLimitValue: 0,
time: ["", ""],
skupAllowTypeLabel: [],
skupAllowType: "",
businessClientLabel: [],
businessClient: "",
checkRequired: 0,
isShowInDetail: false
// skupForbidTypeLable:[],
// skupForbidType: ''
};
let initData = initFormData
initData.userType = 1
if (id) {
this.loading = true;
const result = await api._get("/ufoPlatform/coupon/getCouponInfo", {
... ... @@ -403,28 +543,16 @@ export default {
if (result.code === 200) {
const coupon = result.data.coupon;
console.log(result.data)
const productLimits = result.data.productLimits;
this.couponToken = coupon.couponToken;
let skupAllowTypeLabel = [];
if (coupon.skupAllowType) {
let arr = coupon.skupAllowType.split(",");
for (let i = 0; i < arr.length; i++) {
skupAllowTypeLabel.push(allowLabelMap[arr[i]]);
}
}
let businessClientTypeLabel = [];
if (coupon.businessClient) {
let arr = coupon.businessClient.split(",");
for (let i = 0; i < arr.length; i++) {
businessClientTypeLabel.push(businessClientLabelMap[arr[i]]);
}
}
let isCheckRequired = coupon.checkRequired === 1
console.log('=====:'+isCheckRequired)
initData = {
...initFormData,
id,
userType: coupon.userType,
couponName: coupon.couponName,
couponNum: coupon.couponNum,
couponType: coupon.couponType || 0,
... ... @@ -433,9 +561,7 @@ export default {
useLimitType: coupon.useLimitType,
remark: coupon.remark,
productLimitType: coupon.productLimitType,
productLimitValue: (productLimits || [])
.map(i => i.productId)
.join(","),
excludeProductIds: result.data.excludeProductIds,
useLimitValue: coupon.useLimitValue,
time: [
dayjs.unix(coupon.startTime).format("YYYY-MM-DD HH:mm:ss"),
... ... @@ -445,20 +571,127 @@ export default {
dayjs.unix(coupon.receiveStartTime).format("YYYY-MM-DD HH:mm:ss"),
dayjs.unix(coupon.receiveEndTime).format("YYYY-MM-DD HH:mm:ss")
],
skupAllowTypeLabel: skupAllowTypeLabel,
skupAllowType: coupon.skupAllowType,
businessClientLabel: businessClientTypeLabel,
businessClient: coupon.businessClient, //购买渠道
skupAllowTypeLabel: coupon.skupAllowType.split(","),
businessClientLabel: coupon.businessClient.split(","), //购买渠道
checkRequired: coupon.checkRequired,
isCheckRequired,
isShowInDetail: result.data.showInPrdDetail === 'Y'
};
this.setSelectItems(coupon.productLimitType,coupon.productLimitValue)
} else {
result.message && this.$Message.warning(result.message);
}
}
this.formData = initData;
},
async setSelectItems(type,val) {
await this.getSelectItems(type)
this.setValToSelect(type,val)
this.lastSelectType = type
},
setValToSelect(type,val) {
switch (type) {
case 1:
this.formData.productLimitValue = val
break
case 4:
this.formData.brandVal = val.split(",").map(item => parseInt(item))
break
case 5:
this.formData.category = this.getFormSelectedVal(val)
break
case 6:
this.formData.series = this.getFormSelectedVal(val)
}
},
getFormSelectedVal(val) {
let selectedVal = {}
let valArr = val.split(",")
selectedVal.index = valArr.length
let itemsArr = []
for(let i = 0; i < valArr.length; i++) {
let item = {}
item.index = i+1
item.value = valArr[i].split("-").map(item => parseInt(item))
itemsArr.push(item)
}
selectedVal.items = itemsArr
return selectedVal
},
async getSelectItems(type) {
let typeData = {
4: { url: "/ufoPlatform/brand/getBrandName",name: "brandList"},
5: { url: "/ufoPlatform/productSort/getLevel1SortIdAndName", name: "categoryList"},
6: { url: "/ufoPlatform/brand/getBrandName", name: "seriesList"}
};
if(!typeData[type]) {
return
}
let dataListName = typeData[type].name
if(this[dataListName].length > 0) {
return this[dataListName]
}
const result = await api._get(typeData[type].url)
let dataList = result.data
dataList.map((item) => {
item.label = item.text
item.value = item.id
delete item.text
delete item.id
if(+type === 6 || +type == 5) {
item.children = []
item.loading = false
}
return item
})
this[dataListName] = dataList
},
loadSeriesData (item, callback) {
this.loadData("seires", item, callback)
},
loadCategoryData (item, callback) {
this.loadData("category", item, callback)
},
async loadData (name, item, callback) {
let loadRequest = {
"seires": {url: "/ufoPlatform/brandSeries/querySeriesByBrandId", params: {brandId: item.value}},
"category": {url: "/ufoPlatform/productSort/getLevel2SortBySortId", params: {sortId: item.value}}
}
item.loading = true;
const result = await api._get(loadRequest[name].url, loadRequest[name].params)
let childrenList = result.data
childrenList.map((item) => {
item.label = item.text
item.value = item.id
delete item.text
delete item.id
return item
})
item.children = childrenList
item.loading = false;
callback();
},
handleAdd (cascaderData) {
cascaderData.index++;
cascaderData.items.push({index: cascaderData.index,value:[]});
},
handleRemove (cascaderData, index) {
let totalItem = cascaderData.index
cascaderData.index--;
if(index < totalItem) { // 删除中间项时 后面index重置
cascaderData.items.splice(index-1,1);
let newData = cascaderData.items
for(let i = index-1; i < cascaderData.index; i++) {
newData[i].index--
}
cascaderData.items = newData
} else {
cascaderData.items.pop();
}
},
onOk() {
this.$refs.formCoupon.validate(valid => {
if (!valid) {
... ... @@ -483,30 +716,51 @@ export default {
setIsShowInDetail(checked) {
this.formData.isShowInDetail = checked
},
getCheckBox() {
// checkbox勾选取消的监测
let arr = [];
for (let i = 0; i < this.formData.skupAllowTypeLabel.length; i++) {
let allowType = this.formData.skupAllowTypeLabel[i];
// console.log(allowType);
arr.push(allowTypeMap[allowType]);
changeUserType(val) {
if(val === 2) {
this.buyerFormDataCache = {...this.formData, userType: 1}
this.formData = this.sellerFormDataCache
} else {
this.sellerFormDataCache = {...this.formData, userType: 2}
this.formData = this.buyerFormDataCache
}
},
// console.log(arr);
this.formData.skupAllowType = arr.join(",");
changeProductType(val) {
// 排除商品缓存设置
this.excludeValCache[this.lastSelectType] = this.formData.excludeProductIds
this.formData.excludeProductIds = this.excludeValCache[val]
this.lastSelectType = val
this.getSelectItems(val)
},
getChannelCheckBox() {
let arr = [];
for (let i = 0; i < this.formData.businessClientLabel.length; i++) {
let businessClientType = this.formData.businessClientLabel[i];
// console.log(businessClientType);
arr.push(businessClientTypeMap[businessClientType]);
}
// console.log(arr);
this.formData.businessClient = arr.join(",");
getLimitVal(propName) {
let processData = this.formData[propName].items
let idsArr = []
for(let i = 0; i < processData.length; i++) {
if(processData[i].value.length > 0) {
let lastId = processData[i].value.pop()
idsArr.push(lastId)
}
}
return idsArr.join(",")
},
processProductLimitValue(type) {
let valueType = {
1: this.formData.productLimitValue,
2: "",
3: "",
4: this.formData.brandVal.join(","),
5: this.getLimitVal('category'),
6: this.getLimitVal('series')
}
return valueType[type]
},
async saveData(params) {
console.log('post params')
console.log(params)
let that = this
if (this.allreadonly) {
this.visiable = false;
return;
... ... @@ -514,6 +768,7 @@ export default {
const result = await api._post("/ufoPlatform/coupon/saveOrUpdateCoupon", {
id: params.id || void 0,
userType: params.userType,
couponName: params.couponName,
couponAmount: params.couponAmount,
couponNum: params.couponNum,
... ... @@ -521,14 +776,15 @@ export default {
useNum: params.useNum,
useLimitValue: params.useLimitValue,
productLimitType: params.productLimitType,
productLimitValue: params.productLimitValue,
productLimitValue: this.processProductLimitValue(params.productLimitType),
excludeProductIds: params.excludeProductIds,
remark: params.remark,
useLimitType:
parseInt(params.useLimitType) >= 0 ? params.useLimitType : void 0,
startTime: params.time[0] ? dayjs(params.time[0]).unix() : void 0,
endTime: params.time[1] ? dayjs(params.time[1]).unix() : void 0,
skupAllowType: params.skupAllowType,
businessClient: params.businessClient,
skupAllowType: params.skupAllowTypeLabel.join(","),
businessClient: params.businessClientLabel.join(","),
receiveStartTime: params.receiveTime[0]
? dayjs(params.receiveTime[0]).unix()
: void 0,
... ... @@ -589,7 +845,8 @@ export default {
const worksheet = workbook.Sheets[firstSheetName];
const results = XLSX.utils.sheet_to_json(worksheet);
this.formData.productLimitValue = results
this.formData[this.uploadProp] = results
.map(r => r["商品编码"])
.filter(r => r)
.join(",");
... ... @@ -625,4 +882,7 @@ export default {
height: 30px;
background-color: #f5f7f9;
}
.add-item {
margin-bottom: 10px;
}
</style>
... ...
... ... @@ -19,6 +19,12 @@
<i-form-item prop="time">
<i-date-picker type="datetimerange" v-model="filter.time" placeholder="开始-结束时间" format="yyyy-MM-dd HH:mm" style="width: 250px"></i-date-picker>
</i-form-item>
<i-form-item prop="userType">
<i-select placeholder="选择用户类型" v-model="filter.userType" style="width: 160px;">
<i-option :value="1">买家</i-option>
<i-option :value="2">卖家</i-option>
</i-select>
</i-form-item>
</i-form>
</LayoutFilter>
<LayoutTools>
... ... @@ -57,7 +63,8 @@ export default {
id: '',
name: '',
status: '',
time: ['', '']
time: ['', ''],
userType: ''
},
page: 1,
total: 0,
... ... @@ -66,6 +73,11 @@ export default {
title: 'ID',
key: 'id',
width: 80
},
{
title: '用户类型',
key: 'userType',
width: 180
}, {
title: '券名称',
key: 'name',
... ... @@ -127,12 +139,13 @@ export default {
},
created() {
this.$nextTick(() => {
const {page, id, name, status, startTime, endTime} = qs.parse(location.search ? location.search.slice(1) : '');
const {page, id, name, status, startTime, endTime, userType} = qs.parse(location.search ? location.search.slice(1) : '');
this.filter.id = id || this.filter.id;
this.filter.name = name ? decodeURIComponent(name) : this.filter.name;
this.filter.status = status ? parseInt(status) : this.filter.status;
this.filter.time = (startTime && endTime) ? [dayjs(startTime), dayjs(endTime)] : this.filter.time;
this.filter.userType = userType || this.filter.userType
this.page = page ? parseInt(page) : 1;
this.fetchData(this.filter, this.page);
... ... @@ -207,10 +220,12 @@ export default {
const result = await api._get('/ufoPlatform/coupon/queryCoupons', Object.assign({
page,
}, this.getParams(params)));
console.log(this.getParams(params), result)
if (result.code === 200) {
this.total = result.data.total;
this.data = result.data.coupons;
let coupons = result.data.coupons;
coupons.map(item => item.userType = (item.userType === 1 ? "买家" : "卖家"))
this.data = coupons;
this.$Loading.finish();
} else {
result.message && this.$Message.warning(result.message);
... ... @@ -229,7 +244,8 @@ export default {
status,
startTime,
endTime,
curTime
curTime,
userType:params.userType
};
}
},
... ...
<template>
<LayoutContent :breads="[{url: 'resource-list.html', title: '资源位列表'}, {title: '资源位编辑'}]">
<div class="resource-wrapper">
<div class="select-resource">
<div class="resource-item" :class="{ active: selectResource.id === i.id}" v-for="i in resourceCodeList"
@click="onResourceSelect(i)">
<DatePicker v-if="i.publishTimeStr" :clearable="false" type="datetime" v-model="i.publishTimeStr"
:readonly="selectResource.id !== i.id" style="width: 180px"></DatePicker>
<div>{{i.publishStatusStr}}</div>
</div>
</div>
<div>
<Button type="primary" @click="onCopyResourceSelect">复制</Button>
<Button type="error" @click="onRemoveResourceTime">删除</Button>
<Button type="warning" @click="onUpdateResourceTime">保存时间</Button>
</div>
</div>
<div class="main">
<div class="editor-container">
<i-card>
<p slot="title">{{title}}</p>
<draggable v-model="floorList" @start="drag=true" @end="drag=false">
<template v-for="(i, index) in floorList" >
<template v-for="(i, index) in floorList">
<div class="floor-item">
<div class="floor-image" v-if="i.template_name === 'focus'">
<img style="width: 100%" :src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<img style="width: 100%"
:src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -19,7 +37,8 @@
</div>
</div>
<div class="floor-image" v-if="i.template_name === 'singleImage'">
<img style="width: 100%" :src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<img style="width: 100%"
:src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -30,8 +49,10 @@
</div>
</div>
<div class="floor-image" v-if="i.template_name === 'twoPicture'">
<img style="width: 50%; height: 120px;" :src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<img style="width: 50%; height: 120px;" :src="i.data[1].src.split('?')[0] || require('assets/banner-img.png')">
<img style="width: 50%; height: 120px;"
:src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<img style="width: 50%; height: 120px;"
:src="i.data[1].src.split('?')[0] || require('assets/banner-img.png')">
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -43,13 +64,16 @@
</div>
<div class="floor-image-three-root" v-if="i.template_name === 'threePicture'">
<div class="floor-image-three">
<img class="floor-image-three-left" :src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<img class="floor-image-three-left"
:src="i.data[0].src.split('?')[0] || require('assets/banner-img.png')">
<div class="floor-image-three-right-root">
<img class="floor-image-three-right-item" :src="i.data[1].src.split('?')[0] || require('assets/banner-img.png')">
<img class="floor-image-three-right-item" :src="i.data[2].src.split('?')[0] || require('assets/banner-img.png')">
<img class="floor-image-three-right-item"
:src="i.data[1].src.split('?')[0] || require('assets/banner-img.png')">
<img class="floor-image-three-right-item"
:src="i.data[2].src.split('?')[0] || require('assets/banner-img.png')">
</div>
</div>
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -64,20 +88,20 @@
<div class="hot-image-list-title">{{name}}热门系列</div>
<div class="hot-image-list-body">
<div class="hot-image-list-item"
v-for="(item, index) in i.data"
:class="i.itemClass"
:key="index">
<img class="item-image"
:class="i.imageClass"
:src="item.src ? item.src.split('?')[0] : ''"
alt=""
srcset="" >
<p class="item-title"
:class="i.titleClass" >{{item.title}}</p>
v-for="(item, index) in i.data"
:class="i.itemClass"
:key="index">
<img class="item-image"
:class="i.imageClass"
:src="item.src ? item.src.split('?')[0] : ''"
alt=""
srcset="">
<p class="item-title"
:class="i.titleClass">{{item.title}}</p>
</div>
</div>
</div>
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -91,7 +115,7 @@
<div class="sort-tab-body">
<p class="sort-tab" v-for="(i, index ) in i.data" :key="index">{{i.title}}</p>
</div>
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -105,7 +129,7 @@
<div class="sort-tab-body">
<p class="sort-tab" v-for="(tab, index ) in i.data.list" :key="index">{{tab.tabName}}</p>
</div>
<div class="floor-mask">
<div class="floor-edit-buttons">
<a href="javascript:void(0)"
... ... @@ -132,9 +156,22 @@
</div>
<Modal v-model="show" @on-ok="onOk" @on-cancel="onCancel" :title="modalInfo.modalTitle" width="650">
<banner-editor ref="addEditor" v-model="modalData" :hideAddButton="modalInfo.hideAddButton"
:hideDeleteButton="true" :type="platform" :isSelectAction="modalInfo.isSelectAction" :templateName="modalInfo.template_name" :size="modalInfo.size"></banner-editor>
<Modal
v-model="show"
@on-ok="onOk"
@on-cancel="onCancel"
:title="modalInfo.modalTitle"
width="650">
<banner-editor
ref="addEditor"
v-model="modalData"
:hideAddButton="modalInfo.hideAddButton"
:hideDeleteButton="true"
:type="platform"
:isCustomImgSize="modalInfo.isCustomImgSize"
:isSelectAction="modalInfo.isSelectAction"
:templateName="modalInfo.template_name"
:size="modalInfo.size"></banner-editor>
</Modal>
</div>
</LayoutContent>
... ... @@ -147,6 +184,7 @@
import SmartFloor from '../../components/smart-floor';
import Divide from '../../components/divide';
import draggable from 'vuedraggable';
import dayjs from 'dayjs';
export default {
name: 'resourceEditNew',
... ... @@ -169,11 +207,14 @@
template_intro: '',
template_name: '',
hideAddButton: true,
isSelectAction: false
isSelectAction: false,
// 是否自定义图片大小
// 目前支持: 一张图、两张图
isCustomImgSize: false,
}, // 当前正在编辑的数据
singleData: {
data: {
"0":{
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -184,8 +225,11 @@
url: {
action: 'go.h5',
url: ''
}
}
},
// 图片高度|宽度
height: '',
width: ''
},
},
type: 3,
template_intro: '一张图',
... ... @@ -194,7 +238,7 @@
}, // 一张图的基础数据
twoData: {
data: {
"0":{
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -205,9 +249,12 @@
url: {
action: 'go.h5',
url: ''
}
},
// 图片高度|宽度
height: '',
width: ''
},
"1":{
'1': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -218,8 +265,11 @@
url: {
action: 'go.h5',
url: ''
}
}
},
// 图片高度|宽度
height: '',
width: ''
},
},
type: 4,
template_intro: '两张图',
... ... @@ -228,7 +278,7 @@
}, // 两张图的基础数据
threeData: {
data: {
"0":{
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -241,7 +291,7 @@
url: ''
}
},
"1":{
'1': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -254,7 +304,7 @@
url: ''
}
},
"2":{
'2': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -273,10 +323,10 @@
template_name: 'threePicture',
resContentId: 0
}, // 三张图的基础数据
imageListData: {
imageListData: {
data: {
list:{
"0":{
list: {
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -298,8 +348,8 @@
}, // 图片列表的基础数据
guessLikeData: {
data: {
list:{
"0":{
list: {
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -321,10 +371,10 @@
}, // 猜你喜欢Tab的基础数据
tabFloorData: {
data: {
list:{
"0":{
tabName: "",
code: "",
list: {
'0': {
tabName: '',
code: '',
// business: "new",
hideDeleteButton: true,
url: {
... ... @@ -341,8 +391,8 @@
}, // 猜你喜欢Tab的基础数据
foucsData: {
data: {
list:{
"0":{
list: {
'0': {
alt: '',
bgColor: '',
imgId: '0',
... ... @@ -369,15 +419,28 @@
uploadData: {
id: util.getQueryString('id'),
items: []
} // 最终上传给服务器的data
}, // 最终上传给服务器的data
resourceCodeList: [],
selectResource: {
id: -1
}
};
},
watch: {
selectResource(newVal) {
this.resId = newVal.id;
this.uploadData.id = newVal.id;
this.getResourceDetailList();
}
},
mounted() {
this.resId = util.getQueryString('id');
this.platform = util.getQueryString('platform');
this.title = util.getQueryString('name');
this.code = util.getQueryString('code');
this.resourceService = new ResourceService();
this.getResourceDetailList();
this.getResourceListByCode();
},
methods: {
getResourceDetailList() {
... ... @@ -387,6 +450,12 @@
this.manageFloorList(result);
});
},
getResourceListByCode() {
this.resourceService.listByCode(this.code).then(result => {
this.resourceCodeList = result.data;
this.selectResource = result.data[0];
});
},
manageAllData(data) {
this.uploadData.items = [];
for (let i = 0; i < data.length; i++) {
... ... @@ -406,18 +475,18 @@
let item = JSON.parse(data[i].data);
item.resContentId = data[i].resContentId;
item.type = data[i].type;
if(item.template_name === 'imageList' && item.size == 5){
if (item.template_name === 'imageList' && item.size == 5) {
item.itemClass = 'hot-image-list-item-5';
item.titleClass = 'item-title-5';
item.imageClass = 'item-image-5';
}else {
} else {
item.itemClass = '';
item.titleClass = '';
item.imageClass = '';
}
this.floorList.push(item);
}
},
showModal(type, data, index) {
... ... @@ -425,9 +494,10 @@
let modalTitle = '';
let hideAddButton = true;
let isSelectAction = false;
let isCustomImgSize = false;
let forData = data.data.list
if(!forData){
let forData = data.data.list;
if (!forData) {
forData = data.data;
}
for (let i in forData) {
... ... @@ -441,12 +511,14 @@
modalTitle = '一张图';
hideAddButton = true;
isSelectAction = false;
isCustomImgSize = true;
break;
case 'twoPicture':
modalType = 4;
modalTitle = '两张图';
hideAddButton = true;
isSelectAction = false;
isCustomImgSize = true;
break;
case 'threePicture':
modalType = 5;
... ... @@ -465,7 +537,7 @@
modalTitle = '商品池';
hideAddButton = false;
isSelectAction = true;
break;
break;
case 'tabFloor':
modalType = 8;
modalTitle = '首页频道Tab';
... ... @@ -477,8 +549,8 @@
modalTitle = '焦点图';
hideAddButton = false;
isSelectAction = false;
break;
break;
default:
break;
}
... ... @@ -493,8 +565,9 @@
this.modalInfo.floorIndex = index;
this.modalInfo.hideAddButton = hideAddButton;
this.modalInfo.isSelectAction = isSelectAction;
this.modalInfo.isCustomImgSize = isCustomImgSize;
this.show = true;
}
},
showDeleteModal(index) { // 确认删除对话框
... ... @@ -505,7 +578,7 @@
onOk: () => {
this.uploadData.items.splice(index, 1);
this.resourceService.addOrUpdateResourceDetail(this.uploadData).then(res => {
if (res && res.code === 2000) {
if (res && res.code === 200) {
this.$Message.success(res.message || '修改成功!');
this.getResourceDetailList();
} else {
... ... @@ -530,8 +603,8 @@
let modalValue = this.$refs.addEditor.getValue();
let size = this.$refs.addEditor.getType();
let length = 0;
for(let key in modalValue) { // 提交空数据的判断
length ++ ;
for (let key in modalValue) { // 提交空数据的判断
length++;
if (modalValue[key].url.url === '') {
this.modalData = [];
this.$Message.error('请填写所有信息后再提交!');
... ... @@ -547,14 +620,14 @@
let dataResult = modalValue;
if(this.modalInfo.template_name === 'tabFloor'){
if (this.modalInfo.template_name === 'tabFloor') {
dataResult = {
list: modalValue,
};
}
let name = this.modalInfo.template_name;
let intro =this.modalInfo.template_intro;
let intro = this.modalInfo.template_intro;
let data = {
id: this.modalInfo.resContentId,
contentName: '楼层' + (this.floorList.length + 1),
... ... @@ -570,7 +643,7 @@
if (this.modalInfo.floorIndex === -1) { // floorIndex=0时为新增,其他情况则替换相应楼层的数据
this.uploadData.items.push(data);
} else {
data = Object.assign(data, {contentName: this.uploadData.items[this.modalInfo.floorIndex].contentName});
data = Object.assign(data, { contentName: this.uploadData.items[this.modalInfo.floorIndex].contentName });
this.uploadData.items[this.modalInfo.floorIndex] = data;
}
... ... @@ -607,98 +680,129 @@
size: '0'
};
this.show = false;
},
onResourceSelect(i) {
this.selectResource = i;
},
onCopyResourceSelect() {
this.resourceService.createResourceTime({
...this.selectResource
}).then(result => {
}).finally(() => {
this.getResourceListByCode();
});
},
onRemoveResourceTime() {
this.resourceService.deleteResourceTime(this.selectResource).then(result => {
}).finally(() => {
this.getResourceListByCode();
});
},
onUpdateResourceTime() {
this.resourceService.updateResourceTimeStr({
...this.selectResource,
publishTimeStr: dayjs(this.selectResource.publishTimeStr).format('YYYY-MM-DD HH:mm:ss')
}).then(result => {
}).finally(() => {
this.resourceService.listByCode(this.code).then(result => {
this.resourceCodeList = result.data;
});
});
}
}
};
</script>
<style>
<style lang="scss" scoped>
.main {
display: flex;
width: 100%;
height: 100%;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
display: flex;
width: 100%;
height: 100%;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
}
.ivu-card-head p {
text-align: center;
text-align: center;
}
.editor-container {
width: 500px;
height: 100%;
flex-shrink: 0;
border-right: 1px solid #e4e4e4;
overflow-x: hidden;
overflow-y: scroll;
width: 500px;
height: 100%;
flex-shrink: 0;
border-right: 1px solid #e4e4e4;
overflow-x: hidden;
overflow-y: scroll;
}
.button-container {
width: 50%;
flex-grow: 1;
width: 50%;
flex-grow: 1;
}
.button-container button {
margin: 10px;
margin: 10px;
}
.floor-item {
position: relative;
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
overflow: hidden;
background-color: #fff;
position: relative;
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
overflow: hidden;
background-color: #fff;
}
.floor-image {
width: 100%;
margin: 5px 5px 5px 5px;
width: 100%;
margin: 5px 5px 5px 5px;
}
.floor-image img {
width: 100%;
float: left;
width: 100%;
float: left;
}
.floor-item:hover .floor-mask {
display: block;
display: block;
}
.floor-mask {
display: none;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
left: 0;
top: 0;
z-index: 19;
display: none;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
left: 0;
top: 0;
z-index: 19;
}
.floor-mask .floor-edit-buttons {
position: absolute;
width: 100px;
right: 0;
top: 0;
z-index: 20;
position: absolute;
width: 100px;
right: 0;
top: 0;
z-index: 20;
}
.floor-mask .floor-edit-buttons a {
display: inline-block;
width: 40px;
box-sizing: border-box;
background-color: gray;
color: #fff;
margin: 0 5px;
float: left;
text-align: center;
display: inline-block;
width: 40px;
box-sizing: border-box;
background-color: gray;
color: #fff;
margin: 0 5px;
float: left;
text-align: center;
}
.floor-image-three-root {
... ... @@ -707,12 +811,14 @@
width: 100%;
margin: 5px 5px 5px 5px;
}
.floor-image-three {
display: flex;
flex-direction: row;
width: 100%;
height: 200px;
}
.floor-image-three-left {
width: 40%;
height: 100%;
... ... @@ -736,15 +842,15 @@
}
.hot-image-list {
background-color: white;
width: 100%;
margin: 5px 5px 5px 5px;
background-color: white;
width: 100%;
margin: 5px 5px 5px 5px;
}
.hot-image-list-title {
font-size: 25px;
text-align: left;
padding-top: 10px;
font-size: 25px;
text-align: left;
padding-top: 10px;
}
.hot-image-list-body {
... ... @@ -765,18 +871,19 @@
flex-shrink: 0;
height: 150px;
}
.hot-image-list-item-5 {
flex: 0 0 20%;
height: 120px;
}
.item-image {
margin-top: 10px;
object-fit: contain;
width: 100%;
height: 100px;
/* align-content: center;
justify-content: center; */
margin-top: 10px;
object-fit: contain;
width: 100%;
height: 100px;
/* align-content: center;
justify-content: center; */
}
.item-image-5 {
... ... @@ -784,21 +891,21 @@
}
.item-title {
width: 110px;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
text-align: center;
/* -webkit-line-clamp: 1; */
/* max-lines: 1; */
/* line-clamp: 1; */
white-space: nowrap;
display: inline-block;
/* display: -webkit-box; */
/* display: inline-flex; */
--webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
width: 110px;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
text-align: center;
/* -webkit-line-clamp: 1; */
/* max-lines: 1; */
/* line-clamp: 1; */
white-space: nowrap;
display: inline-block;
/* display: -webkit-box; */
/* display: inline-flex; */
--webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.item-title-5 {
... ... @@ -814,4 +921,34 @@
padding-right: 10px;
padding-left: 10px;
}
</style>
\ No newline at end of file
.resource-wrapper {
margin-top: 20px;
margin-bottom: 20px;
}
.select-resource {
display: flex;
flex-wrap: wrap;
}
.resource-item {
width: 200px;
height: 70px;
padding: 10px;
border-bottom: 2px solid #2d8cf0;
box-sizing: border-box;
text-align: center;
&.active {
border-top: 2px solid #2d8cf0;
border-left: 2px solid #2d8cf0;
border-right: 2px solid #2d8cf0;
border-bottom: none;
font-weight: bold;
}
}
</style>
... ...
<template>
<LayoutContent :breads="[{title: '资源位列表'}]">
<div>
<LayoutFilter @on-filter="onFilter" @on-clear="onClear">
<i-form ref="filterForm" inline :model="filter">
<i-form-item prop="id">
<i-input placeholder="输入ID" v-model="filter.id"></i-input>
</i-form-item>
<i-form-item prop="name">
<i-input placeholder="资源位名称" v-model="filter.name"></i-input>
</i-form-item>
<i-form-item prop="code">
<i-input placeholder="code码" v-model="filter.code"></i-input>
</i-form-item>
<i-form-item prop="platformId">
<i-select placeholder="平台" v-model="filter.platformId" style="width: 100px;">
<i-option value="1">App</i-option>
<i-option value="2">小程序</i-option>
<i-option value="3">H5</i-option>
</i-select>
</i-form-item>
<!-- <i-form-item prop="time">
<i-date-picker type="datetimerange" v-model="filter.time" placeholder="开始-结束时间" format="yyyy-MM-dd HH:mm" style="width: 250px"></i-date-picker>
</i-form-item> -->
</i-form>
</LayoutFilter>
<LayoutTools>
<i-button type="primary" @click="showAddResourcePannel(true)">添加资源位</i-button>
</div>
<LayoutTable :columns="columns" :data="data">
</LayoutTools>
<LayoutTable
:columns="columns"
:page="page"
:total="total"
@on-page-change="onPageChange"
:data="data">
</LayoutTable>
<!--添加资源位弹出层-->
<div v-if="showAddPan" class="resource-add-container">
... ... @@ -38,7 +68,6 @@
</i-card>
</div>
</LayoutContent>
</template>
<script>
... ... @@ -51,27 +80,37 @@ export default {
name: 'resourcelist',
data() {
return {
filter: {
id: '',
name: '',
code: '',
platformId: '',
// time: ['', '']
},
page: 1,
total: 0,
data: [],
columns: [{
title: 'ID',
key: 'id',
width: 100
width: 80
}, {
title: '资源名称',
key: 'name',
width: 200
width: 200,
align: 'center',
}, {
title: '平台',
key: 'platform',
width: 100,
width: 120
}, {
title: '位置码',
key: 'code',
width: 300
align: 'center',
}, {
title: '创建时间',
key: 'createTime',
width: 200,
align: 'center',
render: (h, {row}) => {
/*return (
<div>{dayjs.unix(row.createTime).format('YYYY-MM-DD HH:mm:ss')}</div>
... ... @@ -80,7 +119,6 @@ export default {
}
}, {
title: '操作',
width: 270,
align: 'center',
render: (h, {row}) => {
/*return (
... ... @@ -105,26 +143,38 @@ export default {
this.fetchData();
},
methods: {
onToEditor({id, name, sortId, platform}) {
onPageChange(page) {
this.fetchData(this.filter, page);
},
onClear() {
this.$refs.filterForm.resetFields();
this.fetchData(this.filter);
},
onFilter() {
this.fetchData(this.filter);
},
onToEditor({id, name, sortId, platform, code}) {
if (sortId === 2) {
util.jumpUrl(`resource-edit.html?id=${id}&name=${name}&platform=${platform}`);
} else if(sortId === 3) {
util.jumpUrl(`resource-edit-new.html?id=${id}&name=${name}&platform=${platform}`);
util.jumpUrl(`resource-edit-new.html?id=${id}&name=${name}&platform=${platform}&code=${code}&sortId=${sortId}`);
}
},
async fetchData() {
async fetchData(params, page = 1) {
this.page = page;
this.$Loading.start();
const result = await this.resourceService.list();
const result = await this.resourceService.list({page, ...params});
if (result.code === 200) {
for (let i = 0; i < result.data.length; i++) {
result.data[i].showEditButton = 'inline-block';
if (result.data[i].sortId === 2) {
result.data[i].showEditButton = 'none';
for (let i = 0; i < result.data.list.length; i++) {
result.data.list[i].showEditButton = 'inline-block';
if (result.data.list[i].sortId === 2) {
result.data.list[i].showEditButton = 'none';
}
}
this.data = result.data;
this.total = result.data.total;
this.data = result.data.list || [];
this.$Loading.finish();
} else {
result.message && this.$Message.warning(result.message);
... ... @@ -150,7 +200,7 @@ export default {
if (result && result.code === 200) {
self.showAddPan = false;
self.$Message.success('保存成功!');
self.fetchData();
self.fetchData(this.filter);
self.platform = '1';
self.editResourceId = 0;
self.resourceName = '';
... ... @@ -198,7 +248,7 @@ export default {
.ivu-row:hover {
background-color: #aefdff;
}
.ivu-col {
text-align: center;
height: 50px;
... ... @@ -208,9 +258,4 @@ export default {
.ivu-col:nth-child(odd) {
border-right: 1px solid #e4e4e4;
}
.ivu-card-body {
margin: 0;
padding: 0;
}
</style>
... ...
... ... @@ -65,9 +65,9 @@ export default {
methods: {
onAddClick() {
this.rules.push({
min: 0,
max: 0,
rate: 0,
min: '',
max: '',
rate: '',
index: this.genId()
});
},
... ... @@ -78,9 +78,9 @@ export default {
ruleParam: {
rules: vm.rules.map(i => {
return {
min: Number(i.min),
max: Number(i.max),
rate: Number(i.rate)
min: i.min,
max: i.max,
rate: i.rate
};
})
}
... ...
... ... @@ -27,101 +27,7 @@ export default {
let vm = this;
return {
data: [
{
enterType: 0, //0:非入驻,1:普通入驻,2:超级
ruleParam: {
rules: [
{
min: 0,
max: 9,
rate: 0.04
},
{
min: 10,
max: 19,
rate: 0.048
},
{
min: 20,
max: 49,
rate: 0.047
},
{
min: 50,
max: 99,
rate: 0.045
},
{
min: 100,
rate: 0.04
}
]
}
},
{
enterType: 1, //0:非入驻,1:普通入驻,2:超级
ruleParam: {
rules: [
{
min: 0,
max: 9,
rate: 0.05
},
{
min: 10,
max: 19,
rate: 0.048
},
{
min: 20,
max: 49,
rate: 0.047
},
{
min: 50,
max: 99,
rate: 0.045
},
{
min: 100,
rate: 0.04
}
]
}
},
{
enterType: 2, //0:非入驻,1:普通入驻,2:超级
ruleParam: {
rules: [
{
min: 0,
max: 9,
rate: 0.06
},
{
min: 10,
max: 19,
rate: 0.048
},
{
min: 20,
max: 49,
rate: 0.047
},
{
min: 50,
max: 99,
rate: 0.045
},
{
min: 100,
rate: 0.04
}
]
}
}
],
data: [],
columns: [
{
type: "index",
... ...
<template>
<FormItem>
<span>订单数</span>
<i-input type="number" v-model="data.min" style="width: 100px"></i-input>
<i-input v-model="data.min" style="width: 100px"></i-input>
<span>-</span>
<i-input type="number" v-model="data.max" style="width: 100px"></i-input>
<i-input v-model="data.max" style="width: 100px"></i-input>
<span style="margin-left: 10px;">平台服务费</span>
<i-input type="number" v-model="data.rate" style="width: 100px"></i-input>
<i-input v-model="data.rate" style="width: 100px"></i-input>
<Button style="margin-left: 10px;" type="error" :key="index" @click="onRemoveClick">X</Button>
</FormItem>
... ... @@ -37,4 +37,4 @@ export default {
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
</style>
... ...
... ... @@ -1954,10 +1954,10 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"
dayjs@^1.7.7:
version "1.8.17"
resolved "http://npm.yohops.com/dayjs/-/dayjs-1.8.17.tgz#53ec413f2a7b02afbea1846d61bb260fa8567cea"
integrity sha1-U+xBPyp7Aq++oYRtYbsmD6hWfOo=
dayjs@^1.8.21:
version "1.8.21"
resolved "http://npm.yohops.com/dayjs/-/dayjs-1.8.21.tgz#98299185b72b9b679f31c7ed987b63923c961552"
integrity sha1-mCmRhbcrm2efMcftmHtjkjyWFVI=
de-indent@^1.0.2:
version "1.0.2"
... ...