201 changed files with 216 additions and 27895 deletions
Binary file not shown.
@ -1,218 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
const url = '/api/admin'; |
|||
|
|||
/** |
|||
* 广告计划--获取列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_LIST(params) { |
|||
return request({ |
|||
url: url + "/ad/plans", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 广告计划--新建广告 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_LIST(params) { |
|||
return request({ |
|||
url: url + "/ad/plans", |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
|
|||
|
|||
} |
|||
|
|||
/** |
|||
* 广告计划--更新广告 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_LIST(params) { |
|||
return request({ |
|||
url: url + "/ad/plans?id=" + params.id, |
|||
method: 'put', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 广告计划--广告详情 * @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_LIST(params) { |
|||
return request({ |
|||
url: url + "/ad/plans/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 广告计划--删除某项 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_ITEM(params) { |
|||
return request({ |
|||
url: url + "/ad/plans", |
|||
method: 'delete', |
|||
params: { |
|||
id: params |
|||
} |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 广告计划--发布广告 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUBLISH(params) { |
|||
return request({ |
|||
url: url + "/ad/plans/publish", |
|||
method: 'post', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 广告计划--暂停 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PAUSEDANDPENDING(params) { |
|||
return request({ |
|||
url: url + "/ad/plans/pause", |
|||
method: 'post', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 广告计划--获取设备类型 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function EQUIPMENTTYPE(params) { |
|||
return request({ |
|||
url: url + "/devices/types", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 广告计划--获取广告位类型 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ADVERTISINGSPACETYPE(params) { |
|||
return request({ |
|||
url: url + "/ad/plans/adSpaces", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 广告计划--获取设备 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function EQUIPMENT(params) { |
|||
return request({ |
|||
url: url + "/devices", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 广告计划-- 列表总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DEVICES_COUNT(params) { |
|||
return request({ |
|||
url: url + "/ad/plans/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 素材管理--列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_RESOURCES(params) { |
|||
return request({ |
|||
url: url + "/ad/resources", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 素材管理--上传 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_RESOURCES(params) { |
|||
return request({ |
|||
url: url + "/ad/resources", |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 素材管理--删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_RESOURCES(params) { |
|||
return request({ |
|||
url: url + "/ad/resources", |
|||
method: 'delete', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
@ -1,215 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* 商品列表--获取列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/products", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品列表--新建商品 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ADD_ITEM(params) { |
|||
return request({ |
|||
url: "/api/admin/products", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品列表--更新商品 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function UPDATE_ITEM(params) { |
|||
return request({ |
|||
url: "/api/admin/products?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品列表--商品详情 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_ITEM(params) { |
|||
return request({ |
|||
url: "/api/admin/products/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品列表--删除 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_ITEM(params) { |
|||
return request({ |
|||
url: "/api/admin/products", |
|||
method: 'delete', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品列表--总数 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT(params) { |
|||
return request({ |
|||
url: "/api/admin/products/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_LIST_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--新建分类 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--更新分类 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function UPDATE_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--更新分类顺序 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ORDERS_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories/orders?ids=" + params.ids.toString(), |
|||
method: 'POST', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--设置分类商品 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PRODUCTS_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories/products", |
|||
method: 'POST', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--删除分类 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_CATEGORIES(params) { |
|||
return request({ |
|||
url: "/api/admin/categories", |
|||
method: 'delete', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 商品分类--删除分类商品 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_CATEGORIES_PRODUCTS(params) { |
|||
return request({ |
|||
url: "/api/admin/categories/products", |
|||
method: 'delete', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,90 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function GET_DEVICE_TYPES(params) { |
|||
return request({ |
|||
url: "/api/admin/devices/types", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
export function GET_DEVICE_DEVICEGROUPS(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_LOCATIONS(params) { |
|||
return request({ |
|||
url: "/api/admin/locations/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
export function GET_COUPONS(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
export function GET_VIPVARDS(params) { |
|||
return request({ |
|||
url: "/api/admin/vipCards/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
export function GET_ROLES(params) { |
|||
return request({ |
|||
url: "/api/admin/roles/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_DEVICE_GROUPS_TOTAL(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_DEIVCE_GROUPS_ALL(total) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups", |
|||
method: 'get', |
|||
params: { |
|||
from: 0, |
|||
size: total |
|||
} |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_LOCALTION_TYPE(params) { |
|||
return request({ |
|||
url: "/api/admin/locations/types", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
export function GET_clientsSel(params) { |
|||
return request({ |
|||
url: "/api/admin/clients/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,102 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function get_analytics_summary(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/summary", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data || 0) |
|||
} |
|||
export function get_analytics_sale(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/sale", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data || 0) |
|||
} |
|||
|
|||
export function get_analytics_income(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/income", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data || 0) |
|||
} |
|||
|
|||
export function get_analytics_orders(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/orders", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data || 0) |
|||
} |
|||
export function get_analytics_profits(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/profit", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data || 0) |
|||
} |
|||
// / 运营分析 - 销售额折线图
|
|||
export function get_analytics_trend_sale(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/trend/sale", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_analytics_trend_income(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/trend/income", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_analytics_trend_orders(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/trend/orders", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_analytics_trend_profits(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/trend/profit", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
// /首页 / 场地销售排行
|
|||
export function get_analytics_locations(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/locations", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_analytics_categories(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/categories", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_analytics_producsts(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/products", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_analytics_devices(params) { |
|||
return request({ |
|||
url: "/api/admin/analytics/devices", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,134 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function GET_DEVICE_LISTS(params) { |
|||
return request({ |
|||
url: "/api/admin/devices", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data).then(array => { |
|||
return array.map(item => { |
|||
item.checked = false; |
|||
item.disabled = false; |
|||
return item |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
export function GET_LIST_TOTAL(params) { |
|||
return request({ |
|||
url: "/api/admin/devices/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_DEVICES_NUM(params) { |
|||
return request({ |
|||
url: "/api/admin/devices/summary", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function ADD_DEVICE(data) { |
|||
//deviceTypeId =>typeId
|
|||
if (data.deviceTypeId) { data.typeId = data.deviceTypeId } |
|||
return request({ |
|||
url: "/api/admin/devices", |
|||
method: 'post', |
|||
data, |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_DEVICE_DETAIL(params) { |
|||
return request({ |
|||
url: "/api/admin/devices/detail", |
|||
method: 'get', |
|||
params: { |
|||
id: params.id |
|||
} |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
export function UPDATE_DEVICE(params) { |
|||
return request({ |
|||
url: `/api/admin/devices/update?id=${params.id}`, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function GET_CODE(id) { |
|||
return request({ |
|||
url: "/api/admin/devices/qrcodeText", |
|||
method: 'get', |
|||
params: { deviceId: id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function GET_wxCODE(id) { |
|||
return request({ |
|||
url: "/api/admin/devices/qrcode", |
|||
method: 'get', |
|||
params: { deviceId: id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//设备分组
|
|||
export function GET_DEVICE_GROUPS(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//设备分组 总数
|
|||
export function GET_DEVICE_GROUPS_TOTAL(query) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups/count", |
|||
method: 'get', |
|||
params: { |
|||
query |
|||
} |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//add new groups
|
|||
export function ADD_DEVICE_GROUPS(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//delete groups
|
|||
export function DELETE_DEVICE_GROUPS(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups", |
|||
method: 'delete', |
|||
data: params, |
|||
params: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//update groups
|
|||
export function UPDATE_DEVICE_GROUPS(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups", |
|||
method: 'put', |
|||
data: params, |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
//add device into groups
|
|||
export function ADD_DEVICES_INTO_GROUP(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceGroups/addDevices", |
|||
method: 'post', |
|||
data: params, |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,69 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function get_shelfs_device_lists(params) { |
|||
return request({ |
|||
url: "/api/admin/shelfs/devices", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
export function get_shelfs_device_summary(params) { |
|||
return request({ |
|||
url: "/api/admin/shelfs/devices/summary", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
export function get_shelfs_device_detail(id) { |
|||
return request({ |
|||
url: "/api/admin/shelfs/devices/detail", |
|||
method: 'get', |
|||
params: { id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_shelfs_device_detail_vm(id) { |
|||
return request({ |
|||
url: "/api/admin/shelfs/devices/vmDetail", |
|||
method: 'get', |
|||
params: { id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function put_shelfs_device_detail(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/devices?deviceId=${params.deviceId}`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function put_shelfs_device_detail_vm(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/devices/vm?deviceId=${params.deviceId}`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
// api/admin/shelfs/devices/vmDetail
|
|||
export function shelfs_devices_vmDetail(id) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/devices/vmDetail?id=${id}`, |
|||
method: 'get', |
|||
data: { id } |
|||
}).then(res => res.data.data.rows) |
|||
} |
|||
//修改 大售货机状态/
|
|||
export function post_shelfs_devices_vmDetail(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/devices/vm?deviceId=${params.deviceId}`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,182 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
/** |
|||
* 设备分润 -- 列表 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 设备分润 -- 保存分润 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties", |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 设备分润 -- 分润详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 设备分润 -- 分润总数 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 设备分润 -- 生效 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ENABLE_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties/enable", |
|||
method: 'post', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 设备分润 -- 失效 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DISABLE_EQUIPMENT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/deviceRoyalties/disable", |
|||
method: 'post', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 场地分润 -- 列表 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 场地分润 -- 保存分润 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties", |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 场地分润 -- 分润总数 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 场地分润 -- 分润详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 场地分润 -- 生效 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ENABLE_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties/enable", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 场地分润 -- 失效 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DISABLE_FIELD_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/locationRoyalties/disable", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,44 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* 财务 -- 概览 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function SUMMARY(params) { |
|||
return request({ |
|||
url: "/api/admin/settlement/summary", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 财务 -- 交易记录 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function TRANSACTIONS(params) { |
|||
return request({ |
|||
url: "/api/admin/settlement/transactions", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 财务 -- 交易记录总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function TRANSACTIONS_COUNT(params) { |
|||
return request({ |
|||
url: "/api/admin/settlement/transactions/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
@ -1,84 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function get_list(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_list_total(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_total_stock(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/totalStock", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_list_in_locations(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/stockLocations", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_list_in_locations_total(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/stockLocations/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function post_stockin(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/stockin", |
|||
method: 'post', |
|||
data: params, |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function post_return(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/return", |
|||
method: 'post', |
|||
data: params, |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function post_transfer(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/transfer", |
|||
method: 'post', |
|||
data: params, |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_list_audits(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/audits", |
|||
method: 'get', |
|||
params, |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function get_list_audits_total(params) { |
|||
return request({ |
|||
url: "/api/admin/inventory/audits/count", |
|||
method: 'get', |
|||
params, |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function get_audits_detail(id) { |
|||
return request({ |
|||
url: `/api/admin/inventory/audits/detail?id=${id}`, |
|||
method: 'get', |
|||
// params,
|
|||
}).then(res => res.data.data) |
|||
} |
|||
|
@ -0,0 +1,36 @@ |
|||
import request from '@/utils/request' |
|||
const admin = '/back/admin' |
|||
|
|||
|
|||
/** |
|||
* 查询账户列表 |
|||
*/ |
|||
export function GET_LIST(params) { |
|||
return request({ |
|||
url: `${admin}/list`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data) |
|||
} |
|||
|
|||
/** |
|||
* 重置管理员密码 |
|||
*/ |
|||
export function RESET_PASSWORD(params) { |
|||
return request({ |
|||
url: `${admin}/resetPassword`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data) |
|||
} |
|||
|
|||
/** |
|||
* 删除管理员账户 |
|||
*/ |
|||
export function DELETE_ADMIN(params) { |
|||
return request({ |
|||
url: `${admin}/delete`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data) |
|||
} |
@ -1,60 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function getLocationList(params) { |
|||
return request({ |
|||
url: '/api/admin/locations', |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function addLocaltion(params) { |
|||
return request({ |
|||
url: '/api/admin/locations', |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function updateLocaltion(params) { |
|||
return request({ |
|||
url: `/api/admin/locations?id=${params.id}`, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function deleteLocaltion(params) { |
|||
return request({ |
|||
url: '/api/admin/locations', |
|||
method: 'delete', |
|||
data: params, |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function localtionDetail(id) { |
|||
return request({ |
|||
url: '/api/admin/locations/detail', |
|||
method: 'get', |
|||
params: { id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function addDevices2localtion(params) { |
|||
return request({ |
|||
url: '/api/admin/locations/addDevices', |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function deleteDevices2localtion(params) { |
|||
return request({ |
|||
url: '/api/admin/locations/deleteDevice', |
|||
method: 'post', |
|||
data: params, |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function getLocaltionTotal(params) { |
|||
return request({ |
|||
url: '/api/admin/locations/count', |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,652 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* todo 优惠券API |
|||
*/ |
|||
|
|||
/** |
|||
* 优惠券 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_couponManagement_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 优惠券 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 优惠券 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 优惠券 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 优惠券 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons?id=" + params, |
|||
method: 'delete', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 优惠券 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 优惠券 -- 开始投放 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ENABLE_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/enable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 优惠券 -- 暂停投放 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DISABLE_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 优惠券 -- 调整库存 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function updateStock_coupons(params) { |
|||
return request({ |
|||
url: "/api/admin/coupons/updateStock", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* TODO 新手有礼API |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* 新手有礼 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_couponOffers_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新手有礼 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新手有礼 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 新手有礼 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 新手有礼 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers?id=" + params, |
|||
method: 'delete' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新手有礼 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新手有礼 -- 失效 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function disable_couponOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/couponOffers/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* TODO 支付有礼API |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* 支付有礼 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_payGiftOffers_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 支付有礼 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 支付有礼 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers?id="+ params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 支付有礼 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 支付有礼 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers?id=" + params, |
|||
method: 'delete' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 支付有礼 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 支付有礼 -- 失效 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function disable_payGiftOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/payGiftOffers/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* TODO 促销活动API |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* 促销活动 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_discountOffers_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 促销活动 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 促销活动 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers?id="+ params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 促销活动 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 促销活动 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers?id=" + params, |
|||
method: 'delete' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 促销活动 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 促销活动 -- 失效 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function disable_discountOffers(params) { |
|||
return request({ |
|||
url: "/api/admin/discountOffers/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* TODO 幸运免单API |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_luckfree_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree?id="+ params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 幸运免单 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 幸运免单 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree?id=" + params, |
|||
method: 'delete' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 失效 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function disable_luckfree(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 幸运免单 -- 计算 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function luckfree_calculate(params) { |
|||
return request({ |
|||
url: "/api/admin/luckfree/calculate", |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* TODO 抽奖活动API |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* 抽奖活动 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_lottery_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 抽奖活动 -- 新建 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 抽奖活动 -- 更新 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery?id="+ params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 抽奖活动 -- 详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery/detail?id=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 抽奖活动 -- 删除 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery?id=" + params, |
|||
method: 'delete' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 抽奖活动 -- 总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 抽奖活动 -- 失效 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function disable_lottery(params) { |
|||
return request({ |
|||
url: "/api/admin/lottery/disable?id=" + params, |
|||
method: 'post' |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
@ -1,44 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* 销售订单 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_ORDER_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/orders", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 销售订单 -- 订单详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_ORDER(params) { |
|||
return request({ |
|||
url: "/api/admin/orders/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 销售订单 -- 订单总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_ORDER(params) { |
|||
return request({ |
|||
url: "/api/admin/orders/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
@ -1,60 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* 组织管理 -- 组织列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_clients(params) { |
|||
return request({ |
|||
url: "/api/admin/clients", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 组织管理 -- 新建组织 |
|||
* @param params |
|||
* @returns {Q.Promise<any>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_clients(params) { |
|||
return request({ |
|||
url: "/api/admin/clients", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 组织管理 -- 更新组织 |
|||
* @param params |
|||
* @returns {Q.Promise<any>} |
|||
* @constructor |
|||
*/ |
|||
export function PUT_clients(params) { |
|||
return request({ |
|||
url: "/api/admin/clients?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
/** |
|||
* 组织管理 -- 组织详情 |
|||
* @param params |
|||
* @returns {Q.Promise<any>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_clients(params) { |
|||
return request({ |
|||
url: "/api/admin/clients/detail?id=" + params, |
|||
method: 'get' |
|||
}).then(res => res.data.data) |
|||
} |
@ -1,203 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 账户列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 新建账号 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ADD_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 更新账号 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function UPDATE_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 启用账号 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ENABLE_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts/enable?id=" + params.id, |
|||
method: 'POST', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 禁用账号 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DISABLE_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts/disable?id=" + params.id, |
|||
method: 'POST', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 删除账号 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DELETE_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts", |
|||
method: 'delete', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 账号详情 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function DETAIL_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 修改密码 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function PASSWORD_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts/changePassword?id=" + params.id + '&password=' + params.password, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 账户管理 -- 列表总数 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function COUNT_ACCOUNT_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/accounts/count?clientId=" + params, |
|||
method: 'get', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 角色管理 -- 列表 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ROLES_LIST(params) { |
|||
return request({ |
|||
url: "/api/admin/roles", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 角色管理 -- 列表筛选 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ROLES_SEL(params) { |
|||
return request({ |
|||
url: "/api/admin/roles/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 角色管理 -- 新建角色 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ROLES_POST(params) { |
|||
return request({ |
|||
url: "/api/admin/roles", |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 角色管理 -- 更新角色 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ROLES_PUT(params) { |
|||
return request({ |
|||
url: "/api/admin/roles?id=" + params.id, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 角色管理 -- 删除角色 |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function ROLES_DELETE(params) { |
|||
return request({ |
|||
url: "/api/admin/roles", |
|||
method: 'delete', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,70 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
/** |
|||
* 货道补货 -- 酒店售货机 and 自助售货机 详情 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_DEVICEINFO(params) { |
|||
return request({ |
|||
url: "/api/admin/restocks/deviceInfo?deviceId=" + params, |
|||
method: 'get', |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 货道补货 -- 酒店售货机 and 自助售货机 开门补货 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_RESTOCKS(params) { |
|||
return request({ |
|||
url: "/api/admin/restocks?deviceId=" + params.deviceId, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 货道补货 -- 一键开门 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_OPENDOOR(params) { |
|||
return request({ |
|||
url: "/api/admin/quxia/remote/openDoors?deviceId=" + params.deviceId, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 货道补货 -- 酒店售货机 确认补货 |
|||
* @param params |
|||
* @returns {Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function POST_RESTOCKS_UPDATE(params) { |
|||
return request({ |
|||
url: "/api/admin/restocks/update?deviceId=" + params.deviceId, |
|||
method: 'post', |
|||
data:params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,84 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function getShelfs(params) { |
|||
return request({ |
|||
url: '/api/admin/shelfs', |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function getShelfDetail(id) { |
|||
return request({ |
|||
url: '/api/admin/shelfs/detail', |
|||
method: 'get', |
|||
params: { id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function postShelfApply(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/apply?id=${params.id}`, |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function postShelf(params) { |
|||
return request({ |
|||
url: '/api/admin/shelfs', |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function postShelfvm(params) { |
|||
return request({ |
|||
url: '/api/admin/shelfs/vm', |
|||
method: 'post', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function deleteShelf(id) { |
|||
return request({ |
|||
url: '/api/admin/shelfs', |
|||
method: 'delete', |
|||
data: { id }, |
|||
params: { id } |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function putShelf(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs?id=${params.id}`, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
export function putShelfvm(params) { |
|||
return request({ |
|||
url: `/api/admin/shelfs/vm?id=${params.id}`, |
|||
method: 'put', |
|||
data: params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function getShelfCount(params) { |
|||
return request({ |
|||
url: '/api/admin/shelfs/count', |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
export function getShelfAppliedData(id) { |
|||
return request({ |
|||
url: '/api/admin/shelfs/appliedData', |
|||
method: 'get', |
|||
params: { id } |
|||
}).then(res => res.data.data).then(lists => { |
|||
lists.map(item => { |
|||
item.disabled = false |
|||
item.checked = false |
|||
}) |
|||
return lists |
|||
}) |
|||
} |
|||
|
@ -1,84 +0,0 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
const url = '/api/admin'; |
|||
|
|||
/** |
|||
* 增值功能-数据统计 / 数据汇总 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_SUMMARY(params) { |
|||
return request({ |
|||
url: url + "/channels/analytics/summary", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 增值功能-数据统计 / 增值渠道订单列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_LIST_ORDERS(params) { |
|||
return request({ |
|||
url: url + "/channels/orders", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 增值功能-数据统计 / 增值渠道列表 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_SELECT(params) { |
|||
return request({ |
|||
url: url + "/channels/select", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 增值功能-数据统计 / 增值订单详情 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_LIST_ORDERS_DETAIL(params) { |
|||
return request({ |
|||
url: url + "/channels/orders/detail", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 增值功能-数据统计 / 增值渠道订单总数 |
|||
* @param params |
|||
* @returns {Q.Promise<any> | * | Q.Promise<T | never> | PromiseLike<T | never> | Promise<T | never>} |
|||
* @constructor |
|||
*/ |
|||
export function GET_ORDERS_COUNT(params) { |
|||
return request({ |
|||
url: url + "/channels/orders/count", |
|||
method: 'get', |
|||
params |
|||
}).then(res => res.data.data) |
|||
|
|||
} |
|||
|
@ -1,61 +0,0 @@ |
|||
import { |
|||
GET_DEVICE_DETAIL, |
|||
UPDATE_DEVICE |
|||
} from '@/api/devices' |
|||
|
|||
const deviceStore = { |
|||
namespaced: true, |
|||
state: { |
|||
loading: false, |
|||
device: { |
|||
"groupName": "", |
|||
"locationName": "", |
|||
"locationId": '', |
|||
"groupId": '', |
|||
"name": "", |
|||
"active": false, |
|||
"id": "", |
|||
"type": "" |
|||
} |
|||
}, |
|||
mutations: { |
|||
SET_LOADING: (state, payload) => { |
|||
state.loading = payload |
|||
}, |
|||
SET_DEVICE: (state, payload) => { |
|||
state.device = payload |
|||
}, |
|||
}, |
|||
actions: { |
|||
getDeviceDetail: async ({ commit, state, dispatch }, params) => { |
|||
commit('SET_LOADING', true) |
|||
var device = await GET_DEVICE_DETAIL(params).catch(e => { |
|||
console.error(e) |
|||
commit('SET_LOADING', false) |
|||
}) |
|||
commit('SET_LOADING', false) |
|||
commit('SET_DEVICE', device) |
|||
}, |
|||
updateDevice: async ({ commit, state, dispatch }, params) => { |
|||
commit('SET_LOADING', true) |
|||
var device = await UPDATE_DEVICE(params).then(res => { |
|||
return { success: true } |
|||
}).catch(e => { |
|||
commit('SET_LOADING', false) |
|||
return { success: false, message: e } |
|||
}) |
|||
commit('SET_LOADING', false) |
|||
if (device.success) { |
|||
return { success: true, message: "添加成功" } |
|||
} else { |
|||
return device |
|||
} |
|||
|
|||
}, |
|||
resetForm: async ({ commit, state, dispatch }, params) => { |
|||
return dispatch('getDeviceDetail', state.device) |
|||
}, |
|||
} |
|||
|
|||
} |
|||
export default deviceStore |
@ -1,17 +0,0 @@ |
|||
import { ADD_DEVICE_GROUPS } from '@/api/devices'; |
|||
|
|||
|
|||
const Store = { |
|||
namespaced: true, |
|||
state: {}, |
|||
mutations: {}, |
|||
actions: { |
|||
addDeviceGroup: async ({ commit, state }, { name }) => { |
|||
var result = await ADD_DEVICE_GROUPS({ name }).catch(e => { |
|||
return { success: false, message: e } |
|||
}) |
|||
return { success: true, message: result } |
|||
} |
|||
}, |
|||
} |
|||
export default Store |
@ -1,39 +0,0 @@ |
|||
import {UPDATE_DEVICE_GROUPS} from "@/api/devices"; |
|||
import _map from "lodash.map" |
|||
|
|||
const Store = { |
|||
namespaced: true, |
|||
state: { |
|||
editRow: {} |
|||
}, |
|||
mutations: { |
|||
INIT_EDIT_ROW: (state, editRow) => { |
|||
state.editRow = editRow |
|||
}, |
|||
UPDATE_DEVICE_GROUP: (state, editRow) => { |
|||
state.editRow = editRow |
|||
}, |
|||
}, |
|||
actions: { |
|||
initEditRow: async ({commit, state}, editRow) => { |
|||
commit("INIT_EDIT_ROW", editRow) |
|||
}, |
|||
updateDeviceGroup: async ({rootState, commit, state, dispatch}, editRow) => { |
|||
var result = await UPDATE_DEVICE_GROUPS(editRow).catch(e => { |
|||
return {message: e, success: false} |
|||
}) |
|||
//修改
|
|||
var lists = rootState.device.group.list.lists |
|||
var _index = lists.findIndex(item => item.id == editRow.id) |
|||
|
|||
_map(editRow, (value, key) => { |
|||
lists[_index][key] = value |
|||
}) |
|||
// commit("UPDATE_DEVICE_GROUP", editRow)
|
|||
dispatch('device/group/list/setDeviceList', lists, {root: true}) |
|||
|
|||
return {message: "修改成功", success: true} |
|||
}, |
|||
}, |
|||
} |
|||
export default Store |
@ -1,12 +0,0 @@ |
|||
import list from './list' |
|||
import add from './add' |
|||
import edit from './edit' |
|||
|
|||
const Store = { |
|||
namespaced: true, |
|||
modules: { |
|||
list, |
|||
add, edit |
|||
} |
|||
} |
|||
export default Store |
@ -1,113 +0,0 @@ |
|||
import { |
|||
GET_DEVICE_LISTS, GET_LIST_TOTAL, |
|||
GET_DEVICES_NUM, ADD_DEVICE, |
|||
GET_DEVICE_GROUPS, GET_DEVICE_GROUPS_TOTAL, |
|||
} from '@/api/devices'; |
|||
import { pageSize } from '@/config'; |
|||
|
|||
const formData = { |
|||
query: "", |
|||
active: '' |
|||
}; |
|||
const addParams = { |
|||
"id": "", |
|||
deviceTypeId: "", |
|||
"note": "", |
|||
"locationId": "", |
|||
"planId": "", |
|||
"name": "" |
|||
} |
|||
const Store = { |
|||
namespaced: true, |
|||
state: { |
|||
lists: [], |
|||
tableLoading: false, |
|||
/* params */ |
|||
params: JSON.parse(JSON.stringify(formData)), |
|||
page: { |
|||
from: 0, |
|||
size: pageSize, |
|||
}, |
|||
//在线机器 离线机器
|
|||
devicesNum: { |
|||
"devices": 0, |
|||
"activeDevices": 0 |
|||
}, |
|||
//list total 用来分页,
|
|||
list_total: 0, |
|||
//add params
|
|||
addParams: JSON.parse(JSON.stringify(addParams)) |
|||
|
|||
}, |
|||
mutations: { |
|||
SET_LIST: (state, payload) => { |
|||
state.lists = payload |
|||
}, |
|||
SET_TABLE_LOADING: (state, payload) => { |
|||
state.tableLoading = payload |
|||
}, |
|||
SET_TABLE_PAGE: (state, payload) => { |
|||
state.page = payload |
|||
}, |
|||
SET_TABLE_FILTER: (state, payload) => { |
|||
state.params = payload |
|||
}, |
|||
|
|||
SET_LIST_TOTAL: (state, payload) => { |
|||
state.list_total = payload |
|||
}, |
|||
SET_DEVICES_NUM: (state, payload) => { |
|||
state.devicesNum = payload |
|||
}, |
|||
RESET_ADD_MODAL_PARAMS: (state, payload) => { |
|||
state.addParams = JSON.parse(JSON.stringify(addParams)) |
|||
}, |
|||
}, |
|||
actions: { |
|||
setDeviceList: async ({ commit, state }, lists) => { |
|||
commit("SET_LIST", lists) |
|||
}, |
|||
setDevicesNum: async ({ commit, state }, params) => { |
|||
var devicesNum = await GET_DEVICES_NUM(params) |
|||
commit("SET_DEVICES_NUM", devicesNum) |
|||
}, |
|||
getListTotal: async ({ commit, state }, params) => { |
|||
var total = await GET_DEVICE_GROUPS_TOTAL(state.params.query) |
|||
commit("SET_LIST_TOTAL", total) |
|||
}, |
|||
|
|||
getDeviceGroups: async ({ commit, state }, params) => { |
|||
commit("SET_TABLE_LOADING", true) |
|||
commit("SET_TABLE_FILTER", params) |
|||
commit("SET_TABLE_PAGE", { from: 0, size: pageSize }) |
|||
var _params = { ...params, ...state.page } |
|||
var lists = await GET_DEVICE_GROUPS(_params) |
|||
commit("SET_TABLE_LOADING", false) |
|||
commit("SET_LIST", lists) |
|||
}, |
|||
changeDeviceListPage: async ({ commit, state }, page) => { |
|||
commit("SET_TABLE_PAGE", page) |
|||
var _params = { ...state.params, ...page } |
|||
commit("SET_TABLE_LOADING", true) |
|||
var lists = await GET_DEVICE_GROUPS(_params) |
|||
commit("SET_TABLE_LOADING", false) |
|||
commit("SET_LIST", lists) |
|||
}, |
|||
resetForm: async ({ commit, state, dispatch }, page) => { |
|||
var params = JSON.parse(JSON.stringify(formData)) |
|||
dispatch("getDeviceGroups", params) |
|||
}, |
|||
addDeivce: async ({ commit, state, dispatch }, params) => { |
|||
var data = await ADD_DEVICE(state.addParams).catch(e => { |
|||
return { success: false, message: e } |
|||
}) |
|||
//更新 list
|
|||
var _params = { ...state.params, ...state.page } |
|||
dispatch("getDeviceGroups", _params) |
|||
commit('RESET_ADD_MODAL_PARAMS') |
|||
return { success: true } |
|||
}, |
|||
|
|||
}, |
|||
} |
|||
export default Store |
@ -1,13 +0,0 @@ |
|||
import list from './list' |
|||
import edit from './edit' |
|||
import group from './group' |
|||
|
|||
const deviceStore = { |
|||
namespaced: true, |
|||
modules: { |
|||
list, |
|||
edit, |
|||
group |
|||
} |
|||
} |
|||
export default deviceStore |
@ -1,112 +0,0 @@ |
|||
import { |
|||
GET_DEVICE_LISTS, GET_LIST_TOTAL, |
|||
GET_DEVICES_NUM, ADD_DEVICE |
|||
} from '@/api/devices'; |
|||
import { pageSize } from '@/config'; |
|||
|
|||
|
|||
const formData = { |
|||
id: "", |
|||
locationId: "", |
|||
active: "", |
|||
typeId: "", |
|||
groupId: "", |
|||
query: "" |
|||
}; |
|||
const addParams = { |
|||
"id": "", |
|||
deviceTypeId: "", |
|||
"note": "", |
|||
"locationId": "", |
|||
"planId": "", |
|||
"name": "" |
|||
} |
|||
const store = { |
|||
namespaced: true, |
|||
state: { |
|||
lists: [], |
|||
tableLoading: false, |
|||
/* params */ |
|||
params: JSON.parse(JSON.stringify(formData)), |
|||
page: { |
|||
from: 0, |
|||
size: pageSize, |
|||
}, |
|||
//在线机器 离线机器
|
|||
devicesNum: { |
|||
"devices": 0, |
|||
"activeDevices": 0 |
|||
}, |
|||
//list total 用来分页,
|
|||
list_total: 0, |
|||
//add params
|
|||
addParams: JSON.parse(JSON.stringify(addParams)) |
|||
|
|||
}, |
|||
mutations: { |
|||
SET_LIST: (state, payload) => { |
|||
state.lists = payload |
|||
}, |
|||
SET_TABLE_LOADING: (state, payload) => { |
|||
state.tableLoading = payload |
|||
}, |
|||
SET_TABLE_PAGE: (state, payload) => { |
|||
state.page = payload |
|||
}, |
|||
SET_TABLE_FILTER: (state, payload) => { |
|||
state.params = payload |
|||
}, |
|||
|
|||
SET_LIST_TOTAL: (state, payload) => { |
|||
state.list_total = payload |
|||
}, |
|||
SET_DEVICES_NUM: (state, payload) => { |
|||
state.devicesNum = payload |
|||
}, |
|||
RESET_ADD_MODAL_PARAMS: (state, payload) => { |
|||
state.addParams = JSON.parse(JSON.stringify(addParams)) |
|||
}, |
|||
}, |
|||
actions: { |
|||
setDevicesNum: async ({ commit, state }, params) => { |
|||
var devicesNum = await GET_DEVICES_NUM(params) |
|||
commit("SET_DEVICES_NUM", devicesNum) |
|||
}, |
|||
getListTotal: async ({ commit, state }, params) => { |
|||
var { activeDevices, devices } = await GET_DEVICES_NUM(params) |
|||
commit("SET_LIST_TOTAL", devices) |
|||
}, |
|||
|
|||
getDeviceList: async ({ commit, state }, params) => { |
|||
commit("SET_TABLE_LOADING", true) |
|||
commit("SET_TABLE_FILTER", params) |
|||
commit("SET_TABLE_PAGE", { from: 0, size: 10 }) |
|||
var _params = { ...params, ...state.page } |
|||
var lists = await GET_DEVICE_LISTS(_params) |
|||
commit("SET_TABLE_LOADING", false) |
|||
commit("SET_LIST", lists) |
|||
}, |
|||
changeDeviceListPage: async ({ commit, state }, page) => { |
|||
var _params = { ...page, ...state.params } |
|||
commit("SET_TABLE_LOADING", true) |
|||
commit("SET_TABLE_PAGE", page) |
|||
var lists = await GET_DEVICE_LISTS(_params) |
|||
commit("SET_TABLE_LOADING", false) |
|||
commit("SET_LIST", lists) |
|||
}, |
|||
resetForm: async ({ commit, state, dispatch }, page) => { |
|||
var params = JSON.parse(JSON.stringify(formData)) |
|||
dispatch("getDeviceList", params) |
|||
}, |
|||
addDeivce: async ({ commit, state, dispatch }, params) => { |
|||
var data = await ADD_DEVICE(state.addParams) |
|||
//更新 list
|
|||
var _params = { ...state.params, ...state.page } |
|||
dispatch("getDeviceList", _params) |
|||
commit('RESET_ADD_MODAL_PARAMS') |
|||
return { success: true } |
|||
}, |
|||
|
|||
}, |
|||
} |
|||
export default store |
@ -1,33 +0,0 @@ |
|||
//detail
|
|||
import map from 'lodash.map' |
|||
import { pageSize } from '@/config'; |
|||
const store = { |
|||
namespaced: true, |
|||
state: { |
|||
form: { |
|||
from: 0, |
|||
size: pageSize |
|||
}, |
|||
total: 0, |
|||
lists: [], |
|||
loading: false, |
|||
}, |
|||
mutations: { |
|||
SET_DATA: (state, payload) => { |
|||
map(payload, (value, key) => { |
|||
state[key] = payload[key] |
|||
}) |
|||
}, |
|||
}, |
|||
actions: { |
|||
|
|||
setStore: async ({ commit, state, dispatch }, payload) => { |
|||
map(payload, (value, key) => { |
|||
commit("SET_DATA", { [key]: value }) |
|||
}) |
|||
return payload |
|||
}, |
|||
|
|||
}, |
|||
} |
|||
export default store |
@ -1,50 +0,0 @@ |
|||
//detail
|
|||
import map from 'lodash.map' |
|||
import { pageSize } from '@/config'; |
|||
const store = { |
|||
namespaced: true, |
|||
state: { |
|||
editRow: {},//目前选着的数据
|
|||
form: { |
|||
from: 0, |
|||
size: pageSize |
|||
}, |
|||
total: 0, |
|||
lists: [], |
|||
loading: false, |
|||
|
|||
|
|||
tablelist1: [], |
|||
//stockshow
|
|||
stockshow: false, |
|||
transfershow: false, |
|||
returnshow: false, |
|||
editRow2: {} |
|||
}, |
|||
mutations: { |
|||
SET_DATA: (state, payload) => { |
|||
map(payload, (value, key) => { |
|||
state[key] = payload[key] |
|||
}) |
|||
}, |
|||
}, |
|||
actions: { |
|||
setEditRow: async ({ commit, state }, row) => { |
|||
commit("SET_DATA", { editRow: row }) |
|||
commit("SET_DATA", { form: { ...state.form, id: row.id } }) |
|||
}, |
|||
setStore: async ({ commit, state, dispatch }, payload) => { |
|||
map(payload, (value, key) => { |
|||
commit("SET_DATA", { [key]: value }) |
|||
}) |
|||
return payload |
|||
}, |
|||
search: async ({ commit, state, dispatch }, form) => { |
|||
var _form = { ...state.form, ...form } |
|||
commit("SET_DATA", { form: _form }) |
|||
dispatch("getLists") |
|||
}, |
|||
|
|||
}, |
|||
} |
|||
export default store |
@ -1,13 +0,0 @@ |
|||
import list from './list' |
|||
import detail from './detail' |
|||
import audits from './detail/audits' |
|||
|
|||
const store = { |
|||
namespaced: true, |
|||
modules: { |
|||
list, |
|||
detail, |
|||
audits |
|||
} |
|||
} |
|||
export default store |
@ -1,27 +0,0 @@ |
|||
//list
|
|||
import map from 'lodash.map' |
|||
const store = { |
|||
namespaced: true, |
|||
state: { |
|||
editRow: { |
|||
availableStock: "", |
|||
},//目前选着的数据
|
|||
|
|||
}, |
|||
mutations: { |
|||
SET_DATA: (state, payload) => { |
|||
map(payload, (value, key) => { |
|||
state[key] = payload[key] |
|||
}) |
|||
|
|||
}, |
|||
}, |
|||
actions: { |
|||
setEditRow: async ({ commit, state }, row) => { |
|||
commit("SET_DATA", { editRow: row }) |
|||
}, |
|||
|
|||
|
|||
}, |
|||
} |
|||
export default store |
@ -1,138 +0,0 @@ |
|||
<template> |
|||
<div class="selector"> |
|||
<div class="el-input1"> |
|||
<el-input placeholder="搜索" @keyup.enter.native="onEnter" v-model="params.query" size="small" type="text" |
|||
class=""/> |
|||
</div> |
|||
<div class="selector-check" @scroll="scrollEvent"> |
|||
<ul> |
|||
<li v-for="(item,index) in list" :key="index"> |
|||
<el-checkbox @change="change(item.id,item.checked)" v-model="item.checked"> |
|||
<div> |
|||
<p>{{item.id}}</p> |
|||
<p>{{item.groupName}}</p> |
|||
</div> |
|||
</el-checkbox> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {EQUIPMENT} from '@/api/advertisingManagement' |
|||
|
|||
export default { |
|||
name: "elTransfer", |
|||
props:['deviceIds'], |
|||
data() { |
|||
return { |
|||
list: [], |
|||
params: { |
|||
size: 10, |
|||
from: 0, |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList() |
|||
}, |
|||
methods: { |
|||
getList() { |
|||
EQUIPMENT(this.params).then(res => { |
|||
res.map((item) => { |
|||
item.checked = false; |
|||
if (this.deviceIds.includes(item.id)){ |
|||
item.checked = true; |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = [...this.list, ...res]; |
|||
}) |
|||
}, |
|||
change(id, checked) { |
|||
if (checked) { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = true |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} else { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = false |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} |
|||
|
|||
|
|||
}, |
|||
scrollEvent(e) { |
|||
if (e.target.scrollTop + e.target.offsetHeight > e.target.scrollHeight) { |
|||
this.params = { |
|||
...this.params, |
|||
from: this.params.from + this.params.size, |
|||
}; |
|||
this.getList() |
|||
} |
|||
|
|||
}, |
|||
onEnter() { |
|||
this.params = { |
|||
size: 10, |
|||
from: 0, |
|||
query: this.params.query |
|||
}; |
|||
this.list = []; |
|||
this.getList() |
|||
} |
|||
}, |
|||
|
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.selector { |
|||
margin-top: 10px; |
|||
border-radius: 4px; |
|||
height: 300px; |
|||
border: 1px solid #d9d9d9; |
|||
|
|||
.el-input1 { |
|||
margin: 10px; |
|||
} |
|||
|
|||
.selector-check { |
|||
height: calc(100% - 55px); |
|||
border-top: 1px solid #d9d9d9; |
|||
padding: 15px; |
|||
overflow: auto; |
|||
|
|||
ul { |
|||
padding: 0; |
|||
margin: 0; |
|||
|
|||
li { |
|||
list-style: none; |
|||
padding: 5px 0; |
|||
|
|||
.el-checkbox__input { |
|||
vertical-align: super; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
</style> |
@ -1,54 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="名称"> |
|||
<el-input v-model="formInline.name" placeholder="名称搜索"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="广告类型"> |
|||
<el-select v-model="formInline.type" value="" placeholder="广告类型"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option label="图片" value="IMAGE"></el-option> |
|||
<el-option label="视频" value="VIDEO"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('ruleForm')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'form-container', |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
name: '', |
|||
type: '' |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '', |
|||
type: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 30px; |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -1,264 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
<div class="table"> |
|||
<el-row> |
|||
<router-link :to="`/advertisingManagement/advertisingPlan/opiModel`" class="resetWH"> |
|||
<el-button type="primary"> |
|||
添加计划 |
|||
</el-button> |
|||
</router-link> |
|||
</el-row> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="type" |
|||
label="类型"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="stateText" |
|||
label="状态"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="devices" |
|||
label="设备台数"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="suspensionOfRelease(lists.row.id,lists.row.state)" |
|||
> |
|||
<span>{{lists.row.state=="PUBLISHED"?"暂停":"发布"}}</span> |
|||
</span> |
|||
<router-link |
|||
size="small" |
|||
class="option-span" |
|||
style="margin: 0 5px;" |
|||
:to="`/advertisingManagement/advertisingPlan/opiModel?id=`+lists.row.id"> |
|||
查看 |
|||
</router-link> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="removeItem(lists.row.id)" |
|||
> |
|||
删除 |
|||
</span> |
|||
|
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LIST, DELETE_ITEM, PUBLISH, PAUSEDANDPENDING, DEVICES_COUNT} from '@/api/advertisingManagement' |
|||
import Alert from "@/utils/alert"; |
|||
import {pageSize} from '../../../config'; |
|||
|
|||
const FormContainer = () => import('./form.vue'); |
|||
export default { |
|||
name: "index", |
|||
components: { |
|||
FormContainer |
|||
}, |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
modelTitle: '添加', |
|||
opiModal: false, |
|||
lists: [], |
|||
params: { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '', |
|||
type: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
|
|||
methods: { |
|||
getList() { |
|||
GET_LIST(this.params).then(res => { |
|||
res.map((item) => { |
|||
if (item.state == 'PUBLISHED') { |
|||
item.stateText = '已发布' |
|||
} else if (item.state == 'PAUSED') { |
|||
item.stateText = '已暂停' |
|||
} else { |
|||
item.stateText = '待发布' |
|||
} |
|||
item.type = item.type == 'IMAGE' ? '图片' : '视频'; |
|||
|
|||
item.devices = item.deviceIds.length; |
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
|
|||
DEVICES_COUNT().then(res => { |
|||
this.count = res |
|||
}) |
|||
}, |
|||
submitForm(res) { |
|||
this.params = { |
|||
...this.params, |
|||
query: res.name, |
|||
type: res.type |
|||
}; |
|||
this.getList() |
|||
}, |
|||
resetForm() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '', |
|||
type: '' |
|||
}; |
|||
this.getList() |
|||
}, |
|||
currentChange(res) { |
|||
this.params = { |
|||
...this.params, |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList() |
|||
}, |
|||
suspensionOfRelease(id, state) { |
|||
switch (state) { |
|||
case 'PUBLISHED': |
|||
this.PAUSEDANDPENDING(id); |
|||
break; |
|||
case 'PAUSED': |
|||
case 'PENDING': |
|||
this.PUBLISHED(id); |
|||
break; |
|||
} |
|||
}, |
|||
/** |
|||
* 已发布 |
|||
* @constructor |
|||
*/ |
|||
PUBLISHED(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
PUBLISH(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '已发布'; |
|||
item.state = 'PUBLISHED'; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success.call(this, "已发布"); |
|||
}); |
|||
}, |
|||
/** |
|||
* 已暂停或者待发布 |
|||
* @constructor |
|||
*/ |
|||
PAUSEDANDPENDING(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
PAUSEDANDPENDING(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '已暂停'; |
|||
item.state = 'PAUSED'; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success.call(this, "已暂停"); |
|||
}); |
|||
}, |
|||
removeItem(id) { |
|||
this.$confirm('确定删除此广告计划嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
DELETE_ITEM(id).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id != id) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
}); |
|||
Alert.success.call(this, "删除成功"); |
|||
}).catch(() => { |
|||
|
|||
}) |
|||
|
|||
}, |
|||
viewItem(id) { |
|||
this.opiModal = true; |
|||
this.modelTitle = '查看' |
|||
}, |
|||
sureModal() { |
|||
this.opiModal = false |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 30px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
|
|||
.resetWH { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
</style> |
@ -1,370 +0,0 @@ |
|||
<template> |
|||
<div class="form"> |
|||
<el-form :model="ruleForm" ref="ruleForm" label-width="120px" class="demo-ruleForm"> |
|||
<el-form-item label="名称" prop="name" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]"> |
|||
<el-input v-model="ruleForm.name"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="广告类型" prop="type"> |
|||
<el-select v-model="ruleForm.type" @change="selAdvertisingType" placeholder="广告类型"> |
|||
<el-option label="图片" value="IMAGE"></el-option> |
|||
<el-option label="视频" value="VIDEO"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item v-if="isTime" label="间隔时间(秒)" prop="interval" |
|||
:rules="[{required: true, message: '不能为空', trigger: 'blur'}]"> |
|||
<el-input type="number" v-model="ruleForm.interval"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备类型" prop="deviceTypeId" |
|||
> |
|||
<el-select v-model="ruleForm.deviceTypeId" placeholder="设备类型" @change="selEquipmentType"> |
|||
<el-option v-for="item in equipmentType" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="广告位类型" prop="adSpaceTypeId" |
|||
> |
|||
<el-select v-model="ruleForm.adSpaceTypeId" placeholder="广告位类型"> |
|||
<el-option v-for="item in advertisingSpaceType" :label="item.name" |
|||
:value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="设备" prop="equipment"> |
|||
<span style="cursor: pointer;" v-if="!ruleForm.deviceIds.length" @click="addEquipment=true">选择设备</span> |
|||
<span style="cursor: pointer;" v-else @click="addEquipment=true">{{ruleForm.deviceIds.length}}个设备</span> |
|||
<!--<div v-if="!ruleForm.equipment.length" class="el-form-item__error">--> |
|||
<!--不能为空--> |
|||
<!--</div>--> |
|||
</el-form-item> |
|||
<el-form-item label="素材" prop="resources"> |
|||
<span v-if="!ruleForm.resources.length" style="cursor: pointer;" @click="clickMaterial">选择素材</span> |
|||
<span v-else style="cursor: pointer;" @click="clickMaterial">已选{{ruleForm.resources.length}}个素材</span> |
|||
<!--<div v-if="!ruleForm.sourceMaterial.length" class="el-form-item__error">--> |
|||
<!--不能为空--> |
|||
<!--</div>--> |
|||
</el-form-item> |
|||
<div class="selector" v-if="ruleForm.resources.length"> |
|||
<p class="selectedMaterial" style="padding-left: 50px;">已选素材</p> |
|||
<div class="selector-check"> |
|||
<ul v-if="!isTime"> |
|||
<li v-for="(item,index) in ruleForm.resources" :key="index" |
|||
@click="clickVideoUrl(item)" style="cursor: pointer;"> |
|||
<video :src="item"></video> |
|||
<span class="bofang"> |
|||
<svg-icon icon-class="bofang"></svg-icon> |
|||
</span> |
|||
</li> |
|||
</ul> |
|||
<ul v-else> |
|||
<li v-for="(item,index) in ruleForm.resources" :key="index"> |
|||
<img :src="item"/> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
<el-form-item style="text-align: center;"> |
|||
<el-button type="primary" @click="submitForm('ruleForm')">{{submitTitle}}</el-button> |
|||
<el-button @click="resetForm('ruleForm')">重置</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
|
|||
<el-dialog |
|||
width="300px" |
|||
:visible.sync="addEquipment"> |
|||
<add-equipment ref="transfer" :deviceIds="ruleForm.deviceIds" v-if="addEquipment"></add-equipment> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addEquipment = false">取消</el-button> |
|||
<el-button type="primary" @click="determine">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<el-dialog |
|||
width="800px" |
|||
:visible.sync="addSourceMaterial"> |
|||
<select-material ref="selectMaterial" :currType="type" :resources="ruleForm.resources" v-if="addSourceMaterial"></select-material> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addSourceMaterial = false">取消</el-button> |
|||
<el-button type="primary" @click="determineSelectMaterial">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
|
|||
<el-dialog :visible.sync="detialPlayVideo" :title="title" v-if="state" @close="close"> |
|||
<player :video-url="videoUrl"></player> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import {EQUIPMENTTYPE, ADVERTISINGSPACETYPE, POST_LIST, DETAIL_LIST, PUT_LIST} from '@/api/advertisingManagement' |
|||
import Alert from "@/utils/alert"; |
|||
import addEquipment from "./addEquipment.vue" |
|||
import selectMaterial from "./selectMaterial.vue" |
|||
import player from '../materialManagement/videoPlay' |
|||
import {mapActions} from 'vuex' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
submitTitle:'立即创建', |
|||
detialPlayVideo: false, |
|||
state: false, |
|||
videoUrl: '', |
|||
addEquipment: false, |
|||
addSourceMaterial: false, |
|||
isTime: true, |
|||
ruleForm: { |
|||
name: '', |
|||
type: 'IMAGE', |
|||
interval: '', |
|||
deviceTypeId: '', |
|||
adSpaceTypeId: '', |
|||
deviceIds: [], |
|||
resources: [] |
|||
}, |
|||
equipmentType: '', |
|||
advertisingSpaceType: '', |
|||
equipment: '', |
|||
type: '', |
|||
deviceTypeId: '' |
|||
}; |
|||
}, |
|||
components: { |
|||
addEquipment, |
|||
selectMaterial, |
|||
player |
|||
}, |
|||
mounted() { |
|||
this.getEquipmentType(); |
|||
this.DETAIL_LIST(); |
|||
|
|||
}, |
|||
methods: { |
|||
...mapActions(["delVisitedView"]), |
|||
/** |
|||
* 确定 |
|||
*/ |
|||
submitForm(formName) { |
|||
let that = this; |
|||
let id = this.$route.query.id; |
|||
this.$refs[formName].validate((valid) => { |
|||
if (valid) { |
|||
if (id) { |
|||
this.ruleForm.id = id; |
|||
PUT_LIST(this.ruleForm).then(res => { |
|||
Alert.success('更新成功'); |
|||
setTimeout(() => { |
|||
that.delVisitedView(that.$route).then(res => { |
|||
that.$router.go(-1); |
|||
}); |
|||
}, 500) |
|||
}); |
|||
} else { |
|||
POST_LIST(this.ruleForm).then(res => { |
|||
Alert.success('添加成功'); |
|||
setTimeout(() => { |
|||
that.delVisitedView(that.$route).then(res => { |
|||
that.$router.go(-1); |
|||
}); |
|||
}, 500) |
|||
}); |
|||
} |
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
}, |
|||
|
|||
DETAIL_LIST() { |
|||
let id = this.$route.query.id; |
|||
if (id == undefined) { |
|||
return |
|||
} |
|||
this.submitTitle = '立即更新'; |
|||
let params = { |
|||
id |
|||
}; |
|||
DETAIL_LIST(params).then(res => { |
|||
this.ruleForm = res; |
|||
this.isTime = res.type != 'VIDEO'; |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 重置 |
|||
*/ |
|||
|
|||
resetForm(formName) { |
|||
this.$refs[formName].resetFields(); |
|||
}, |
|||
|
|||
/** |
|||
* 获取广告位类型 |
|||
*/ |
|||
getAdvertisingSpaceType() { |
|||
let params = { |
|||
deviceTypeId: this.deviceTypeId |
|||
}; |
|||
ADVERTISINGSPACETYPE(params).then(res => { |
|||
console.log(res); |
|||
this.advertisingSpaceType = res |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 获取设备 |
|||
*/ |
|||
getEquipmentType() { |
|||
EQUIPMENTTYPE().then(res => { |
|||
res.unshift({ |
|||
id: '', |
|||
name: '请选择' |
|||
}); |
|||
this.equipmentType = res; |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 广告类型 change |
|||
* @param e |
|||
*/ |
|||
selAdvertisingType(e) { |
|||
if (e == 'IMAGE') { |
|||
this.isTime = true; |
|||
} else { |
|||
this.isTime = false; |
|||
} |
|||
|
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
resources: [] |
|||
}; |
|||
}, |
|||
selEquipmentType(e) { |
|||
this.deviceTypeId = e; |
|||
this.getAdvertisingSpaceType() |
|||
}, |
|||
determine() { |
|||
let childList = []; |
|||
this.$refs.transfer.list.map((item) => { |
|||
if (item.checked) { |
|||
childList.push(item.id) |
|||
} |
|||
return item |
|||
}); |
|||
this.addEquipment = false; |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
deviceIds: childList |
|||
} |
|||
|
|||
}, |
|||
|
|||
clickMaterial() { |
|||
this.addSourceMaterial = true; |
|||
this.type = this.ruleForm.type |
|||
}, |
|||
|
|||
/** |
|||
* 选择素材 |
|||
*/ |
|||
determineSelectMaterial() { |
|||
let childList = []; |
|||
this.$refs.selectMaterial.lists.map((item) => { |
|||
if (item.checked) { |
|||
childList.push(item.url) |
|||
} |
|||
return item |
|||
}); |
|||
this.addSourceMaterial = false; |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
resources: childList |
|||
}; |
|||
}, |
|||
|
|||
clickVideoUrl(src, name) { |
|||
this.detialPlayVideo = true; |
|||
this.state = true; |
|||
this.videoUrl = src; |
|||
this.title = name |
|||
}, |
|||
|
|||
close() { |
|||
this.state = false |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.form { |
|||
height: 100%; |
|||
background: #fff; |
|||
padding: 30px 30px 30px 0; |
|||
} |
|||
|
|||
.selector { |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
padding: 0 20px 20px 20px; |
|||
|
|||
.selectedMaterial { |
|||
padding-left: 50px; |
|||
background: #f4f4f5; |
|||
height: 30px; |
|||
line-height: 30px; |
|||
} |
|||
|
|||
.selector-check { |
|||
overflow: hidden; |
|||
|
|||
ul { |
|||
overflow: hidden; |
|||
|
|||
li { |
|||
float: left; |
|||
width: 160px; |
|||
height: 118px; |
|||
list-style: none; |
|||
position: relative; |
|||
margin: 0 5px; |
|||
|
|||
video { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
.bofang { |
|||
position: absolute; |
|||
top: 50px; |
|||
left: 68px; |
|||
|
|||
.svg-icon { |
|||
font-size: 30px; |
|||
color: #fff; |
|||
} |
|||
} |
|||
|
|||
.img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
div { |
|||
width: 100%; |
|||
height: 100%; |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,150 +0,0 @@ |
|||
<template> |
|||
<div class="selector"> |
|||
<div class="selector-check"> |
|||
<ul> |
|||
<li v-for="(item,index) in lists" :key="index"> |
|||
<video v-if="currType=='VIDEO'" :src="item.url"></video> |
|||
<img v-else :src="item.url"/> |
|||
<div @click.stop.prevent="selOpi(index)"> |
|||
<el-checkbox class="checked" v-model="item.checked"></el-checkbox> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_RESOURCES} from '@/api/advertisingManagement' |
|||
|
|||
export default { |
|||
name: "elTransfer", |
|||
data() { |
|||
return { |
|||
lists: [ |
|||
// { |
|||
// id: '132', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_11_15_%E7%A6%8F%E8%A2%8B%E6%9C%BA%E8%A7%86%E9%A2%91.mp4', |
|||
// name: '2019_10_04/14_15_34_福袋机视频.mp4', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '133', |
|||
// name: '2019_10_04/14_16_32_something just like this.mp4', |
|||
// |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_12_01_something%20just%20like%20this.mp4', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '134', |
|||
// name: '2019_10_04/14_14_50_Wolves.mp4', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_14_50_Wolves.mp4', |
|||
// checked: false |
|||
// } |
|||
], |
|||
params: { |
|||
type: 'IMAGE', |
|||
from: 0, |
|||
size: 10 |
|||
} |
|||
} |
|||
}, |
|||
props: ['currType', 'resources'], |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
getList() { |
|||
let params = { |
|||
...this.params, |
|||
type: this.currType |
|||
}; |
|||
GET_RESOURCES(params).then(res => { |
|||
res.map((item) => { |
|||
item.checked = false; |
|||
if (this.resources.includes(item.url)) { |
|||
item.checked = true; |
|||
} |
|||
|
|||
return item; |
|||
}); |
|||
this.lists = [...this.lists, ...res]; |
|||
}) |
|||
}, |
|||
selOpi(idx) { |
|||
let lists = []; |
|||
let checked = this.lists[idx].checked; |
|||
if (checked) { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = false |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} else { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = true |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} |
|||
|
|||
this.lists = lists; |
|||
} |
|||
}, |
|||
|
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.selector { |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
padding: 20px; |
|||
|
|||
.selector-check { |
|||
overflow: hidden; |
|||
|
|||
ul { |
|||
overflow: hidden; |
|||
|
|||
li { |
|||
float: left; |
|||
width: 160px; |
|||
height: 118px; |
|||
list-style: none; |
|||
position: relative; |
|||
margin: 0 5px; |
|||
|
|||
video { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
div { |
|||
width: 100%; |
|||
height: 100%; |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,105 +0,0 @@ |
|||
<template> |
|||
<div class="materialManagement"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="grid-content bg-purple"> |
|||
<div class="opi"> |
|||
<div v-show="!isSel"> |
|||
<el-button @click="batchOperation">批量选择</el-button> |
|||
</div> |
|||
<div v-show="isSel"> |
|||
<el-button @click="selectAll">选择全部</el-button> |
|||
<el-button @click="deselected">取消选择</el-button> |
|||
<el-button type="danger" @click="removeItem">删除</el-button> |
|||
</div> |
|||
</div> |
|||
<el-tabs v-model="activeName" @tab-click="handleClick(activeName)"> |
|||
<el-tab-pane label="图片" name="IMAGE"> |
|||
<picture-components ref="pictureComponents" @removeEnd="removeEnd" :activeName="activeName" :allSel="allSel" :isSel="isSel" :remove="remove"></picture-components> |
|||
</el-tab-pane> |
|||
<el-tab-pane label="视频" name="VIDEO"> |
|||
<video-components ref="videoComponents" @removeEnd="removeEnd" :activeName="activeName" :allSel="allSel" :isSel="isSel" :remove="remove"></video-components> |
|||
</el-tab-pane> |
|||
</el-tabs> |
|||
</div> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import PictureComponents from './pictureComponents' |
|||
import VideoComponents from './videoComponents' |
|||
|
|||
export default { |
|||
name: "index", |
|||
data() { |
|||
return { |
|||
isSel: false, |
|||
allSel:false, |
|||
remove:false, |
|||
activeName: 'IMAGE' |
|||
}; |
|||
}, |
|||
components: { |
|||
PictureComponents, |
|||
VideoComponents |
|||
}, |
|||
methods: { |
|||
handleClick() { |
|||
this.isSel = false; |
|||
}, |
|||
batchOperation() { |
|||
this.isSel = true; |
|||
}, |
|||
deselected() { |
|||
this.isSel = false; |
|||
this.allSel = false; |
|||
this.remove = false; |
|||
}, |
|||
selectAll(){ |
|||
this.allSel = true; |
|||
}, |
|||
removeItem(){ |
|||
this.remove = true; |
|||
}, |
|||
removeEnd(){ |
|||
this.remove = false; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.materialManagement { |
|||
background: #fff; |
|||
padding: 20px; |
|||
} |
|||
|
|||
.grid-content { |
|||
position: relative; |
|||
|
|||
.opi { |
|||
position: absolute; |
|||
top: -10px; |
|||
right: 0; |
|||
z-index: 2; |
|||
} |
|||
} |
|||
|
|||
.el-tabs__content { |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.el-tab-pane { |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.el-tabs__nav-wrap::after { |
|||
height: 1px; |
|||
} |
|||
</style> |
@ -1,268 +0,0 @@ |
|||
<template> |
|||
<div class="pictureComponents"> |
|||
<ul> |
|||
<li> |
|||
<a href="javascript:;" class="file"> |
|||
<svg-icon icon-class="plus1"></svg-icon> |
|||
<p class="info">上传图片</p> |
|||
<input @change="uploadImg($event)" type="file" accept="image/jpg,image/jpeg,image/png" name=""></a> |
|||
</li> |
|||
<li v-for="(item,index) in lists" :key="index"> |
|||
<img :src="item.url" alt=""> |
|||
<div v-show="isShow" @click.stop.prevent="selOpi(index)"> |
|||
<el-checkbox class="checked" v-model="item.checked"></el-checkbox> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import upload from "@/utils/upload"; |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
import {POST_RESOURCES, GET_RESOURCES, DELETE_RESOURCES} from '@/api/advertisingManagement' |
|||
|
|||
export default { |
|||
name: "pictureComponents", |
|||
data() { |
|||
return { |
|||
lists: [ |
|||
// { |
|||
// id: '132', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/11_24_12_%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20181220160153.jpg', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '133', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_08_46_%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190117141418.jpg', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '134', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/11_24_12_%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20181220160153.jpg', |
|||
// checked: false |
|||
// }, |
|||
], |
|||
isShow: false, |
|||
params : { |
|||
type: 'IMAGE', |
|||
from: 0, |
|||
size: 10 |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
props: ["activeName", "isSel", "allSel", "remove"], |
|||
watch: { |
|||
activeName() { |
|||
}, |
|||
isSel() { |
|||
|
|||
/** |
|||
* 取消选择 |
|||
*/ |
|||
this.isShow = this.isSel; |
|||
if (this.activeName == 'IMAGE') { |
|||
if (!this.isSel) { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
item.checked = false; |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
this.lists = lists; |
|||
} |
|||
} |
|||
}, |
|||
allSel() { |
|||
|
|||
/** |
|||
* 选择全部 |
|||
*/ |
|||
if (this.activeName == 'IMAGE') { |
|||
if (this.allSel) { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
item.checked = true; |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
this.lists = lists; |
|||
} |
|||
} |
|||
}, |
|||
remove() { |
|||
let that = this; |
|||
/** |
|||
* 删除 |
|||
*/ |
|||
if (this.activeName == 'IMAGE') { |
|||
if (this.remove) { |
|||
let lists = []; |
|||
let ids = []; |
|||
this.lists.map((item) => { |
|||
if (item.checked) { |
|||
ids.push(item.id); |
|||
} |
|||
return item |
|||
}); |
|||
|
|||
let obj = { |
|||
ids |
|||
}; |
|||
|
|||
DELETE_RESOURCES(obj).then(res=>{ |
|||
that.lists = lists; |
|||
Alert.success('删除成功'); |
|||
this.getList(); |
|||
that.$emit('removeEnd'); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
getList() { |
|||
let that = this; |
|||
GET_RESOURCES(that.params).then(res => { |
|||
that.lists = res |
|||
}) |
|||
}, |
|||
uploadImg(e) { |
|||
let that = this; |
|||
let files = e.target.files[0]; |
|||
upload(files).then(res => { |
|||
let obj = { |
|||
url: res.path, |
|||
type: 'IMAGE', |
|||
size: res.fsize, |
|||
key: res.key, |
|||
thumb: res.path |
|||
}; |
|||
POST_RESOURCES(obj).then(res => { |
|||
Alert.success('上传成功'); |
|||
this.getList(); |
|||
}); |
|||
|
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 单个选择 |
|||
*/ |
|||
selOpi(idx) { |
|||
let lists = []; |
|||
let checked = this.lists[idx].checked; |
|||
if (checked) { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = false |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} else { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = true |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} |
|||
|
|||
this.lists = lists; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.pictureComponents { |
|||
background: #fff; |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
|
|||
ul { |
|||
overflow: hidden; |
|||
|
|||
li { |
|||
position: relative; |
|||
list-style: none; |
|||
float: left; |
|||
width: 218px; |
|||
height: 118px; |
|||
margin: 8px; |
|||
|
|||
img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
> div { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
background: rgba(0, 0, 0, .5); |
|||
|
|||
.checked { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
|
|||
.file { |
|||
position: relative; |
|||
top: 0; |
|||
display: inline-block; |
|||
border: 2px dotted #d9d9d9; |
|||
border-radius: 4px; |
|||
overflow: hidden; |
|||
color: #1E88C7; |
|||
text-decoration: none; |
|||
text-indent: 0; |
|||
width: 217px; |
|||
height: 118px; |
|||
text-align: center; |
|||
line-height: 86px; |
|||
font-size: 40px; |
|||
svg{ |
|||
font-size: 40px; |
|||
color: rgba(181,181,181,1); |
|||
} |
|||
.info { |
|||
position: absolute; |
|||
font-size: 20px; |
|||
top: 62px; |
|||
left: 66px; |
|||
color: #ccc; |
|||
line-height: normal; |
|||
} |
|||
|
|||
input { |
|||
position: absolute; |
|||
font-size: 100px; |
|||
right: 0; |
|||
top: 0; |
|||
opacity: 0; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
</style> |
@ -1,307 +0,0 @@ |
|||
<template> |
|||
<div class="pictureComponents"> |
|||
<ul> |
|||
<li> |
|||
<a href="javascript:;" class="file"> |
|||
<svg-icon icon-class="plus1"></svg-icon> |
|||
<p class="info">上传视频</p> |
|||
<input @change="uploadImg($event)" type="file" accept="video/*,audio/*" name=""></a> |
|||
</li> |
|||
<li v-for="(item,index) in lists" :key="index" @click="clickVideoUrl(item.url,item.name)"> |
|||
<video :src="item.url"></video> |
|||
<span class="bofang"> |
|||
<svg-icon icon-class="bofang"></svg-icon> |
|||
</span> |
|||
<div v-show="isShow" @click.stop.prevent="selOpi(index)"> |
|||
<el-checkbox class="checked" v-model="item.checked"></el-checkbox> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
|
|||
<el-dialog :visible.sync="detialPlayVideo" :title="title" v-if="state" @close="close"> |
|||
<player :video-url="videoUrl"></player> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import upload from "@/utils/upload"; |
|||
import Alert from "@/utils/alert"; |
|||
import player from './videoPlay' |
|||
|
|||
import {POST_RESOURCES, GET_RESOURCES, DELETE_RESOURCES} from '@/api/advertisingManagement' |
|||
|
|||
export default { |
|||
name: "videoComponents", |
|||
data() { |
|||
return { |
|||
detialPlayVideo: false, |
|||
title: '', |
|||
state: true, |
|||
lists: [ |
|||
// { |
|||
// id: '132', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_11_15_%E7%A6%8F%E8%A2%8B%E6%9C%BA%E8%A7%86%E9%A2%91.mp4', |
|||
// name: '2019_10_04/14_15_34_福袋机视频.mp4', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '133', |
|||
// name: '2019_10_04/14_16_32_something just like this.mp4', |
|||
// |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_12_01_something%20just%20like%20this.mp4', |
|||
// checked: false |
|||
// }, |
|||
// { |
|||
// id: '134', |
|||
// name: '2019_10_04/14_14_50_Wolves.mp4', |
|||
// src: 'https://cdn.renqilai.com/2019_10_04/14_14_50_Wolves.mp4', |
|||
// checked: false |
|||
// } |
|||
], |
|||
videoUrl: '', |
|||
isShow: false, |
|||
params : { |
|||
type: 'VIDEO', |
|||
from: 0, |
|||
size: 10 |
|||
} |
|||
} |
|||
}, |
|||
props: ["activeName", "isSel", "allSel", "remove"], |
|||
components: { |
|||
player |
|||
}, |
|||
mounted(){ |
|||
this.getList(); |
|||
}, |
|||
watch: { |
|||
activeName() { |
|||
}, |
|||
isSel() { |
|||
|
|||
/** |
|||
* 取消选择 |
|||
*/ |
|||
this.isShow = this.isSel; |
|||
if (this.activeName == 'VIDEO') { |
|||
if (!this.isSel) { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
item.checked = false; |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
this.lists = lists; |
|||
} |
|||
} |
|||
}, |
|||
allSel() { |
|||
|
|||
/** |
|||
* 选择全部 |
|||
*/ |
|||
if (this.activeName == 'VIDEO') { |
|||
if (this.allSel) { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
item.checked = true; |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
this.lists = lists; |
|||
} |
|||
} |
|||
}, |
|||
remove() { |
|||
let that = this; |
|||
/** |
|||
* 删除 |
|||
*/ |
|||
if (this.activeName == 'VIDEO') { |
|||
if (this.remove) { |
|||
let lists = []; |
|||
let ids = []; |
|||
this.lists.map((item) => { |
|||
if (item.checked) { |
|||
ids.push(item.id); |
|||
} |
|||
return item |
|||
}); |
|||
|
|||
let obj = { |
|||
ids |
|||
}; |
|||
|
|||
DELETE_RESOURCES(obj).then(res=>{ |
|||
that.lists = lists; |
|||
Alert.success('删除成功'); |
|||
this.getList(); |
|||
that.$emit('removeEnd'); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
getList(){ |
|||
let that = this; |
|||
GET_RESOURCES(that.params).then(res=>{ |
|||
that.lists = res |
|||
}) |
|||
}, |
|||
uploadImg(e) { |
|||
let that = this; |
|||
let files = e.target.files[0]; |
|||
Alert.success('上传中...'); |
|||
upload(files).then(res => { |
|||
let obj = { |
|||
url: res.path, |
|||
type: 'VIDEO', |
|||
size: res.fsize, |
|||
key: res.key, |
|||
thumb: res.path |
|||
}; |
|||
POST_RESOURCES(obj).then(res => { |
|||
//that.lists.push(obj); |
|||
Alert.success('上传成功'); |
|||
this.getList(); |
|||
}); |
|||
|
|||
}); |
|||
}, |
|||
clickVideoUrl(src, name) { |
|||
this.state = true; |
|||
this.detialPlayVideo = true; |
|||
this.videoUrl = src; |
|||
this.title = name |
|||
}, |
|||
close() { |
|||
this.state = false |
|||
}, |
|||
/** |
|||
* 单个选择 |
|||
*/ |
|||
selOpi(idx) { |
|||
let lists = []; |
|||
let checked = this.lists[idx].checked; |
|||
if (checked) { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = false |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} else { |
|||
this.lists.map((item, index) => { |
|||
if (idx == index) { |
|||
item.checked = true |
|||
} |
|||
lists.push(item); |
|||
return item |
|||
}); |
|||
} |
|||
|
|||
this.lists = lists; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.pictureComponents { |
|||
background: #fff; |
|||
width: 100%; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
|
|||
ul { |
|||
overflow: hidden; |
|||
|
|||
li { |
|||
position: relative; |
|||
list-style: none; |
|||
float: left; |
|||
width: 218px; |
|||
height: 118px; |
|||
margin: 8px; |
|||
cursor: pointer; |
|||
|
|||
video { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
.bofang{ |
|||
position: absolute; |
|||
top: 50px; |
|||
left: 95px; |
|||
.svg-icon{ |
|||
font-size: 30px; |
|||
color: #fff; |
|||
} |
|||
} |
|||
|
|||
> div { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
background: rgba(0, 0, 0, .5); |
|||
|
|||
.checked { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
|
|||
.file { |
|||
position: relative; |
|||
top: 0; |
|||
display: inline-block; |
|||
border: 2px dotted #d9d9d9; |
|||
border-radius: 4px; |
|||
overflow: hidden; |
|||
color: #1E88C7; |
|||
text-decoration: none; |
|||
text-indent: 0; |
|||
width: 217px; |
|||
height: 118px; |
|||
text-align: center; |
|||
line-height: 86px; |
|||
font-size: 40px; |
|||
svg{ |
|||
font-size: 40px; |
|||
color: rgba(181,181,181,1); |
|||
} |
|||
.info { |
|||
position: absolute; |
|||
font-size: 20px; |
|||
top: 62px; |
|||
left: 66px; |
|||
color: #ccc; |
|||
line-height: normal; |
|||
} |
|||
|
|||
input { |
|||
position: absolute; |
|||
font-size: 100px; |
|||
right: 0; |
|||
top: 0; |
|||
opacity: 0; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
</style> |
@ -1,48 +0,0 @@ |
|||
<template> |
|||
<div class="container"> |
|||
<div class="player"> |
|||
<video-player class="video-player vjs-custom-skin" |
|||
ref="videoPlayer" |
|||
:playsinline="false" |
|||
:options="playerOptions" |
|||
> |
|||
</video-player> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: { |
|||
videoUrl: String |
|||
}, |
|||
data() { |
|||
return { |
|||
playerOptions: { |
|||
playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度 |
|||
autoplay: false, // 如果true,浏览器准备好时开始回放。 |
|||
muted: false, // 默认情况下将会消除任何音频。 |
|||
loop: false, // 导致视频一结束就重新开始。 |
|||
preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持) |
|||
language: 'zh-CN', |
|||
aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3") |
|||
fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。 |
|||
sources: [{ |
|||
type: 'video/mp4', |
|||
src: this.videoUrl// 你的m3u8地址(必填) |
|||
}], |
|||
// poster: 'https://surmon-china.github.io/vue-quill-editor/static/images/surmon-3.jpg', // 你的封面地址 |
|||
width: document.documentElement.clientWidth, |
|||
notSupportedMessage: '此视频暂无法播放,请稍后再试'// 允许覆盖Video.js无法播放媒体源时显示的默认信息。 |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
|||
<style type="text/css" scoped> |
|||
.container { |
|||
background-color: #efefef; |
|||
min-height: 100%; |
|||
} |
|||
</style> |
@ -1,164 +0,0 @@ |
|||
<template> |
|||
<div class="selector"> |
|||
<div class="el-input1"> |
|||
<el-input placeholder="搜索" @keyup.enter.native="onEnter" v-model="params.query" size="small" type="text" |
|||
class=""/> |
|||
</div> |
|||
<div class="selector-check selector-check1" @scroll="scrollEvent"> |
|||
<ul> |
|||
<li v-for="(item,index) in list" :key="index"> |
|||
<el-checkbox @change="change(item.id,item.checked)" v-model="item.checked"> |
|||
<div class="lis"> |
|||
<img :src="item.image" alt=""> |
|||
<div> |
|||
<p>名称: {{item.name}}</p> |
|||
<p>成本价: ¥{{item.costPrice}}</p> |
|||
</div> |
|||
</div> |
|||
</el-checkbox> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {EQUIPMENT} from '@/api/advertisingManagement' |
|||
import {GET_LIST} from '@/api/commodityManagement' |
|||
|
|||
export default { |
|||
name: "elTransfer", |
|||
data() { |
|||
return { |
|||
list: [], |
|||
params: { |
|||
size: 10, |
|||
from: 0, |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList() |
|||
}, |
|||
methods: { |
|||
getList() { |
|||
GET_LIST(this.params).then(res => { |
|||
if (res.length){ |
|||
res.map((item) => { |
|||
item.checked = false; |
|||
return item; |
|||
}); |
|||
this.list = [...this.list, ...res]; |
|||
} |
|||
}) |
|||
}, |
|||
change(id, checked) { |
|||
if (checked) { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = true |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} else { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = false |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} |
|||
|
|||
|
|||
}, |
|||
scrollEvent(e) { |
|||
if (e.target.scrollTop + e.target.offsetHeight > e.target.scrollHeight) { |
|||
this.params = { |
|||
...this.params, |
|||
from: this.params.from + this.params.size, |
|||
}; |
|||
this.getList() |
|||
} |
|||
|
|||
}, |
|||
onEnter() { |
|||
this.params = { |
|||
size: 10, |
|||
from: 0, |
|||
query: this.params.query |
|||
}; |
|||
this.list = []; |
|||
this.getList() |
|||
} |
|||
}, |
|||
|
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss"> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.selector { |
|||
margin-top: 10px; |
|||
border-radius: 4px; |
|||
height: 500px; |
|||
border: 1px solid #d9d9d9; |
|||
|
|||
.el-input1 { |
|||
margin: 10px; |
|||
} |
|||
|
|||
.selector-check { |
|||
height: calc(100% - 55px); |
|||
border-top: 1px solid #d9d9d9; |
|||
padding: 15px; |
|||
overflow: auto; |
|||
|
|||
ul { |
|||
padding: 0; |
|||
margin: 0; |
|||
|
|||
li { |
|||
list-style: none; |
|||
padding: 5px 0; |
|||
|
|||
.el-checkbox__input { |
|||
vertical-align: super; |
|||
} |
|||
|
|||
.lis{ |
|||
display: flex; |
|||
img,div{ |
|||
flex: 1; |
|||
} |
|||
img{ |
|||
width: 80px; |
|||
height: 80px; |
|||
} |
|||
div{ |
|||
margin-left: 10px; |
|||
line-height: 40px; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.selector-check1{ |
|||
.el-checkbox__input{ |
|||
position: relative; |
|||
top: -30px; |
|||
} |
|||
} |
|||
|
|||
</style> |
@ -1,323 +0,0 @@ |
|||
<template> |
|||
<div class="classification"> |
|||
<div class="classification-list"> |
|||
<el-row> |
|||
<el-button type="primary" @click="opiClassification"> |
|||
添加分类 |
|||
</el-button> |
|||
</el-row> |
|||
<el-table |
|||
:data="lists" |
|||
@row-click="openDetails" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="分类名称"> |
|||
<template slot-scope="lists"> |
|||
<span :class="{'select':lists.row.isSel}"> {{lists.row.name}} </span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
align="center" |
|||
width="80" |
|||
label="商品(件)"> |
|||
<template slot-scope="lists"> |
|||
<span :class="{'select':lists.row.isSel}"> {{lists.row.products}} </span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
align="center" |
|||
width="50" |
|||
label="排序"> |
|||
<template slot-scope="lists"> |
|||
<span :class="{'select':lists.row.isSel}"> {{lists.row.displayOrder}} </span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
align="createdDate" |
|||
label="创建时间"> |
|||
<template slot-scope="lists"> |
|||
<span :class="{'select':lists.row.isSel}"> {{lists.row.createdDate | filterCreatedDate}} </span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
width="100" |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click.stop.prevent="opiClassification(lists.row)" |
|||
> |
|||
编辑 |
|||
</span> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click.stop.prevent="removeItem(lists.row.id)" |
|||
> |
|||
删除 |
|||
</span> |
|||
|
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
|
|||
<el-dialog |
|||
width="400px" |
|||
title="添加分类" |
|||
:show-close="false" |
|||
:visible.sync="isAdd"> |
|||
<div class="addClassification"> |
|||
<span>分类名称: </span> |
|||
<el-input style="width: 70%" v-model="classification.name" placeholder="请输入分类名称"></el-input> |
|||
</div> |
|||
<div class="addClassification"> |
|||
<span>排序: </span> |
|||
<el-input style="width: 70%" type="number" v-model="classification.displayOrder" |
|||
placeholder="请输入排序"></el-input> |
|||
</div> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="isAdd = false">取消</el-button> |
|||
<el-button type="primary" @click="confirmItem" :loading="isLoading">确定</el-button> |
|||
</div> |
|||
|
|||
</el-dialog> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import draggable from 'vuedraggable' |
|||
import Alert from "@/utils/alert"; |
|||
import { |
|||
GET_LIST_CATEGORIES, |
|||
POST_CATEGORIES, |
|||
UPDATE_CATEGORIES, |
|||
DELETE_CATEGORIES, |
|||
ORDERS_CATEGORIES |
|||
} from '@/api/commodityManagement' |
|||
|
|||
import {dateTimeFormate} from "@/filters/index"; |
|||
|
|||
export default { |
|||
name: "classification", |
|||
data() { |
|||
return { |
|||
index: 0, |
|||
isAdd: false, |
|||
isLoading: false, |
|||
titleName: '添加分类', |
|||
temporaryValue: '', |
|||
lists: [], |
|||
classification: { |
|||
id: '', |
|||
name: '', |
|||
displayOrder: '', |
|||
} |
|||
} |
|||
}, |
|||
props: ['params', 'success'], |
|||
components: { |
|||
draggable |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
watch: { |
|||
params() { |
|||
this.getList(this.params) |
|||
}, |
|||
success() { |
|||
setTimeout(() => { |
|||
this.getList(this.params) |
|||
}, 100); |
|||
} |
|||
}, |
|||
methods: { |
|||
getList(params) { |
|||
let idx = this.index; |
|||
// console.log(idx); |
|||
// console.log(this.lists.length); |
|||
// if (idx == this.lists.length) { |
|||
// idx = 0 |
|||
// } |
|||
GET_LIST_CATEGORIES(params).then(res => { |
|||
res.map((item, index) => { |
|||
item.edit = false; |
|||
item.isSel = false; |
|||
if (index === idx) { |
|||
item.isSel = true; |
|||
} |
|||
return item |
|||
}); |
|||
this.lists = res; |
|||
this.$emit('currId', this.lists[idx].id); |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 表格行事件 |
|||
*/ |
|||
openDetails(row) { |
|||
let lists = this.lists.map((item, index) => { |
|||
item.isSel = false; |
|||
if (row.id == item.id) { |
|||
item.isSel = true; |
|||
this.index = index; |
|||
} |
|||
return item |
|||
}); |
|||
this.id = row.id; |
|||
this.name = row.name; |
|||
|
|||
this.$emit('currId', row.id); |
|||
this.$emit('products', row.products); |
|||
this.lists = lists; |
|||
}, |
|||
|
|||
/** |
|||
* 分类操作 |
|||
*/ |
|||
opiClassification(row) { |
|||
this.isAdd = true; |
|||
if (row.id) { |
|||
this.classification = { |
|||
id: row.id, |
|||
name: row.name, |
|||
displayOrder: row.displayOrder, |
|||
} |
|||
} |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
*/ |
|||
removeItem(id) { |
|||
let that = this; |
|||
this.$confirm('确定删除此分类嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
let params = { |
|||
id |
|||
}; |
|||
DELETE_CATEGORIES(params).then((res) => { |
|||
let lists = []; |
|||
that.lists.map((item, index) => { |
|||
if (id != item.id) { |
|||
lists.push(item) |
|||
} |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
Alert.success("删除成功"); |
|||
setTimeout(() => { |
|||
that.getList(that.params) |
|||
}, 100); |
|||
|
|||
}); |
|||
|
|||
}) |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param currIndex |
|||
*/ |
|||
confirmItem(currIndex) { |
|||
let that = this; |
|||
if (this.classification.name) { |
|||
|
|||
let params = { |
|||
id: this.classification.id, |
|||
name: this.classification.name, |
|||
displayOrder: this.classification.displayOrder |
|||
}; |
|||
if (!this.classification.id) { |
|||
POST_CATEGORIES(params).then(res => { |
|||
let lists = that.lists.map((item, index) => { |
|||
item.edit = false; |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
that.isAdd = false; |
|||
this.classification = { |
|||
id: '', |
|||
name: '', |
|||
displayOrder: '', |
|||
}; |
|||
Alert.success("新增成功"); |
|||
}); |
|||
} else { |
|||
UPDATE_CATEGORIES(params).then(res => { |
|||
let lists = that.lists.map((item, index) => { |
|||
item.edit = false; |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
that.isAdd = false; |
|||
Alert.success("更新成功"); |
|||
}); |
|||
} |
|||
setTimeout(() => { |
|||
that.getList(that.params) |
|||
}, 1000) |
|||
|
|||
} else { |
|||
Alert.fail("请添写分类名称"); |
|||
} |
|||
|
|||
|
|||
} |
|||
}, |
|||
filters: { |
|||
filterCreatedDate(val) { |
|||
return dateTimeFormate(val) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
.classification { |
|||
margin-top: 20px; |
|||
background: #fff; |
|||
padding: 20px; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.select { |
|||
font-size: 18px; |
|||
font-weight: bold; |
|||
} |
|||
} |
|||
|
|||
.addClassification { |
|||
margin: 10px; |
|||
|
|||
span { |
|||
display: inline-block; |
|||
width: 27%; |
|||
font-weight: bold; |
|||
text-align: right; |
|||
padding-right: 20px; |
|||
box-sizing: border-box; |
|||
} |
|||
} |
|||
</style> |
@ -1,223 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div class="table"> |
|||
<el-row> |
|||
<el-button type="primary" @click="addMerchandise=true,id='',isSel=true"> |
|||
添加商品 |
|||
</el-button> |
|||
</el-row> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="图片"> |
|||
<template slot-scope="scope"> |
|||
<img :src="scope.row.image" min-width="70" width="70" height="70"/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="name" |
|||
label="商品名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="price" |
|||
label="价格"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="costPrice" |
|||
label="成本价"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="removeItem(lists.row.id)" |
|||
> |
|||
删除 |
|||
</span> |
|||
|
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<el-dialog |
|||
width="400px" |
|||
:visible.sync="addMerchandise"> |
|||
<add-equipment v-if="isSel" ref="transfer"></add-equipment> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addMerchandise = false,isSel=false">取消</el-button> |
|||
<el-button type="primary" @click="determine">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LIST, DELETE_ITEM, PRODUCTS_CATEGORIES, DELETE_CATEGORIES_PRODUCTS} from '@/api/commodityManagement' |
|||
|
|||
import Alert from "@/utils/alert"; |
|||
import {pageSize} from '../../../config'; |
|||
import AddEquipment from "./addEquipment.vue" |
|||
|
|||
const FormContainer = () => import('../form.vue'); |
|||
const CommodityDetails = () => import('../productList/commodityDetails.vue'); |
|||
|
|||
export default { |
|||
name: "productList", |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
isSel: true, |
|||
isLoading: false, |
|||
addMerchandise: false, |
|||
lists: [], |
|||
id: '', |
|||
params: { |
|||
from: 0, |
|||
size: pageSize |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
props: ['classifyId', 'productsCount'], |
|||
components: { |
|||
FormContainer, |
|||
CommodityDetails, |
|||
AddEquipment |
|||
}, |
|||
watch: { |
|||
classifyId() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize |
|||
} |
|||
this.getList(this.classifyId); |
|||
}, |
|||
productsCount(val) { |
|||
this.count = val |
|||
} |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 获取列表数据 |
|||
*/ |
|||
getList(classifyId) { |
|||
if (classifyId) { |
|||
let params = { |
|||
...this.params, |
|||
categoryId: classifyId |
|||
}; |
|||
GET_LIST(params).then(res => { |
|||
res.map((item) => { |
|||
|
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* 删除商品 |
|||
*/ |
|||
removeItem(id) { |
|||
this.$confirm('确定删除此商品嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
let params = { |
|||
productId: id, |
|||
categoryId: this.classifyId |
|||
}; |
|||
DELETE_CATEGORIES_PRODUCTS(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id != id) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
this.$emit('$success') |
|||
}); |
|||
Alert.success("删除成功"); |
|||
}).catch(() => { |
|||
|
|||
}) |
|||
}, |
|||
determine() { |
|||
let that = this; |
|||
let products = []; |
|||
this.$refs.transfer.list.map((item) => { |
|||
if (item.checked) { |
|||
products.push(item.id) |
|||
} |
|||
return item |
|||
}); |
|||
let params = { |
|||
id: this.classifyId, |
|||
products: products |
|||
}; |
|||
PRODUCTS_CATEGORIES(params).then(res => { |
|||
Alert.success("添加成功"); |
|||
that.getList(that.classifyId); |
|||
that.$emit('$success') |
|||
}); |
|||
this.addMerchandise = false; |
|||
this.isSel = false; |
|||
}, |
|||
|
|||
/** |
|||
* 翻页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList(this.classifyId) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 20px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,79 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container label="分类名称" @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
|
|||
<el-row :gutter="20"> |
|||
<el-col :span="10"><div class="grid-content bg-purple"> |
|||
<classification :params="params" @currId="currId" @products="products" :success="refresh"></classification> |
|||
</div></el-col> |
|||
<el-col :span="14"><div class="grid-content bg-purple-light"> |
|||
<classification-list :classifyId="classifyId" :productsCount="productsCount" @$success="refreshList"></classification-list> |
|||
</div></el-col> |
|||
</el-row> |
|||
|
|||
|
|||
|
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
const FormContainer = () => import('../form.vue'); |
|||
const Classification = () => import('./classification.vue'); |
|||
const ClassificationList = () => import('./classificationList.vue'); |
|||
export default { |
|||
name: "commodityClassification", |
|||
data() { |
|||
return { |
|||
refresh: 0, |
|||
classifyId: '', |
|||
productsCount: '', |
|||
list: [], |
|||
params: { |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
Classification, |
|||
ClassificationList |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 查询 |
|||
*/ |
|||
submitForm(res) { |
|||
this.params = { |
|||
query: res.name |
|||
}; |
|||
this.$emit('submit', this.params) |
|||
}, |
|||
|
|||
/** |
|||
* 重置 |
|||
*/ |
|||
resetForm() { |
|||
this.params = { |
|||
query: '' |
|||
}; |
|||
}, |
|||
|
|||
currId(res) { |
|||
this.classifyId = res; |
|||
}, |
|||
products(res) { |
|||
this.productsCount = res; |
|||
}, |
|||
refreshList() { |
|||
|
|||
this.refresh = this.refresh + 1; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
</style> |
@ -1,164 +0,0 @@ |
|||
<template> |
|||
<div class="selector"> |
|||
<div class="el-input1"> |
|||
<el-input placeholder="搜索" @keyup.enter.native="onEnter" v-model="params.query" size="small" type="text" |
|||
class=""/> |
|||
</div> |
|||
<div class="selector-check selector-check1" @scroll="scrollEvent"> |
|||
<ul> |
|||
<li v-for="(item,index) in list" :key="index"> |
|||
<el-checkbox @change="change(item.id,item.checked)" v-model="item.checked"> |
|||
<div class="lis"> |
|||
<img :src="item.image" alt=""> |
|||
<div> |
|||
<p>名称: {{item.name}}</p> |
|||
<p>成本价: ¥{{item.costPrice}}</p> |
|||
</div> |
|||
</div> |
|||
</el-checkbox> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {EQUIPMENT} from '@/api/advertisingManagement' |
|||
import {GET_LIST} from '@/api/commodityManagement' |
|||
|
|||
export default { |
|||
name: "elTransfer", |
|||
data() { |
|||
return { |
|||
list: [], |
|||
params: { |
|||
size: 10, |
|||
from: 0, |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList() |
|||
}, |
|||
methods: { |
|||
getList() { |
|||
GET_LIST(this.params).then(res => { |
|||
if (res.length){ |
|||
res.map((item) => { |
|||
item.checked = false; |
|||
return item; |
|||
}); |
|||
this.list = [...this.list, ...res]; |
|||
} |
|||
}) |
|||
}, |
|||
change(id, checked) { |
|||
if (checked) { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = true |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} else { |
|||
let list = this.list.map((item) => { |
|||
if (id == item.id) { |
|||
item.checked = false |
|||
} |
|||
return item; |
|||
}); |
|||
this.list = list; |
|||
} |
|||
|
|||
|
|||
}, |
|||
scrollEvent(e) { |
|||
if (e.target.scrollTop + e.target.offsetHeight > e.target.scrollHeight) { |
|||
this.params = { |
|||
...this.params, |
|||
from: this.params.from + this.params.size, |
|||
}; |
|||
this.getList() |
|||
} |
|||
|
|||
}, |
|||
onEnter() { |
|||
this.params = { |
|||
size: 10, |
|||
from: 0, |
|||
query: this.params.query |
|||
}; |
|||
this.list = []; |
|||
this.getList() |
|||
} |
|||
}, |
|||
|
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss"> |
|||
* { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.selector { |
|||
margin-top: 10px; |
|||
border-radius: 4px; |
|||
height: 500px; |
|||
border: 1px solid #d9d9d9; |
|||
|
|||
.el-input1 { |
|||
margin: 10px; |
|||
} |
|||
|
|||
.selector-check { |
|||
height: calc(100% - 55px); |
|||
border-top: 1px solid #d9d9d9; |
|||
padding: 15px; |
|||
overflow: auto; |
|||
|
|||
ul { |
|||
padding: 0; |
|||
margin: 0; |
|||
|
|||
li { |
|||
list-style: none; |
|||
padding: 5px 0; |
|||
|
|||
.el-checkbox__input { |
|||
vertical-align: super; |
|||
} |
|||
|
|||
.lis{ |
|||
display: flex; |
|||
img,div{ |
|||
flex: 1; |
|||
} |
|||
img{ |
|||
width: 80px; |
|||
height: 80px; |
|||
} |
|||
div{ |
|||
margin-left: 10px; |
|||
line-height: 40px; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.selector-check1{ |
|||
.el-checkbox__input{ |
|||
position: relative; |
|||
top: -30px; |
|||
} |
|||
} |
|||
|
|||
</style> |
@ -1,429 +0,0 @@ |
|||
<template> |
|||
<div class="classification"> |
|||
<p>商品分类</p> |
|||
<div class="classification-list"> |
|||
<draggable tag="ul" handle=".handleMove" :sort="isSort" v-model="lists" @update="itemDragEnd"> |
|||
<li :class="{'select':item.isSel}" @click="liItemClick(item.id,item.edit,item.products)" |
|||
v-for="(item,index) in lists"> |
|||
<span class="handleMove"> |
|||
<svg-icon icon-class="move"></svg-icon> |
|||
</span> |
|||
<div class="info" v-show="!item.edit"> |
|||
<p>{{item.name}}</p> |
|||
<p>{{item.products}}件商品</p> |
|||
<el-button type="primary" @click.stop="editItem(index)">编辑 |
|||
</el-button> |
|||
</div> |
|||
<div class="edit" v-show="item.edit"> |
|||
<p>{{titleName}}</p> |
|||
<div class="demo-input-suffix"> |
|||
<span>分类名称:</span> |
|||
<el-input |
|||
placeholder="" |
|||
@focus.stop="itemfoucsValue(item.name)" |
|||
v-model="item.name"> |
|||
</el-input> |
|||
</div> |
|||
<div class="opiItem"> |
|||
<el-button type="danger" @click.stop="removeItem(index)">删除分类</el-button> |
|||
<div> |
|||
<el-button @click.stop="cancelItem(index)">取消</el-button> |
|||
<el-button type="primary" @click.stop="confirmItem(index)">确认</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
<li @click="addList" class="addList"> |
|||
<p> |
|||
<svg-icon icon-class="plus1"></svg-icon> |
|||
</p> |
|||
添加分类 |
|||
</li> |
|||
</draggable> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import draggable from 'vuedraggable' |
|||
import Alert from "@/utils/alert"; |
|||
import { |
|||
GET_LIST_CATEGORIES, |
|||
POST_CATEGORIES, |
|||
UPDATE_CATEGORIES, |
|||
DELETE_CATEGORIES, |
|||
ORDERS_CATEGORIES |
|||
} from '@/api/commodityManagement' |
|||
|
|||
export default { |
|||
name: "classification", |
|||
data() { |
|||
return { |
|||
index: 0, |
|||
isAdd: false, |
|||
isSort: true, |
|||
titleName: '添加分类', |
|||
temporaryValue: '', |
|||
lists: [] |
|||
} |
|||
}, |
|||
props: ['params', 'success'], |
|||
components: { |
|||
draggable |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
watch: { |
|||
params() { |
|||
this.getList(this.params) |
|||
}, |
|||
success() { |
|||
setTimeout(() => { |
|||
this.getList(this.params) |
|||
}, 100); |
|||
} |
|||
}, |
|||
methods: { |
|||
getList(params) { |
|||
let idx = this.index; |
|||
GET_LIST_CATEGORIES(params).then(res => { |
|||
res.map((item, index) => { |
|||
item.edit = false; |
|||
item.isSel = false; |
|||
if (index === idx) { |
|||
item.isSel = true; |
|||
} |
|||
return item |
|||
}); |
|||
this.lists = res; |
|||
this.$emit('currId', this.lists[idx].id); |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 添加分类 |
|||
*/ |
|||
addList() { |
|||
if (!this.isAdd) { |
|||
let item = { |
|||
id: '', |
|||
products: 0, |
|||
edit: true, |
|||
name: '' |
|||
}; |
|||
this.lists.push(item); |
|||
} else { |
|||
Alert.fail("请先添加完分类"); |
|||
} |
|||
|
|||
this.isAdd = true; |
|||
}, |
|||
|
|||
/** |
|||
* 事件点击 |
|||
*/ |
|||
liItemClick(id, edit, products) { |
|||
if (!edit) { |
|||
let lists = this.lists.map((item, index) => { |
|||
item.isSel = false; |
|||
if (id == item.id) { |
|||
item.isSel = true; |
|||
this.index = index; |
|||
} |
|||
return item |
|||
}); |
|||
this.$emit('currId', id); |
|||
this.$emit('products', products); |
|||
this.lists = lists; |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 拖动结束 |
|||
*/ |
|||
itemDragEnd() { |
|||
let ids = []; |
|||
for (let i = 0; i < this.lists.length; i++) { |
|||
ids.push(this.lists[i].id) |
|||
} |
|||
let params = { |
|||
ids: ids |
|||
}; |
|||
ORDERS_CATEGORIES(params).then(res => { |
|||
Alert.success("排序成功"); |
|||
}); |
|||
}, |
|||
itemfoucsValue(val) { |
|||
this.temporaryValue = val |
|||
}, |
|||
/** |
|||
* 编辑 |
|||
* @param currIndex |
|||
*/ |
|||
editItem(currIndex) { |
|||
this.isSort = false; |
|||
let lists = this.lists.map((item, index) => { |
|||
if (currIndex == index) { |
|||
item.edit = true |
|||
} |
|||
return item |
|||
}); |
|||
this.titleName = '编辑名称'; |
|||
this.lists = lists; |
|||
}, |
|||
/** |
|||
* 删除 |
|||
* @param currIndex |
|||
*/ |
|||
removeItem(currIndex) { |
|||
let that = this; |
|||
this.$confirm('确定删除此分类嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
let params = { |
|||
id: that.lists[currIndex].id |
|||
}; |
|||
DELETE_CATEGORIES(params).then((res) => { |
|||
let lists = []; |
|||
that.lists.map((item, index) => { |
|||
if (currIndex != index) { |
|||
lists.push(item) |
|||
} |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
that.isSort = true; |
|||
that.titleName = '添加分类'; |
|||
that.isAdd = false; |
|||
Alert.success("删除成功"); |
|||
setTimeout(() => { |
|||
that.getList(that.params) |
|||
}, 100); |
|||
|
|||
}); |
|||
|
|||
}) |
|||
|
|||
}, |
|||
/** |
|||
* 取消 |
|||
* @param currIndex |
|||
*/ |
|||
cancelItem(currIndex) { |
|||
let that = this; |
|||
let lists = []; |
|||
this.lists.map((item, index) => { |
|||
if (currIndex == index) { |
|||
item.edit = false; |
|||
item.name = that.temporaryValue || item.name |
|||
} |
|||
|
|||
if (item.id) { |
|||
lists.push(item) |
|||
} |
|||
return item |
|||
}); |
|||
this.lists = lists; |
|||
this.isSort = true; |
|||
this.isAdd = false; |
|||
}, |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param currIndex |
|||
*/ |
|||
confirmItem(currIndex) { |
|||
let that = this; |
|||
if (this.lists[currIndex].name) { |
|||
let params = { |
|||
id: this.lists[currIndex].id, |
|||
name: this.lists[currIndex].name |
|||
}; |
|||
if (!this.lists[currIndex].id) { |
|||
POST_CATEGORIES(params).then(res => { |
|||
let lists = that.lists.map((item, index) => { |
|||
item.edit = false; |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
that.isSort = true; |
|||
that.isAdd = false; |
|||
Alert.success("新增成功"); |
|||
}); |
|||
} else { |
|||
UPDATE_CATEGORIES(params).then(res => { |
|||
let lists = that.lists.map((item, index) => { |
|||
item.edit = false; |
|||
return item |
|||
}); |
|||
that.lists = lists; |
|||
that.isSort = true; |
|||
that.isAdd = false; |
|||
Alert.success("更新成功"); |
|||
}); |
|||
} |
|||
setTimeout(() => { |
|||
that.getList(that.params) |
|||
}, 1000) |
|||
|
|||
} else { |
|||
Alert.fail("请添写分类名称"); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
* { |
|||
padding: 0; |
|||
margin: 0; |
|||
} |
|||
|
|||
.classification { |
|||
margin-top: 20px; |
|||
background: #fff; |
|||
padding: 20px; |
|||
|
|||
.classification-list { |
|||
overflow: hidden; |
|||
|
|||
ul { |
|||
overflow: hidden; |
|||
|
|||
li { |
|||
position: relative; |
|||
border: 1px solid #ebeef5; |
|||
cursor: pointer; |
|||
margin: 10px; |
|||
list-style: none; |
|||
float: left; |
|||
width: 170px; |
|||
height: 190px; |
|||
background: rgba(255, 255, 255, 1); |
|||
opacity: 1; |
|||
border-radius: 5px; |
|||
|
|||
.el-button--medium { |
|||
font-size: 12px; |
|||
height: 30px; |
|||
line-height: 30px; |
|||
position: absolute; |
|||
left: 0; |
|||
bottom: 0; |
|||
width: 100%; |
|||
} |
|||
|
|||
.handleMove { |
|||
position: absolute; |
|||
top: 5px; |
|||
right: 5px; |
|||
cursor: move; |
|||
} |
|||
|
|||
.info { |
|||
|
|||
p { |
|||
padding: 5px; |
|||
} |
|||
|
|||
button { |
|||
border-radius: 0; |
|||
/*border-bottom-left-radius: 5px;*/ |
|||
/*border-bottom-right-radius: 5px;*/ |
|||
} |
|||
} |
|||
|
|||
.edit { |
|||
height: 100%; |
|||
position: relative; |
|||
|
|||
> p:nth-child(1) { |
|||
width: 100%; |
|||
padding: 10px; |
|||
border-bottom: 1px solid #ebeef5; |
|||
} |
|||
|
|||
.demo-input-suffix { |
|||
padding: 10px; |
|||
|
|||
span { |
|||
font-size: 12px; |
|||
} |
|||
|
|||
.el-input { |
|||
width: 59%; |
|||
} |
|||
} |
|||
|
|||
.opiItem { |
|||
width: 100%; |
|||
font-size: 12px; |
|||
position: absolute; |
|||
left: 0; |
|||
bottom: 0; |
|||
display: flex; |
|||
|
|||
button, div { |
|||
flex: 1; |
|||
} |
|||
|
|||
> button { |
|||
margin-right: 5px; |
|||
position: initial; |
|||
border-radius: 0; |
|||
} |
|||
|
|||
div { |
|||
display: flex; |
|||
|
|||
button { |
|||
position: initial; |
|||
flex: 1; |
|||
border-radius: 0; |
|||
} |
|||
|
|||
.el-button + .el-button { |
|||
margin-left: 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
li.cursorMove { |
|||
cursor: move; |
|||
} |
|||
|
|||
li.select { |
|||
box-shadow: 0px 5px 10px 8px #d9d9d9; |
|||
} |
|||
|
|||
li:last-child { |
|||
cursor: pointer; |
|||
line-height: normal; |
|||
padding-top: 50px; |
|||
|
|||
p { |
|||
padding-top: 10px; |
|||
svg { |
|||
font-size: 35px; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.addList { |
|||
line-height: 165px; |
|||
text-align: center; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,219 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div class="table"> |
|||
<el-row> |
|||
<el-button type="primary" @click="addMerchandise=true,id='',isSel=true"> |
|||
添加商品 |
|||
</el-button> |
|||
</el-row> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="图片"> |
|||
<template slot-scope="scope"> |
|||
<img :src="scope.row.image" min-width="70" width="70" height="70"/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="name" |
|||
label="商品名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="costPrice" |
|||
label="成本价"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="removeItem(lists.row.id)" |
|||
> |
|||
删除 |
|||
</span> |
|||
|
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<el-dialog |
|||
width="400px" |
|||
:visible.sync="addMerchandise"> |
|||
<add-equipment v-if="isSel" ref="transfer"></add-equipment> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addMerchandise = false,isSel=false">取消</el-button> |
|||
<el-button type="primary" @click="determine">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LIST, DELETE_ITEM, PRODUCTS_CATEGORIES, DELETE_CATEGORIES_PRODUCTS} from '@/api/commodityManagement' |
|||
|
|||
import Alert from "@/utils/alert"; |
|||
import {pageSize} from '../../../config'; |
|||
import AddEquipment from "./addEquipment.vue" |
|||
|
|||
const FormContainer = () => import('../form.vue'); |
|||
const CommodityDetails = () => import('../productList/commodityDetails.vue'); |
|||
|
|||
export default { |
|||
name: "productList", |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
isSel: true, |
|||
isLoading: false, |
|||
addMerchandise: false, |
|||
lists: [], |
|||
id: '', |
|||
params: { |
|||
from: 0, |
|||
size: pageSize |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
}, |
|||
props: ['classifyId', 'productsCount'], |
|||
components: { |
|||
FormContainer, |
|||
CommodityDetails, |
|||
AddEquipment |
|||
}, |
|||
watch: { |
|||
classifyId() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize |
|||
} |
|||
this.getList(this.classifyId); |
|||
}, |
|||
productsCount(val) { |
|||
this.count = val |
|||
} |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 获取列表数据 |
|||
*/ |
|||
getList(classifyId) { |
|||
if (classifyId) { |
|||
let params = { |
|||
...this.params, |
|||
categoryId: classifyId |
|||
}; |
|||
GET_LIST(params).then(res => { |
|||
res.map((item) => { |
|||
|
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* 删除商品 |
|||
*/ |
|||
removeItem(id) { |
|||
this.$confirm('确定删除此商品嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
let params = { |
|||
productId: id, |
|||
categoryId: this.classifyId |
|||
}; |
|||
DELETE_CATEGORIES_PRODUCTS(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id != id) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
this.$emit('$success') |
|||
}); |
|||
Alert.success("删除成功"); |
|||
}).catch(() => { |
|||
|
|||
}) |
|||
}, |
|||
determine() { |
|||
let that = this; |
|||
let products = []; |
|||
this.$refs.transfer.list.map((item) => { |
|||
if (item.checked) { |
|||
products.push(item.id) |
|||
} |
|||
return item |
|||
}); |
|||
let params = { |
|||
id: this.classifyId, |
|||
products: products |
|||
}; |
|||
PRODUCTS_CATEGORIES(params).then(res => { |
|||
Alert.success("添加成功"); |
|||
that.getList(that.classifyId); |
|||
that.$emit('$success') |
|||
}); |
|||
this.addMerchandise = false; |
|||
this.isSel = false; |
|||
}, |
|||
|
|||
/** |
|||
* 翻页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList(this.classifyId) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 30px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,68 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container label="分类名称" @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
<classification :params="params" @currId="currId" @products="products" :success="refresh"></classification> |
|||
<classification-list :classifyId="classifyId" :productsCount="productsCount" @$success="refreshList"></classification-list> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
const FormContainer = () => import('../form.vue'); |
|||
const Classification = () => import('./classification.vue'); |
|||
const ClassificationList = () => import('./classificationList.vue'); |
|||
export default { |
|||
name: "commodityClassification1", |
|||
data() { |
|||
return { |
|||
refresh: 0, |
|||
classifyId: '', |
|||
productsCount: '', |
|||
list: [], |
|||
params: { |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
Classification, |
|||
ClassificationList |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 查询 |
|||
*/ |
|||
submitForm(res) { |
|||
this.params = { |
|||
query: res.name |
|||
}; |
|||
this.$emit('submit', this.params) |
|||
}, |
|||
|
|||
/** |
|||
* 重置 |
|||
*/ |
|||
resetForm() { |
|||
this.params = { |
|||
query: '' |
|||
}; |
|||
}, |
|||
|
|||
currId(res) { |
|||
this.classifyId = res; |
|||
}, |
|||
products(res) { |
|||
this.productsCount = res; |
|||
}, |
|||
refreshList() { |
|||
|
|||
this.refresh = this.refresh + 1; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
</style> |
@ -1,46 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item :label="label"> |
|||
<el-input v-model="formInline.name" placeholder="名称搜索"></el-input> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('formInline')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'form-container', |
|||
props:['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
name: '' |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -1,263 +0,0 @@ |
|||
<template> |
|||
<div class="form"> |
|||
<el-form :model="ruleForm" :inline="true" ref="ruleForm" label-width="120px" class="demo-ruleForm"> |
|||
<el-form-item label="名称" prop="name" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]"> |
|||
<el-input v-model="ruleForm.name"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="成本价" prop="costPrice" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]"> |
|||
<el-input type="number" v-model="ruleForm.costPrice"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="价格" prop="price" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]"> |
|||
<el-input type="number" v-model="ruleForm.price"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="商品分类" prop="equipmentType"> |
|||
<el-select v-model="ruleForm.categoryId" placeholder="商品分类"> |
|||
<el-option v-for="item in equipmentType" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="商品图" prop="image" :rules="[{required: true, message: '不能为空'}]"> |
|||
|
|||
<a v-show="!ruleForm.image" href="javascript:;" class="file">+ |
|||
<p class="info">( 建议尺寸:354(高)*288(宽)像素 )</p> |
|||
<input type="file" @change="uploadImg($event,'image')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
<a v-show="ruleForm.image" href="javascript:;" class="file image"> |
|||
<img :src="ruleForm.image" alt=""> |
|||
<input type="file" @change="uploadImg($event,'image')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="商品展示图" prop="displayImage" :rules="[{required: true, message: '不能为空'}]"> |
|||
|
|||
<a v-show="!ruleForm.displayImage" href="javascript:;" class="file">+ |
|||
<p class="info">( 建议尺寸:400(高)*750(宽)像素 )</p> |
|||
<input type="file" @change="uploadImg($event,'displayImage')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
<a v-show="ruleForm.displayImage" href="javascript:;" class="file image"> |
|||
<img :src="ruleForm.displayImage" alt=""> |
|||
<input type="file" @change="uploadImg($event,'displayImage')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
</el-form-item> |
|||
|
|||
|
|||
<el-form-item label="商品详情图" prop="detailImage" :rules="[{required: true, message: '不能为空'}]"> |
|||
<a v-show="!ruleForm.detailImage" href="javascript:;" class="file">+ |
|||
<p class="info">( 建议尺寸:高(不限)*750(宽)像素 )</p> |
|||
<input type="file" @change="uploadImg($event,'detailImage')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
<a v-show="ruleForm.detailImage" href="javascript:;" class="file image"> |
|||
<img :src="ruleForm.detailImage" alt=""> |
|||
<input type="file" @change="uploadImg($event,'detailImage')" |
|||
accept="image/jpg,image/jpeg,image/png" name=""> |
|||
</a> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="商品描述"> |
|||
<el-input type="textarea" class="textarea" v-model="ruleForm.description"></el-input> |
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
|
|||
|
|||
</div> |
|||
</template> |
|||
<script> |
|||
import {DETAIL_ITEM, GET_LIST_CATEGORIES} from '@/api/commodityManagement' |
|||
import Alert from "@/utils/alert"; |
|||
import upload from "@/utils/upload"; |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
ruleForm: { |
|||
id: '', |
|||
name: '', |
|||
price: '', |
|||
costPrice: '', |
|||
categoryId: '', |
|||
image: '', |
|||
displayImage: '', |
|||
detailImage: '', |
|||
description: '' |
|||
}, |
|||
equipmentType: [] |
|||
}; |
|||
}, |
|||
props: ['currId'], |
|||
computed: { |
|||
id() { |
|||
return this.currId |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.GET_LIST_CATEGORIES(); |
|||
if (this.id) { |
|||
this.getDetailItem(); |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
id: this.id |
|||
} |
|||
} |
|||
|
|||
|
|||
}, |
|||
methods: { |
|||
/** |
|||
* 获取商品详情 |
|||
*/ |
|||
getDetailItem() { |
|||
let params = { |
|||
id: this.id |
|||
}; |
|||
DETAIL_ITEM(params).then(res => { |
|||
this.ruleForm = res; |
|||
this.GET_LIST_CATEGORIES(); |
|||
}) |
|||
}, |
|||
|
|||
GET_LIST_CATEGORIES() { |
|||
console.log(this.ruleForm); |
|||
GET_LIST_CATEGORIES().then(res => { |
|||
this.equipmentType = res |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 调用七牛云上传图片 |
|||
*/ |
|||
uploadImg(e, curr) { |
|||
let files = e.target.files[0]; |
|||
upload(files).then(res => { |
|||
let src = res.path; |
|||
if (curr == 'image') { |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
image: src |
|||
} |
|||
} else if (curr == 'displayImage') { |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
displayImage: src |
|||
} |
|||
} else { |
|||
this.ruleForm = { |
|||
...this.ruleForm, |
|||
detailImage: src |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// /** |
|||
// * 删除重新上传 |
|||
// */ |
|||
// removeSelImg(curr) { |
|||
// if (curr == 'image') { |
|||
// this.ruleForm = { |
|||
// ...this.ruleForm, |
|||
// image: '' |
|||
// }; |
|||
// } else if (curr == 'displayImage') { |
|||
// this.ruleForm = { |
|||
// ...this.ruleForm, |
|||
// displayImage: '' |
|||
// }; |
|||
// } else { |
|||
// this.ruleForm = { |
|||
// ...this.ruleForm, |
|||
// detailImage: '' |
|||
// }; |
|||
// } |
|||
// } |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.form { |
|||
height: 100%; |
|||
background: #fff; |
|||
padding: 30px 30px 30px 0; |
|||
} |
|||
|
|||
.file { |
|||
position: relative; |
|||
top: 0; |
|||
display: inline-block; |
|||
border: 1px solid #e6e6e6; |
|||
border-radius: 4px; |
|||
overflow: hidden; |
|||
color: #1E88C7; |
|||
text-decoration: none; |
|||
text-indent: 0; |
|||
width: 110px; |
|||
height: 140px; |
|||
text-align: center; |
|||
line-height: 85px; |
|||
font-size: 40px; |
|||
|
|||
input { |
|||
position: absolute; |
|||
font-size: 100px; |
|||
right: 0; |
|||
top: 0; |
|||
opacity: 0; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.image { |
|||
width: 110px; |
|||
height: 140px; |
|||
position: relative; |
|||
|
|||
img { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
i { |
|||
position: absolute; |
|||
top: -6px; |
|||
right: -6px; |
|||
display: inline-block; |
|||
width: 15px; |
|||
height: 15px; |
|||
line-height: 15px; |
|||
text-align: center; |
|||
background: red; |
|||
border-radius: 50%; |
|||
color: #fff; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.el-textarea { |
|||
width: 400px; |
|||
height: 80px; |
|||
resize: none; |
|||
|
|||
&.el-textarea__inner { |
|||
resize: none; |
|||
} |
|||
} |
|||
|
|||
.el-form-item__content { |
|||
position: relative; |
|||
|
|||
.info { |
|||
position: absolute; |
|||
font-size: 12px; |
|||
top: 48px; |
|||
color: #ccc; |
|||
line-height: normal; |
|||
} |
|||
} |
|||
|
|||
</style> |
@ -1,282 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container label="名称" @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
<div class="table"> |
|||
<el-row> |
|||
<el-button type="primary" @click="addMerchandise=true,hackReset=true,id=''"> |
|||
添加商品 |
|||
</el-button> |
|||
</el-row> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="图片"> |
|||
<template slot-scope="scope"> |
|||
<img :src="scope.row.image" min-width="70" width="70" height="70"/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="name" |
|||
label="名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="price" |
|||
label="价格"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="costPrice" |
|||
label="成本价"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
size="small" |
|||
class="option-span" |
|||
style="margin: 0 5px;" |
|||
@click="editItem(lists.row.id)"> |
|||
编辑 |
|||
</span> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="removeItem(lists.row.id)" |
|||
> |
|||
删除 |
|||
</span> |
|||
|
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<el-dialog |
|||
width="815px" |
|||
:show-close="false" |
|||
:visible.sync="addMerchandise"> |
|||
<commodity-details ref="commodityDetails" v-if="hackReset" :currId="id"></commodity-details> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="resetFormDialog('ruleForm'), addMerchandise = false">取消</el-button> |
|||
<el-button type="primary" @click="determine" :loading="isLoading">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LIST, DELETE_ITEM, COUNT, ADD_ITEM, UPDATE_ITEM} from '@/api/commodityManagement' |
|||
|
|||
import Alert from "@/utils/alert"; |
|||
import { pageSize } from '../../../config'; |
|||
|
|||
const FormContainer = () => import('../form.vue'); |
|||
const CommodityDetails = () => import('./commodityDetails.vue'); |
|||
|
|||
export default { |
|||
name: "productList", |
|||
data() { |
|||
return { |
|||
isLoading: false, |
|||
hackReset: true, |
|||
addMerchandise: false, |
|||
lists: [], |
|||
count: 0, |
|||
id: '', |
|||
params: { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList(); |
|||
this.getCount(); |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
CommodityDetails |
|||
}, |
|||
methods: { |
|||
|
|||
/** |
|||
* 获取列表数据 |
|||
*/ |
|||
getList() { |
|||
GET_LIST(this.params).then(res => { |
|||
res.map((item) => { |
|||
|
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* 获取总数 |
|||
*/ |
|||
getCount() { |
|||
COUNT().then(res => { |
|||
this.count = res |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
submitForm(res) { |
|||
this.params = { |
|||
...this.params, |
|||
query: res.name |
|||
}; |
|||
this.getList() |
|||
}, |
|||
|
|||
/** |
|||
* 重置 |
|||
*/ |
|||
resetForm() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '' |
|||
}; |
|||
this.getList() |
|||
}, |
|||
|
|||
/** |
|||
* 翻页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
...this.params, |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList() |
|||
}, |
|||
|
|||
/** |
|||
* 删除商品 |
|||
*/ |
|||
removeItem(id) { |
|||
this.$confirm('确定删除此商品嘛?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
let params = { |
|||
id |
|||
}; |
|||
DELETE_ITEM(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id != id) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
}); |
|||
Alert.success("删除成功"); |
|||
}).catch(() => { |
|||
|
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 编辑商品 |
|||
*/ |
|||
editItem(id) { |
|||
this.hackReset = true; |
|||
this.addMerchandise = true; |
|||
this.id = id |
|||
}, |
|||
|
|||
/** |
|||
* 确定保存 |
|||
*/ |
|||
determine() { |
|||
let that = this; |
|||
|
|||
let commodityDetails = this.$refs['commodityDetails'].$refs['ruleForm']; |
|||
commodityDetails.validate((val) => { |
|||
if (val) { |
|||
that.isLoading = true; |
|||
let list = this.$refs['commodityDetails'].ruleForm; |
|||
if (!list.id) { |
|||
ADD_ITEM(list).then(res => { |
|||
setTimeout(() => { |
|||
Alert.success('新建成功'); |
|||
that.addMerchandise = false; |
|||
that.hackReset = false; |
|||
that.isLoading = false; |
|||
}, 1500); |
|||
|
|||
}) |
|||
} else { |
|||
UPDATE_ITEM(list).then(res => { |
|||
setTimeout(() => { |
|||
Alert.success('更新成功'); |
|||
that.addMerchandise = false; |
|||
that.hackReset = false; |
|||
that.isLoading = false; |
|||
}, 1500); |
|||
|
|||
}) |
|||
} |
|||
setTimeout(()=>{ |
|||
that.getList(); |
|||
that.isLoading = false; |
|||
},1500); |
|||
|
|||
|
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 取消弹层 |
|||
*/ |
|||
resetFormDialog() { |
|||
this.hackReset = false;//销毁组件 |
|||
this.$refs['commodityDetails'].$refs['ruleForm'].resetFields(); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 30px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,61 +0,0 @@ |
|||
<template> |
|||
<div class="card"> |
|||
<div class="row1"> |
|||
<svg-icon :icon-class="icon"></svg-icon> |
|||
<span style="padding-left:5px">{{title}}</span> |
|||
</div> |
|||
<div class="row2"> |
|||
<div class="item"> |
|||
<div>总数</div> |
|||
<strong>{{leftText}}</strong> |
|||
<small>{{unit}}</small> |
|||
</div> |
|||
<div class="item" style="margin-left:20px"> |
|||
<div>在线数</div> |
|||
<strong>{{rightText}}</strong> |
|||
<small>{{unit}}</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: [ |
|||
"title", |
|||
"leftText", |
|||
"rightText", |
|||
"unit", |
|||
"smallText1", |
|||
"smallText2", |
|||
"smallValue1", |
|||
"smallValue2", |
|||
"icon" |
|||
] |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.card { |
|||
background: #fff; |
|||
width: calc(33.33%-20px); |
|||
/* border: 1px solid #eee; */ |
|||
border-radius: 5px; |
|||
margin-right: 20px; |
|||
padding: 20px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
.row2 { |
|||
display: flex; |
|||
margin-top: 10px; |
|||
strong { |
|||
font-size: 22px; |
|||
} |
|||
} |
|||
@media screen and (max-width: 800px) { |
|||
& { |
|||
width: calc(50%-20px); |
|||
margin-bottom: 10px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,51 +0,0 @@ |
|||
<template> |
|||
<div class="card"> |
|||
<div class="row1"> |
|||
<svg-icon :icon-class="icon"></svg-icon> |
|||
<span style="padding-left:5px">{{title}}</span> |
|||
</div> |
|||
<div class="row2"> |
|||
<strong>{{strongText}}</strong> |
|||
<small>{{unit}}</small> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: [ |
|||
"title", |
|||
"strongText", |
|||
"unit", |
|||
"smallText1", |
|||
"smallText2", |
|||
"smallValue1", |
|||
"smallValue2", |
|||
"icon" |
|||
] |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.card { |
|||
background: #fff; |
|||
width: calc(33.33%-20px); |
|||
/* border: 1px solid #eee; */ |
|||
border-radius: 5px; |
|||
margin-right: 20px; |
|||
padding: 20px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
.row2 { |
|||
margin-top: 10px; |
|||
strong { |
|||
font-size: 30px; |
|||
} |
|||
} |
|||
@media screen and (max-width: 800px) { |
|||
& { |
|||
width: calc(50%-20px); |
|||
margin-bottom: 10px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,85 +0,0 @@ |
|||
<template> |
|||
<div class="header"> |
|||
<div class="item1"> |
|||
<div :class="`item ${type=='today'?'active':'none'}`" @click="selectTime('today')">今日</div> |
|||
<div :class="`item ${type=='week'?'active':'none'}`" @click="selectTime('week')">本周</div> |
|||
<div :class="`item ${type=='mouth'?'active':'none'}`" @click="selectTime('mouth')">本月</div> |
|||
</div> |
|||
<div class="item2"> |
|||
<el-date-picker |
|||
style="width:240px;" |
|||
size="mini" |
|||
v-model="dates" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始" |
|||
end-placeholder="结束" |
|||
@change="datechange" |
|||
></el-date-picker> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { getToday, getLastWeek, getLastMonth, dateFormate } from "@/utils/date"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
type: "today", |
|||
dates: [] |
|||
}; |
|||
}, |
|||
methods: { |
|||
datechange(value) { |
|||
if (value) { |
|||
this.type = ""; |
|||
this.$emit("sure", { |
|||
start: dateFormate(value[0]), |
|||
end: dateFormate(value[1]), |
|||
siez:10 |
|||
}); |
|||
} else { |
|||
this.selectTime("today"); |
|||
} |
|||
}, |
|||
selectTime(val) { |
|||
this.type = val; |
|||
this.dates = []; |
|||
if (this.type == "today") { |
|||
this.$emit("sure", getToday()); |
|||
} |
|||
if (this.type == "week") { |
|||
this.$emit("sure", getLastWeek()); |
|||
} |
|||
if (this.type == "mouth") { |
|||
this.$emit("sure", getLastMonth()); |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
.header { |
|||
display: flex; |
|||
flex: 1; |
|||
align-items: center; |
|||
justify-content: flex-end; |
|||
.item1 { |
|||
display: flex; |
|||
align-items: center; |
|||
.item { |
|||
font-size: 12px; |
|||
text-align: center; |
|||
margin-top: 10px; |
|||
margin-left: 5px; |
|||
margin-right: 15px; |
|||
padding-bottom: 5px; |
|||
cursor: pointer; |
|||
&.active { |
|||
border-bottom: 2px solid $menuActiveText; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,33 +0,0 @@ |
|||
<template> |
|||
<div class="pageContainer"> |
|||
<Row1/> |
|||
<Row2/> |
|||
<Row3></Row3> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
const Row2Tab = () => import("./row2Tab/row2Tab"); |
|||
const Row3 = () => import("./row3/index"); |
|||
const Row2 = () => import("./row2/index"); |
|||
const Row1 = () => import("./row1"); |
|||
export default { |
|||
name: "index", |
|||
data() { |
|||
return {}; |
|||
}, |
|||
methods: {}, |
|||
components: { |
|||
Row1, |
|||
Row2, |
|||
// Row2Tab, |
|||
Row3 |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.pageContainer { |
|||
padding: 20px; |
|||
} |
|||
</style> |
@ -1,68 +0,0 @@ |
|||
<template> |
|||
<div v-loading="loading"> |
|||
<div class="row1"> |
|||
<Card title="总销售额" :strongText="analytics_summary.sale" unit="元" icon="zongxiaoshoue"></Card> |
|||
<Card title="收入" :strongText="analytics_summary.income" unit="元" icon="shouru"></Card> |
|||
<Card title="利润" :strongText="analytics_summary.profit" unit="元" icon="yonghushuliang"></Card> |
|||
</div> |
|||
|
|||
<div class="row1" style="margin-top:20px;"> |
|||
<Card title="支付笔数" :strongText="analytics_summary.orders" unit="笔" icon="dingdanshu"></Card> |
|||
<Card title="用户数" :strongText="analytics_summary.customers" unit="人" icon="yonghushuliang"></Card> |
|||
<DeivceCard |
|||
title="设备数" |
|||
:leftText="analytics_summary.devices" |
|||
:rightText="analytics_summary.activeDevices" |
|||
unit="项" |
|||
icon="kucunguanli" |
|||
></DeivceCard> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import Card from "./card"; |
|||
import DeivceCard from "./card/deivceCard"; |
|||
import { get_analytics_summary } from "@/api/dashboard"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
loading: false, |
|||
analytics_summary: { |
|||
sale: 0, |
|||
income: 0, |
|||
orders: 0, |
|||
users: 0, |
|||
devices: 0, |
|||
activeDevices: 0, |
|||
profit: 0 |
|||
} |
|||
}; |
|||
}, |
|||
components: { |
|||
Card, |
|||
DeivceCard |
|||
}, |
|||
async mounted() { |
|||
this.loading = true; |
|||
this.analytics_summary = await get_analytics_summary(); |
|||
this.loading = false; |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.row1 { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
& .card { |
|||
&:last-child { |
|||
margin-right: 0px; |
|||
} |
|||
@media screen and (max-width: 800px) { |
|||
&:nth-child(2) { |
|||
margin-right: 0px; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,222 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div class="header"> |
|||
<div style="display:flex;align-items:center"> |
|||
<span style="padding-right:10px">类型</span> |
|||
<el-select placeholder="请选择" v-model="selectValue" size="mini" @change="changetypes"> |
|||
<el-option label="销售额" value="sale"></el-option> |
|||
<el-option label="收入" value="income"></el-option> |
|||
<el-option label="支付笔数" value="orders"></el-option> |
|||
<el-option label="利润" value="profit"></el-option> |
|||
</el-select> |
|||
<el-date-picker |
|||
style="width:230px;margin-left:20px;" |
|||
size="mini" |
|||
type="daterange" |
|||
v-model="valuedate" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
:clearable="false" |
|||
@change="datechange" |
|||
></el-date-picker> |
|||
</div> |
|||
</div> |
|||
|
|||
<div |
|||
v-loading="loading" |
|||
:id="id" |
|||
:class="className" |
|||
:style="{ |
|||
padding:'0 20px', |
|||
height:height,width:width}" |
|||
/> |
|||
</div> |
|||
</template> |
|||
|
|||
<style lang="scss" scoped> |
|||
.header { |
|||
padding-left: 20px; |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
|||
|
|||
<script> |
|||
import echarts from "echarts"; |
|||
import resize from "./mixins/resize"; |
|||
import { |
|||
get_analytics_trend_sale, |
|||
get_analytics_trend_income, |
|||
get_analytics_trend_orders, |
|||
get_analytics_trend_profits |
|||
} from "@/api/dashboard"; |
|||
import { dateFormate } from "../../../utils/date"; |
|||
const moment = require("moment"); |
|||
export default { |
|||
mixins: [resize], |
|||
props: { |
|||
className: { |
|||
type: String, |
|||
default: "chart" |
|||
}, |
|||
id: { |
|||
type: String, |
|||
default: "chart" |
|||
}, |
|||
width: { |
|||
type: String, |
|||
default: "100%" |
|||
}, |
|||
height: { |
|||
type: String, |
|||
default: "200px" |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
loading: false, |
|||
chart: null, |
|||
params: { |
|||
start: moment() |
|||
.add(-1, "month") |
|||
.format("YYYY-MM-DD"), |
|||
end: moment().format("YYYY-MM-DD") |
|||
}, |
|||
selectValue: "sale", |
|||
selectLabel: "销售额", |
|||
unit: "元", |
|||
valuedate: [moment().add(-1, "month"), moment()], |
|||
chartdata: [] |
|||
}; |
|||
}, |
|||
async mounted() { |
|||
this.chartdata = await get_analytics_trend_sale(this.params); |
|||
this.initChart(); |
|||
}, |
|||
|
|||
beforeDestroy() { |
|||
if (!this.chart) { |
|||
return; |
|||
} |
|||
this.chart.dispose(); |
|||
this.chart = null; |
|||
}, |
|||
methods: { |
|||
datechange(date) { |
|||
if (date) { |
|||
this.params = { |
|||
start: dateFormate(date[0]), |
|||
end: dateFormate(date[1]) |
|||
}; |
|||
} else { |
|||
this.params = { |
|||
start: "", |
|||
end: "" |
|||
}; |
|||
} |
|||
this.changetypes(this.selectValue); |
|||
}, |
|||
async changetypes(val) { |
|||
if (val == "sale") { |
|||
this.selectLabel = "销售额"; |
|||
this.unit = "元"; |
|||
this.chartdata = await get_analytics_trend_sale(this.params); |
|||
} |
|||
if (val == "income") { |
|||
this.selectLabel = "收入"; |
|||
this.unit = "元"; |
|||
this.chartdata = await get_analytics_trend_income(this.params); |
|||
} |
|||
if (val == "orders") { |
|||
this.selectLabel = "支付笔数"; |
|||
this.unit = "笔"; |
|||
this.chartdata = await get_analytics_trend_orders(this.params); |
|||
} |
|||
if (val == "profit") { |
|||
this.selectLabel = "利润"; |
|||
this.unit = "元"; |
|||
this.chartdata = await get_analytics_trend_profits(this.params); |
|||
} |
|||
this.initChart(); |
|||
}, |
|||
initChart() { |
|||
var self = this; |
|||
this.loading = true; |
|||
this.chart = echarts.init(document.getElementById(this.id)); |
|||
|
|||
var xdata = this.chartdata |
|||
.map(item => item.day) |
|||
.map(item => dateFormate(item)); |
|||
var ydata = this.chartdata.map(item => item.value); |
|||
this.chart.setOption({ |
|||
xAxis: { |
|||
data: xdata, |
|||
boundaryGap: false, |
|||
axisTick: { |
|||
show: false |
|||
} |
|||
}, |
|||
grid: { |
|||
left: 10, |
|||
right: 50, |
|||
bottom: 20, |
|||
top: 30, |
|||
containLabel: true |
|||
}, |
|||
tooltip: { |
|||
trigger: "axis", |
|||
axisPointer: { |
|||
type: "cross" |
|||
}, |
|||
padding: [5, 10], |
|||
formatter: function( |
|||
params //数据格式 |
|||
) { |
|||
var relVal = params[0].name + "<br/>"; |
|||
relVal += |
|||
params[0].seriesName + |
|||
" : " + |
|||
params[0].value + |
|||
self.unit + |
|||
"<br/>"; |
|||
return relVal; |
|||
} |
|||
}, |
|||
yAxis: { |
|||
axisTick: { |
|||
show: false |
|||
}, |
|||
axisLabel: { |
|||
formatter: `{value} ${self.unit}`, |
|||
// margin: |
|||
}, |
|||
axisTick: { |
|||
alignWithLabel: true |
|||
} |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: this.selectLabel, |
|||
itemStyle: { |
|||
normal: { |
|||
color: "#FF005A", |
|||
lineStyle: { |
|||
color: "#FF005A", |
|||
width: 2 |
|||
} |
|||
} |
|||
}, |
|||
smooth: true, |
|||
type: "line", |
|||
data: ydata, |
|||
animationDuration: 2800, |
|||
animationEasing: "cubicInOut" |
|||
} |
|||
] |
|||
}); |
|||
|
|||
this.loading = false; |
|||
} |
|||
} |
|||
}; |
|||
</script> |
@ -1,46 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<h4>销量排行榜</h4> |
|||
<div class="row1"> |
|||
<div class="item1"> |
|||
<div class="item active">热销榜</div> |
|||
<div class="item">设备榜</div> |
|||
</div> |
|||
</div> |
|||
<div class="tableContainer"> |
|||
<el-table style="width: 100%"> |
|||
<el-table-column prop="date" label="排名"></el-table-column> |
|||
<el-table-column prop="name" label="商品名称"></el-table-column> |
|||
<el-table-column prop="address" label="销量数量(件)"></el-table-column> |
|||
<el-table-column prop="address" label="销售金额(元)"></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
h4 { |
|||
margin: 0px; |
|||
margin-bottom: 10px; |
|||
} |
|||
.row1 { |
|||
display: flex; |
|||
.item1 { |
|||
display: flex; |
|||
align-items: center; |
|||
.item { |
|||
text-align: center; |
|||
margin-left: 5px; |
|||
margin-right: 15px; |
|||
padding-bottom: 10px; |
|||
cursor: pointer; |
|||
&.active { |
|||
border-bottom: 2px solid $menuActiveText; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,52 +0,0 @@ |
|||
<template> |
|||
<div class="card"> |
|||
<div class="title">{{title}}</div> |
|||
<div class="row2"> |
|||
<strong>{{strong}}</strong> |
|||
<small>{{unit}}</small> |
|||
</div> |
|||
<div class="row3"> |
|||
<span>环比</span> |
|||
<span style="padding-left:10px;padding-right:5px;">{{huanbi}}</span> |
|||
|
|||
<svg-icon icon-class="up" v-if="type=='up'&&huanbi!='0%'" style="color:red"></svg-icon> |
|||
<svg-icon icon-class="down1" v-if="type=='down'&&huanbi!='0%'" style="color:green"></svg-icon> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: ["title", "strong", "unit", "huanbi", "type"] |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.card { |
|||
width: calc(25%-20px); |
|||
border: 1px solid #ddd; |
|||
height: 100px; |
|||
border-radius: 5px; |
|||
padding: 10px 0 10px 20px; |
|||
margin-right: 20px; |
|||
.title { |
|||
} |
|||
.row2 { |
|||
margin-top: 5px; |
|||
margin-bottom: 5px; |
|||
strong { |
|||
font-size: 25px; |
|||
} |
|||
} |
|||
.row3 { |
|||
font-size: 12px; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
@media screen and (max-width: 800px) { |
|||
& { |
|||
width: calc(50%-20px); |
|||
margin-bottom: 10px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,125 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<Header @sure="sure2search"></Header> |
|||
<div class="row"> |
|||
<Card |
|||
title="销售额" |
|||
:strong="sale" |
|||
unit="元" |
|||
:huanbi="Math.abs(sale_huanbi)+'%'" |
|||
:type="sale_huanbi>0?'up':'down'" |
|||
/> |
|||
<Card |
|||
title="收入" |
|||
:strong="income" |
|||
unit="元" |
|||
:huanbi="Math.abs(income_huanbi)+'%'" |
|||
:type="income_huanbi>0?'up':'down'" |
|||
/> |
|||
<Card |
|||
title="利润" |
|||
:strong="profit" |
|||
unit="元" |
|||
:huanbi="Math.abs(profit_huanbi)+'%'" |
|||
:type="profit_huanbi>0?'up':'down'" |
|||
/> |
|||
<Card |
|||
title="支付笔数" |
|||
:strong="orders" |
|||
unit="笔" |
|||
:huanbi="Math.abs(orders_huanbi)+'%'" |
|||
:type="orders_huanbi>0?'up':'down'" |
|||
/> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import Card from "./card"; |
|||
import Header from "./header"; |
|||
import { getToday } from "../../../utils/date"; |
|||
import { |
|||
get_analytics_sale, |
|||
get_analytics_income, |
|||
get_analytics_orders, |
|||
get_analytics_profits |
|||
} from "@/api/dashboard"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
sale: 0, |
|||
income: 0, |
|||
orders: 0, |
|||
profit: 0, |
|||
|
|||
sale1: 0, |
|||
income1: 0, |
|||
orders1: 0, |
|||
profit1: 0, |
|||
|
|||
sale_huanbi: 0, |
|||
income_huanbi: 0, |
|||
orders_huanbi: 0, |
|||
profit_huanbi: 0 |
|||
}; |
|||
}, |
|||
components: { |
|||
Header, |
|||
Card |
|||
}, |
|||
mounted() { |
|||
this.sure2search(getToday()); |
|||
}, |
|||
methods: { |
|||
async sure2search(date, lasetdate) { |
|||
this.sale = await get_analytics_sale(date); |
|||
this.income = await get_analytics_income(date); |
|||
this.orders = await get_analytics_orders(date); |
|||
this.profit = await get_analytics_profits(date); |
|||
|
|||
this.sale1 = await get_analytics_sale({ |
|||
start: date.laststart, |
|||
end: date.lastend |
|||
}); |
|||
// debugger; |
|||
this.income1 = await get_analytics_income({ |
|||
start: date.laststart, |
|||
end: date.lastend |
|||
}); |
|||
this.orders1 = await get_analytics_orders({ |
|||
start: date.laststart, |
|||
end: date.lastend |
|||
}); |
|||
this.profit1 = await get_analytics_profits({ |
|||
start: date.laststart, |
|||
end: date.lastend |
|||
}); |
|||
|
|||
this.sale_huanbi = |
|||
this.sale1 == 0 |
|||
? 0 |
|||
: (((this.sale - this.sale1) / this.sale1) * 100).toFixed(2); |
|||
this.income_huanbi = |
|||
this.income1 == 0 |
|||
? 0 |
|||
: (((this.income - this.income1) / this.income1) * 100).toFixed(2); |
|||
this.profit_huanbi = |
|||
this.profit1 == 0 |
|||
? 0 |
|||
: (((this.profit - this.profit1) / this.profit1) * 100).toFixed(2); |
|||
|
|||
this.orders_huanbi = |
|||
this.orders1 == 0 |
|||
? 0 |
|||
: (((this.orders - this.orders1) / this.orders1) * 100).toFixed(2); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.row { |
|||
display: flex; |
|||
padding: 20px; |
|||
flex-wrap: wrap; |
|||
} |
|||
</style> |
@ -1,37 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div class="row"> |
|||
<Chart class="item" height="350px"/> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import Chart from "./Chart"; |
|||
import Table from "./Table"; |
|||
export default { |
|||
components: { |
|||
Chart, |
|||
Table |
|||
}, |
|||
data() { |
|||
return { |
|||
options: [], |
|||
value: "" |
|||
}; |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.row { |
|||
margin-top: 20px; |
|||
display: flex; |
|||
.item { |
|||
flex: 2; |
|||
} |
|||
.item1 { |
|||
flex: 1; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
|
@ -1,93 +0,0 @@ |
|||
|
|||
<template> |
|||
<header> |
|||
<h3>运营分析</h3> |
|||
<div class="row1"> |
|||
<div class="item1"> |
|||
<div :class="`item ${type=='today'?'active':'none'}`" @click="selectTime('today')">今日</div> |
|||
<div :class="`item ${type=='week'?'active':'none'}`" @click="selectTime('week')">本周</div> |
|||
<div :class="`item ${type=='mouth'?'active':'none'}`" @click="selectTime('mouth')">本月</div> |
|||
</div> |
|||
<div class="item2"> |
|||
<el-date-picker |
|||
style="width:230px;" |
|||
size="mini" |
|||
v-model="dates" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始" |
|||
end-placeholder="结束" |
|||
@change="datechange" |
|||
></el-date-picker> |
|||
</div> |
|||
</div> |
|||
</header> |
|||
</template> |
|||
<script> |
|||
import { getToday, getLastWeek, getLastMonth, dateFormate } from "@/utils/date"; |
|||
import moment from "moment"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
type: "today", |
|||
dates: [] |
|||
}; |
|||
}, |
|||
methods: { |
|||
datechange(value) { |
|||
if (value) { |
|||
this.type = ""; |
|||
this.$emit("sure", { |
|||
start: dateFormate(value[0]), |
|||
end: dateFormate(value[1]), |
|||
laststart: dateFormate(value[0]), |
|||
lastend: dateFormate(value[1]) |
|||
}); |
|||
} else { |
|||
this.selectTime("today"); |
|||
} |
|||
}, |
|||
selectTime(val) { |
|||
this.type = val; |
|||
this.dates = []; |
|||
if (this.type == "today") { |
|||
this.$emit("sure", getToday()); |
|||
} |
|||
if (this.type == "week") { |
|||
this.$emit("sure", getLastWeek()); |
|||
} |
|||
if (this.type == "mouth") { |
|||
this.$emit("sure", getLastMonth()); |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
header { |
|||
background: #fff; |
|||
h3 { |
|||
padding-left: 20px; |
|||
} |
|||
} |
|||
.row1 { |
|||
display: flex; |
|||
padding: 20px; |
|||
.item1 { |
|||
display: flex; |
|||
align-items: center; |
|||
.item { |
|||
text-align: center; |
|||
margin-left: 5px; |
|||
margin-right: 15px; |
|||
padding-bottom: 10px; |
|||
cursor: pointer; |
|||
&.active { |
|||
border-bottom: 2px solid $menuActiveText; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,32 +0,0 @@ |
|||
<template> |
|||
<div class="row2"> |
|||
<CardRow/> |
|||
<ChartRow/> |
|||
</div> |
|||
</template><script> |
|||
import Header from "./header"; |
|||
import CardRow from "./cardrows"; |
|||
import ChartRow from "./chartRow"; |
|||
export default { |
|||
components: { |
|||
Header, |
|||
CardRow, |
|||
ChartRow |
|||
}, |
|||
data() { |
|||
return { |
|||
value6: "" |
|||
}; |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.row2 { |
|||
margin-top: 20px; |
|||
padding-top: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
|||
|
|||
|
|||
|
@ -1,32 +0,0 @@ |
|||
import { debounce } from '@/utils' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
sidebarElm: null |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.__resizeHandler = debounce(() => { |
|||
if (this.chart) { |
|||
this.chart.resize() |
|||
} |
|||
}, 100) |
|||
window.addEventListener('resize', this.__resizeHandler) |
|||
|
|||
this.sidebarElm = document.getElementsByClassName('sidebar-container')[0] |
|||
this.sidebarElm && this.sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) |
|||
}, |
|||
beforeDestroy() { |
|||
window.removeEventListener('resize', this.__resizeHandler) |
|||
|
|||
this.sidebarElm && this.sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) |
|||
}, |
|||
methods: { |
|||
sidebarResizeHandler(e) { |
|||
if (e.propertyName === 'width') { |
|||
this.__resizeHandler() |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,169 +0,0 @@ |
|||
<template> |
|||
<div class="row2"> |
|||
<!-- 补充的tab 工具 --> |
|||
<div class="fixTabTitles"> |
|||
<div |
|||
style="display:flex;" |
|||
class="datetimeWrapper" |
|||
> |
|||
<div class="item active">本日</div> |
|||
<div class="item">本周</div> |
|||
<div class="item">本月</div> |
|||
<div class="item">本年</div> |
|||
</div> |
|||
<div class="wrapperDatePicker"> |
|||
<el-date-picker |
|||
style="width:300px;overflow:hidden" |
|||
v-model="datePicker" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
> |
|||
</el-date-picker> |
|||
</div> |
|||
</div> |
|||
<!-- tabs --> |
|||
<el-tabs |
|||
class="tabsContainer" |
|||
v-model="activeName" |
|||
@tab-click="handleClick" |
|||
> |
|||
|
|||
<el-tab-pane |
|||
label="用户管理" |
|||
name="first" |
|||
> |
|||
<!-- tab panel container --> |
|||
<div class="tabContainer"> |
|||
<div class="left"> |
|||
<Chart1 |
|||
id="chart1" |
|||
height="100%" |
|||
width="100%" |
|||
ref="chart1" |
|||
/> |
|||
</div> |
|||
<div class="right"> |
|||
<!-- 排行版 --> |
|||
<div class="h1"> |
|||
<strong>销售排行版</strong> |
|||
<el-select |
|||
v-model="date1" |
|||
style="width:65px" |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in [ |
|||
{ value: '周', label: '周'}, |
|||
{ value: '月', label: '月'}, |
|||
{ value: '日', label: '日'}, |
|||
{ value: '年', label: '年'}, |
|||
|
|||
]" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</el-tab-pane> |
|||
<el-tab-pane |
|||
label="配置管理" |
|||
name="second" |
|||
> |
|||
<div class="tabContainer"> |
|||
<Chart2 |
|||
id="chart2" |
|||
ref="chart2" |
|||
height="100%" |
|||
width="100%" |
|||
/> |
|||
</div> |
|||
</el-tab-pane> |
|||
</el-tabs> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
const Chart1 = () => import("@/components/Charts/keyboard"); |
|||
const Chart2 = () => import("@/components/Charts/keyboard"); |
|||
export default { |
|||
components: { Chart1, Chart2 }, |
|||
data() { |
|||
return { |
|||
activeName: "first", |
|||
datePicker: [ |
|||
new Date(2000, 10, 10, 10, 10), |
|||
new Date(2000, 10, 11, 10, 10) |
|||
], |
|||
date1: "" |
|||
}; |
|||
}, |
|||
methods: { |
|||
handleClick() { |
|||
var self = this; |
|||
//修复 chart的resize |
|||
this.$nextTick(() => { |
|||
self.$refs["chart1"].__resizeHandler(); |
|||
self.$refs["chart2"].__resizeHandler(); |
|||
}); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
.row2 { |
|||
padding-left: 20px; |
|||
padding-right: 20px; |
|||
padding-top: 20px; |
|||
margin-top: 20px; |
|||
position: relative; |
|||
background: #fff; |
|||
.fixTabTitles { |
|||
z-index: 9; |
|||
padding-bottom: 10px; |
|||
align-items: center; |
|||
display: flex; |
|||
position: absolute; |
|||
height: 40px; |
|||
right: 20px; |
|||
.datetimeWrapper { |
|||
display: flex; |
|||
.item { |
|||
width: 45px; |
|||
cursor: pointer; |
|||
font-size: 12px; |
|||
&.active { |
|||
color: $menuActiveText; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
.tabContainer { |
|||
height: 400px; |
|||
padding-bottom: 10px; |
|||
display: flex; |
|||
.left { |
|||
width: calc(66.6%-10px); |
|||
margin-right: 10px; |
|||
} |
|||
.right { |
|||
width: 33.3%; |
|||
.h1 { |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
display: flex; |
|||
padding-bottom: 5px; |
|||
border-bottom: 1px solid #ddd; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,168 +0,0 @@ |
|||
<template> |
|||
<div class="row3"> |
|||
<div class="item"> |
|||
<header> |
|||
<h3>场地销量榜</h3> |
|||
<DateHeader @sure="(date)=>{$data.localtionparams=date;getlocationdata()}"/> |
|||
</header> |
|||
|
|||
<el-table :data="localtiondata" style="width: 100%"> |
|||
<el-table-column prop="date" label="排名" width="60"> |
|||
<template slot-scope="scope">{{scope.$index+1}}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="name" label="场地名称"></el-table-column> |
|||
<el-table-column prop="sale" label="销售金额(元)"></el-table-column> |
|||
<el-table-column prop="units" label="销售数量(台)"></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<div class="item"> |
|||
<header> |
|||
<h3>设备销量榜</h3> |
|||
<DateHeader @sure="(date)=>{$data.devicesdataparams=date;getdevicesdata()}"/> |
|||
</header> |
|||
<el-table :data="devicesdata" style="width: 100%"> |
|||
<el-table-column prop="date" label="日期"> |
|||
<template slot-scope="scope">{{scope.$index+1}}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="name" label="姓名"></el-table-column> |
|||
<el-table-column prop="sale" label="销售金额(元)"></el-table-column> |
|||
<el-table-column prop="units" label="销售数量(台)"></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
|
|||
<div class="item"> |
|||
<header> |
|||
<h3>热销商品榜</h3> |
|||
<DateHeader @sure="(date)=>{$data.productsparams=date;getproductsdata()}"/> |
|||
</header> |
|||
<el-table :data="productsdata" style="width: 100%"> |
|||
<el-table-column prop="date" label="日期"> |
|||
<template slot-scope="scope">{{scope.$index+1}}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="name" label="姓名"></el-table-column> |
|||
<el-table-column prop="sale" label="销售金额(元)"></el-table-column> |
|||
<el-table-column prop="units" label="销售数量(台)"></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<div class="item"> |
|||
<header> |
|||
<h3>商品分类榜</h3> |
|||
<DateHeader @sure="(date)=>{$data.categoritesparams=date;getanalyticscategories()}"/> |
|||
</header> |
|||
<el-table :data="categoritesdata" style="width: 100%"> |
|||
<el-table-column prop="date" label="排名"> |
|||
<template slot-scope="scope">{{scope.$index+1}}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="name" label="分类名称"></el-table-column> |
|||
<el-table-column prop="sale" label="销售金额(元)"></el-table-column> |
|||
<el-table-column prop="units" label="销售数量(台)"></el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import DateHeader from "../dateHeader"; |
|||
import { |
|||
get_analytics_locations, |
|||
get_analytics_producsts, |
|||
get_analytics_categories, |
|||
get_analytics_devices |
|||
} from "../../../api/dashboard"; |
|||
import { getToday } from "../../../utils/date"; |
|||
export default { |
|||
components: { |
|||
DateHeader |
|||
}, |
|||
data() { |
|||
return { |
|||
localtiondata: [], |
|||
localtionparams: { ...getToday() }, |
|||
|
|||
categoritesdata: [], |
|||
categoritesparams: { ...getToday() }, |
|||
|
|||
productsdata: [], |
|||
productsparams: { ...getToday() }, |
|||
|
|||
devicesdata: [], |
|||
devicesdataparams: { ...getToday() } |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.getlocationdata(); |
|||
this.getanalyticscategories(); |
|||
this.getproductsdata(); |
|||
this.getdevicesdata(); |
|||
}, |
|||
methods: { |
|||
async getlocationdata() { |
|||
this.localtiondata = await get_analytics_locations(this.localtionparams); |
|||
}, |
|||
async getanalyticscategories() { |
|||
this.categoritesdata = await get_analytics_categories( |
|||
this.categoritesparams |
|||
); |
|||
}, |
|||
async getproductsdata() { |
|||
this.productsdata = await get_analytics_producsts(this.productsparams); |
|||
}, |
|||
async getdevicesdata() { |
|||
this.devicesdata = await get_analytics_devices(this.devicesdataparams); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
.row3 { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
.item { |
|||
width: calc(50%-20px); |
|||
margin-bottom: 20px; |
|||
margin-right: 20px; |
|||
background: #fff; |
|||
&:nth-child(2n) { |
|||
margin-right: 0px; |
|||
} |
|||
header { |
|||
padding: 10px; |
|||
display: flex; |
|||
h3 { |
|||
margin-top: 10px; |
|||
} |
|||
|
|||
.views { |
|||
flex: 1; |
|||
justify-content: flex-end; |
|||
align-self: center; |
|||
align-items: center; |
|||
display: flex; |
|||
.tabs { |
|||
display: flex; |
|||
.item1 { |
|||
cursor: pointer; |
|||
font-size: 12px; |
|||
margin-right: 10px; |
|||
margin-top: 10px; |
|||
padding-bottom: 5px; |
|||
&.active { |
|||
border-bottom: 2px solid $menuActiveText; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@media screen and (max-width: 1000px) { |
|||
width: calc(100%); |
|||
margin-right: 0px; |
|||
&:nth-child(2n + 1) { |
|||
margin-right: 0px; |
|||
flex: 1; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,5 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
failt deivxce |
|||
</div> |
|||
</template> |
@ -1,341 +0,0 @@ |
|||
<template> |
|||
<div class="addDeviceModal"> |
|||
<!-- left --> |
|||
<div class="leftContainer" style="min-width:280px;"> |
|||
<el-input |
|||
style="min-width:200px;" |
|||
placeholder="搜索" |
|||
size="mini" |
|||
v-model="leftSearchValue" |
|||
class="input-with-select" |
|||
@keydown.enter.native="left_search" |
|||
></el-input> |
|||
<div @scroll="scrollEvent" class="leftListContainer"> |
|||
<ul class="ulContainer"> |
|||
<li v-for="item in selectArray" :key="item.id"> |
|||
<el-checkbox v-model="item.checked" @change="leftSelect" :disabled="item.disabled"> |
|||
<span>{{item.id}}</span> |
|||
<span style="padding-left:5px;">{{item.name}}</span> |
|||
</el-checkbox> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="centerBtn"> |
|||
<svg-icon |
|||
icon-class="right" |
|||
class="icon left" |
|||
@click="toRight" |
|||
:style="{background:clickType=='clickleft'?'#a90500':'#bfcbd9', |
|||
cursor:clickType=='clickleft'?'pointer':'not-allowed' }" |
|||
/> |
|||
<svg-icon |
|||
icon-class="left" |
|||
class="icon right" |
|||
@click="toLeft" |
|||
:style="{background:clickType=='clickright'?'#a90500':'#bfcbd9', |
|||
cursor:clickType=='clickright'?'pointer':'not-allowed',marginTop:'10px' }" |
|||
/> |
|||
</div> |
|||
|
|||
<!-- right --> |
|||
<div class="rightContainer"> |
|||
<ul class="ulContainer" style="min-width:250px;height:300px;overflow:auto;"> |
|||
<li v-for="item in value" :key="item.id"> |
|||
<el-checkbox v-model="item.checked" @change="rightSelect"> |
|||
<span>{{item.id}}</span> |
|||
<span style="padding-left:5px;">{{item.name}}</span> |
|||
</el-checkbox> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import mymap from "lodash.map"; |
|||
import sortBy from "lodash.sortby"; |
|||
import { clone } from "../../../filters"; |
|||
import { mergeArray } from "@/utils/lodash"; |
|||
import { GET_DEVICE_LISTS } from "@/api/devices"; |
|||
export default { |
|||
props: { |
|||
dataForm: { |
|||
type: Object |
|||
}, |
|||
width: { |
|||
type: Number, |
|||
default: 200 |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
clickType: "", |
|||
leftSearchValue: "", |
|||
rightSearchValue: "", |
|||
cacheSelectArray: [], |
|||
rightCacheSelectArray: [], |
|||
leftIsMore: false, |
|||
leftAllChecked: false |
|||
// params: { |
|||
// groupId: "", |
|||
// query: "", |
|||
// from: 0, |
|||
// size: 10 |
|||
// } |
|||
}; |
|||
}, |
|||
mounted() {}, |
|||
updated() {}, |
|||
computed: { |
|||
selectArray: { |
|||
get() { |
|||
return this.dataForm.selectArray; |
|||
}, |
|||
set(_value) { |
|||
return _value; |
|||
} |
|||
}, |
|||
value: { |
|||
get() { |
|||
return this.dataForm.value; |
|||
}, |
|||
set(_value) { |
|||
return _value; |
|||
} |
|||
}, |
|||
params() { |
|||
return this.dataForm.params; |
|||
} |
|||
}, |
|||
methods: { |
|||
leftSelectALL(e) { |
|||
if (e) { |
|||
this.dataForm.selectArray = this.dataForm.selectArray.map(item => { |
|||
item.checked = true; |
|||
return item; |
|||
}); |
|||
} else { |
|||
this.dataForm.selectArray = this.dataForm.selectArray.map(item => { |
|||
item.checked = false; |
|||
return item; |
|||
}); |
|||
} |
|||
}, |
|||
scrollEvent(e) { |
|||
if (e.target.scrollTop + e.target.offsetHeight >= e.target.scrollHeight) { |
|||
//出发底部 |
|||
this.loadMore(); |
|||
} |
|||
}, |
|||
clickLoalMore() { |
|||
if (this.$data.leftIsMore) { |
|||
this.dataForm.params.from = this.dataForm.params.from + 1; |
|||
this.loadMore(); |
|||
} |
|||
}, |
|||
loadMore() { |
|||
var self = this; |
|||
this.getDeiveList().then(selectArray => { |
|||
var size = self.dataForm.params.size; |
|||
var from = self.dataForm.params.from; |
|||
var leftIsMore = true; |
|||
if (selectArray.length < size) { |
|||
from = from; |
|||
leftIsMore = false; |
|||
} else { |
|||
from = size + from; |
|||
leftIsMore = true; |
|||
} |
|||
self.dataForm.params.from = from; |
|||
self.$data.leftIsMore = leftIsMore; |
|||
}); |
|||
}, |
|||
currentchange(page) { |
|||
this.dataForm.params.from = (page - 1) * this.dataForm.params.size; |
|||
this.getDeiveList(); |
|||
}, |
|||
getDeiveList() { |
|||
var self = this; |
|||
var params = clone(this.dataForm.params); |
|||
delete params.groupId; |
|||
return GET_DEVICE_LISTS(params).then(selectArray => { |
|||
self.dataForm.selectArray = mergeArray( |
|||
self.dataForm.selectArray, |
|||
selectArray |
|||
); |
|||
//如果已经选择 就 disabled |
|||
self.dataForm.selectArray.map((item, index) => { |
|||
self.dataForm.value.map(item2 => { |
|||
if (item2.id == item.id) { |
|||
// self.dataForm.selectArray.splice(index, 1); |
|||
item.checked = false; |
|||
item.disabled = true; |
|||
} |
|||
}); |
|||
return item; |
|||
}); |
|||
return selectArray; |
|||
}); |
|||
}, |
|||
left_search(e) { |
|||
var value = e.target.value.trim(); |
|||
this.dataForm.params.query = value; |
|||
this.dataForm.params.from = 0; |
|||
this.dataForm.selectArray = []; |
|||
this.getDeiveList(); |
|||
}, |
|||
left_table_click(row) { |
|||
this.$refs["multipleTable1"].toggleRowSelection(row); |
|||
}, |
|||
right_table_click(row) { |
|||
this.$refs["multipleTable2"].toggleRowSelection(row); |
|||
}, |
|||
filterMethod(query, item) { |
|||
return item.label.indexOf(query) > -1; |
|||
}, |
|||
clearQuery(q) { |
|||
console.log(q); |
|||
}, |
|||
leftSelect() { |
|||
this.clickType = "clickleft"; |
|||
}, |
|||
rightSelect() { |
|||
this.clickType = "clickright"; |
|||
}, |
|||
toRight() { |
|||
if (this.clickType != "clickleft") { |
|||
return false; |
|||
} |
|||
//left 删除掉 |
|||
//right 增加 |
|||
var self = this; |
|||
this.$data.cacheSelectArray = this.dataForm.selectArray.filter( |
|||
item => item.checked |
|||
); |
|||
// this.$data.cacheSelectArray.map((item, index) => { |
|||
// self.dataForm.selectArray.map((item1, index1) => { |
|||
// if (item1.id == item.id) { |
|||
// self.dataForm.selectArray.splice(index1, 1); |
|||
// } |
|||
// }); |
|||
// }); |
|||
this.dataForm.value = mergeArray( |
|||
this.dataForm.value, |
|||
JSON.parse(JSON.stringify(this.$data.cacheSelectArray)) |
|||
); |
|||
//禁止 |
|||
this.dataForm.selectArray = this.dataForm.selectArray.map(item => { |
|||
this.dataForm.value.map(item2 => { |
|||
if (item.id == item2.id) { |
|||
item.disabled = true; |
|||
item.checked = false; |
|||
} |
|||
}); |
|||
return item; |
|||
}); |
|||
this.dataForm.value = this.dataForm.value.map(item => { |
|||
item.checked = false; |
|||
return item; |
|||
}); |
|||
this.$data.cacheSelectArray = []; |
|||
this.$data.leftAllChecked = false; |
|||
this.$data.rightAllChecked = false; |
|||
this.clickType = ""; |
|||
}, |
|||
toLeft() { |
|||
if (this.clickType != "clickright") { |
|||
return false; |
|||
} |
|||
var self = this; |
|||
//add left |
|||
this.$data.rightCacheSelectArray = this.dataForm.value.filter( |
|||
item => item.checked |
|||
); |
|||
this.dataForm.selectArray = mergeArray( |
|||
this.dataForm.selectArray, |
|||
JSON.parse(JSON.stringify(this.$data.rightCacheSelectArray)) |
|||
); |
|||
//delete right |
|||
this.$data.rightCacheSelectArray.map((item, index) => { |
|||
self.dataForm.value.map((item1, index1) => { |
|||
if (item1.id == item.id) { |
|||
self.dataForm.value.splice(index1, 1); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
this.$data.rightCacheSelectArray = []; |
|||
this.$data.leftAllChecked = false; |
|||
this.$data.rightAllChecked = false; |
|||
//禁止 |
|||
this.dataForm.selectArray = this.dataForm.selectArray.map(item => { |
|||
item.disabled = false; |
|||
this.dataForm.value.map(item2 => { |
|||
if (item.id == item2.id) { |
|||
item.disabled = true; |
|||
item.checked = false; |
|||
} |
|||
}); |
|||
return item; |
|||
}); |
|||
this.clickType = ""; |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
|
|||
.transfer-footer { |
|||
overflow-x: auto; |
|||
} |
|||
|
|||
.ulContainer { |
|||
list-style: none; |
|||
padding: 0; |
|||
margin: 0; |
|||
margin-top: 5px; |
|||
& li { |
|||
padding: 0; |
|||
margin: 0; |
|||
padding: 5px 10px; |
|||
} |
|||
} |
|||
.pagination { |
|||
margin-top: 10px; |
|||
} |
|||
|
|||
.addDeviceModal { |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.leftContainer, |
|||
.rightContainer { |
|||
padding: 10px; |
|||
border: 1px solid #ddd; |
|||
.leftListContainer { |
|||
margin-top: 10px; |
|||
height: 290px; |
|||
overflow: auto; |
|||
} |
|||
} |
|||
|
|||
.centerBtn { |
|||
padding: 10px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
|
|||
.icon { |
|||
width: 40px; |
|||
height: 40px; |
|||
border-radius: 100%; |
|||
border: 1px solid #ddd; |
|||
padding: 10px; |
|||
background: $menuText; |
|||
color: $subMenuActiveText; |
|||
} |
|||
} |
|||
</style> |
@ -1,63 +0,0 @@ |
|||
<template> |
|||
<div class="form"> |
|||
<el-form |
|||
:inline="true" |
|||
:model="dataForm" |
|||
class="demo-form-inline" |
|||
label-width="120px" |
|||
ref="form" |
|||
> |
|||
<div> |
|||
<el-form-item label="分组名称" |
|||
prop="name" |
|||
:rules="[ { required: true, message: '不能为空'}, ]" |
|||
> |
|||
<el-input |
|||
v-model="dataForm.name" |
|||
placeholder="分组名称" |
|||
|
|||
></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
<!-- <el-form-item> |
|||
<el-button |
|||
type="primary" |
|||
@click="onSubmit" |
|||
>查询</el-button> |
|||
</el-form-item> --> |
|||
</template> |
|||
|
|||
<script> |
|||
import {mapState, mapActions} from "vuex"; |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
dataForm: { |
|||
name: "" |
|||
} |
|||
}; |
|||
}, |
|||
mounted() { |
|||
}, |
|||
computed: {}, |
|||
methods: {} |
|||
|
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.form { |
|||
background: #fff; |
|||
|
|||
.demo-form-inline { |
|||
width: 700px; |
|||
margin: auto; |
|||
padding-top: 60px; |
|||
padding-bottom: 60px; |
|||
|
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,47 +0,0 @@ |
|||
<template> |
|||
<div class="editModal"> |
|||
<el-form |
|||
:inline="true" |
|||
:model="dataForm_copy" |
|||
class="demo-form-inline" |
|||
label-width="120px" |
|||
ref="form" |
|||
> |
|||
<div> |
|||
<el-form-item label="分组名称" |
|||
prop="name" |
|||
:rules="[ { required: true, message: '不能为空'}, ]" |
|||
> |
|||
<el-input |
|||
v-model="dataForm_copy.name" |
|||
placeholder="分组名称" |
|||
|
|||
></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import {mapState} from 'vuex' |
|||
|
|||
export default { |
|||
props: { |
|||
dataForm: { |
|||
type: Object |
|||
} |
|||
}, |
|||
data() { |
|||
return {} |
|||
}, |
|||
destroyed() { |
|||
|
|||
}, |
|||
computed: { |
|||
...mapState('device/group/edit', {}), |
|||
dataForm_copy() { |
|||
return JSON.parse(JSON.stringify(this.dataForm)) |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -1,327 +0,0 @@ |
|||
<template> |
|||
<div class="pageContainer"> |
|||
<div class="formContainer"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="分组名"> |
|||
<el-input v-model="formInline.query" placeholder="分组名"></el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<!-- <el-button @click="resetForm1">重置</el-button> --> |
|||
<el-button type="primary" @click="search">搜索</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
|
|||
<div class="tableContainer"> |
|||
<div class="btnContainer"> |
|||
<el-button type="primary" @click="addModal=true">新增分组</el-button> |
|||
</div> |
|||
<template> |
|||
<el-table :data="lists" style="width: 100%"> |
|||
<el-table-column prop="name" label="分组名"></el-table-column> |
|||
<el-table-column prop="devices" label="设备数量"></el-table-column> |
|||
<!-- <el-table-column--> |
|||
<!-- prop="address"--> |
|||
<!-- label="创建时间">--> |
|||
<!-- </el-table-column>--> |
|||
<el-table-column fixed="right" label="操作"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
type="text" |
|||
size="small" |
|||
style="color:#a90500" |
|||
@click="toEdit(scope.row)" |
|||
>编辑</el-button> |
|||
<el-button |
|||
type="text" |
|||
size="small" |
|||
style="color:#a90500" |
|||
@click="go2addDevice(scope.row)" |
|||
>添加设备</el-button> |
|||
<el-button type="text" size="small" @click="deleteGroup(scope.row)">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</template> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
layout="prev, pager, next" |
|||
:current-page="page" |
|||
:total="parseInt(list_total)" |
|||
@current-change="currentChange" |
|||
></el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- add modal--> |
|||
<el-dialog |
|||
title="添加" |
|||
width="400px" |
|||
:visible.sync="addModal" |
|||
:before-close="handleCloseAddModal" |
|||
> |
|||
<AddModal ref="addmodalContainer"></AddModal> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addModal = false">取消</el-button> |
|||
<el-button type="primary" @click="sureAddModal">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!-- update modal--> |
|||
<el-dialog |
|||
title="编辑" |
|||
width="400px" |
|||
:visible.sync="updateModal" |
|||
:before-close="handleCloseAddModal" |
|||
> |
|||
<UpdateModal ref="updatemodalContainer" :dataForm="editDataForm"></UpdateModal> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="updateModal = false">取消</el-button> |
|||
<el-button type="primary" @click="sureUpdateModal">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!-- 添加 设备弹出框--> |
|||
<el-dialog |
|||
title="编辑" |
|||
width="800px" |
|||
:visible.sync="addDeviceModal" |
|||
:before-close="handleCloseAddModal" |
|||
> |
|||
<AddDeviceModal |
|||
v-if="addDeviceModal" |
|||
ref="AddDeviceModalContainer" |
|||
:dataForm="addDeviceModalDataForm" |
|||
></AddDeviceModal> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addDeviceModal = false">取消</el-button> |
|||
<el-button type="primary" @click="sureAddDeviceModal">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { mapState, mapActions } from "vuex"; |
|||
import myalert from "@/utils/alert"; |
|||
import { |
|||
GET_DEVICE_LISTS, |
|||
GET_LIST_TOTAL, |
|||
ADD_DEVICES_INTO_GROUP, |
|||
DELETE_DEVICE_GROUPS, |
|||
GET_DEVICES_NUM |
|||
} from "@/api/devices"; |
|||
import { pageSize } from "../../../config"; |
|||
const UpdateModal = () => import("./editModal"); |
|||
const AddModal = () => import("./addModal"); |
|||
const AddDeviceModal = () => import("./addDeviceModal"); |
|||
export default { |
|||
name: "device_group_list", |
|||
components: { |
|||
AddModal, |
|||
UpdateModal, |
|||
AddDeviceModal |
|||
}, |
|||
data() { |
|||
return { |
|||
editDataForm: {}, |
|||
tableData: [], |
|||
addModal: false, |
|||
updateModal: false, |
|||
addDeviceModal: false, |
|||
addDeviceModalDataForm: {} //添加设备数据 |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.getDeviceGroups({ from: 0, size: pageSize, ...this.formInline }); |
|||
this.getListTotal(); |
|||
}, |
|||
computed: { |
|||
...mapState("device/group/list", { |
|||
tableLoading: state => state.tableLoading, |
|||
lists: state => state.lists, |
|||
formInline: state => state.params, |
|||
from: state => state.page.from, |
|||
list_total: state => state.list_total, |
|||
devicesNum: state => state.devicesNum, |
|||
size: state => state.page.size |
|||
}), |
|||
page: function() { |
|||
return parseInt(this.from / this.size) + 1; |
|||
}, |
|||
handleCloseAddModal() {} |
|||
}, |
|||
methods: { |
|||
...mapActions("device/group/list", [ |
|||
"getDeviceGroups", |
|||
"resetForm", |
|||
"getListTotal", |
|||
"changeDeviceListPage" |
|||
]), |
|||
...mapActions("device/group/add", ["addDeviceGroup"]), |
|||
...mapActions("device/group/edit", ["initEditRow", "updateDeviceGroup"]), |
|||
deleteGroup(row) { |
|||
var self = this; |
|||
this.$confirm("此操作将永久删除该设备组, 是否继续?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}).then(() => { |
|||
DELETE_DEVICE_GROUPS(row) |
|||
.then(res => { |
|||
myalert.success.call(self, "删除成功"); |
|||
//刷新界面 |
|||
self.getDeviceGroups({ |
|||
from: self.from, |
|||
size: self.size, |
|||
...self.formInline |
|||
}); |
|||
}) |
|||
.catch(e => { |
|||
console.error(e); |
|||
myalert.fail.call(self, "删除失败"); |
|||
}); |
|||
}); |
|||
}, |
|||
//确定 分组按钮 |
|||
sureAddDeviceModal() { |
|||
var self = this; |
|||
var deviceIds = this.$refs["AddDeviceModalContainer"].dataForm.value; |
|||
var groupId = this.$refs["AddDeviceModalContainer"].dataForm.params |
|||
.groupId; |
|||
//添加到后台 |
|||
ADD_DEVICES_INTO_GROUP({ |
|||
groupId, |
|||
deviceIds: deviceIds.map(item => item.id) |
|||
}) |
|||
.then(res => { |
|||
myalert.success.call(self, "添加成功"); |
|||
self.$data.addDeviceModal = false; |
|||
//刷新界面 |
|||
self.getDeviceGroups({ ...self.formInline }); |
|||
}) |
|||
.catch(e => { |
|||
myalert.success.call(self, "添加失败"); |
|||
self.$data.addDeviceModal = true; |
|||
console.error(e); |
|||
}); |
|||
}, |
|||
currentChange(page) { |
|||
var params = { |
|||
from: (page - 1) * this.size, |
|||
size: this.size |
|||
}; |
|||
this.getData(params); |
|||
}, |
|||
getData({ from, size }) { |
|||
this.changeDeviceListPage({ ...this.formInline, from, size }); |
|||
}, |
|||
search() { |
|||
this.getDeviceGroups({ ...this.formInline }); |
|||
}, |
|||
resetForm1() { |
|||
this.resetForm(); |
|||
}, |
|||
sureAddModal() { |
|||
var self = this; |
|||
var $addmodal = this.$refs["addmodalContainer"].$refs["form"]; |
|||
|
|||
$addmodal.validate(valid => { |
|||
if (valid) { |
|||
self.$data.addModal = false; |
|||
|
|||
self.addDeviceGroup({ ...$addmodal.model }).then(res => { |
|||
if (res.success) { |
|||
myalert.success.call(self, "保存成功"); |
|||
this.getDeviceGroups({ |
|||
...self.formInline, |
|||
from: self.from, |
|||
size: self.size |
|||
}); |
|||
$addmodal.resetFields(); |
|||
} else { |
|||
myalert.fail.call(this, res.message); |
|||
} |
|||
}); |
|||
} else { |
|||
self.$data.addModal = true; |
|||
} |
|||
}); |
|||
}, |
|||
sureUpdateModal() { |
|||
var self = this; |
|||
var $modal = this.$refs["updatemodalContainer"].$refs["form"]; |
|||
$modal.validate(valid => { |
|||
if (valid) { |
|||
self.$data.updateModal = false; |
|||
self.updateDeviceGroup($modal.model); |
|||
} else { |
|||
self.$data.updateModal = true; |
|||
} |
|||
}); |
|||
}, |
|||
toEdit(row) { |
|||
this.$data.updateModal = true; |
|||
this.$data.editDataForm = row; |
|||
}, |
|||
go2addDevice(row) { |
|||
var self = this; |
|||
var params = { |
|||
// groupId: row.id, |
|||
// group: row, |
|||
query: "", |
|||
total: 0, |
|||
from: 0, |
|||
size: pageSize |
|||
}; |
|||
GET_DEVICE_LISTS(params).then(selectArray => { |
|||
params.groupId = row.id; |
|||
params.group = row; |
|||
GET_DEVICE_LISTS(params).then(value => { |
|||
//获取一次device的总数 |
|||
GET_DEVICES_NUM(params).then(({ activeDevices, devices }) => { |
|||
params.total = devices; |
|||
params.activeDevices = activeDevices; |
|||
//如果已经选择 就 disabled |
|||
selectArray = selectArray.map((item, index) => { |
|||
value.map(item2 => { |
|||
if (item2.id == item.id) { |
|||
// self.dataForm.selectArray.splice(index, 1); |
|||
item.checked = false; |
|||
item.disabled = true; |
|||
} |
|||
}); |
|||
return item; |
|||
}); |
|||
self.$data.addDeviceModalDataForm = { |
|||
selectArray: selectArray, |
|||
value: value, |
|||
params |
|||
}; |
|||
self.$data.addDeviceModal = true; |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.pageContainer { |
|||
} |
|||
|
|||
.formContainer { |
|||
padding-top: 20px; |
|||
padding-left: 20px; |
|||
background: #fff; |
|||
} |
|||
|
|||
.tableContainer { |
|||
margin-top: 20px; |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 10px; |
|||
padding-bottom: 10px; |
|||
} |
|||
</style> |
@ -1,96 +0,0 @@ |
|||
<template> |
|||
<div class="form"> |
|||
<el-alert title="特别说明" description="设备编号可以为空,当为空时,系统自动颁发唯一识别符作为设备编号" type="warning" show-icon></el-alert> |
|||
<el-form |
|||
:inline="true" |
|||
:model="dataForm" |
|||
class="demo-form-inline" |
|||
label-width="80px" |
|||
ref="form" |
|||
> |
|||
<div> |
|||
<el-form-item |
|||
label="设备类型" |
|||
prop="deviceTypeId" |
|||
:rules="[ { required: true, message: '不能为空'}, ]" |
|||
> |
|||
<el-select v-model="dataForm.deviceTypeId" placeholder="设备类型"> |
|||
<el-option |
|||
:key="item.id" |
|||
v-for="item in deviceTypes" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="设备编号" prop="name"> |
|||
<el-input v-model="dataForm.id" placeholder="设备编号" type="number"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
<div> |
|||
<el-form-item label="设备名称" prop="name"> |
|||
<el-input v-model="dataForm.name" placeholder="设备名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="选择场地" prop="locationId"> |
|||
<el-select v-model="dataForm.locationId" placeholder="选择场地"> |
|||
<el-option :key="item.id" v-for="item in locations" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
<div> |
|||
<el-form-item label="分组" prop="planId"> |
|||
<el-select v-model="dataForm.planId" placeholder="分组"> |
|||
<el-option v-for="item in deviceGroups" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
<!-- <el-form-item> |
|||
<el-button |
|||
type="primary" |
|||
@click="onSubmit" |
|||
>查询</el-button> |
|||
</el-form-item>--> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapState, mapActions } from "vuex"; |
|||
|
|||
export default { |
|||
data() { |
|||
return {}; |
|||
}, |
|||
mounted() { |
|||
this.getDeviceGroups(); |
|||
}, |
|||
computed: { |
|||
...mapState({ |
|||
roles: state => state.common.roles, |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups |
|||
}), |
|||
...mapState("device/list", { |
|||
dataForm: state => state.addParams |
|||
}) |
|||
}, |
|||
methods: { |
|||
...mapActions(["getDeviceGroups"]) |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.form { |
|||
background: #fff; |
|||
|
|||
.demo-form-inline { |
|||
width: 700px; |
|||
margin: auto; |
|||
padding-top: 60px; |
|||
padding-bottom: 60px; |
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,145 +0,0 @@ |
|||
<template> |
|||
<div class="form"> |
|||
<el-form |
|||
v-loading="loading" |
|||
:inline="true" |
|||
:model="dataForm" |
|||
class="demo-form-inline" |
|||
label-width="120px" |
|||
ref="form" |
|||
> |
|||
<div> |
|||
<el-form-item label="设备类型" prop="type" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-select v-model="dataForm.type" placeholder="设备类型" :disabled="true"> |
|||
<el-option |
|||
:key="item.id" |
|||
v-for="item in deviceGroups" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="设备名称" prop="name"> |
|||
<el-input v-model="dataForm.name" placeholder="设备名称"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
<div> |
|||
<el-form-item label="设备编号" prop="id" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input v-model="dataForm.id" placeholder="设备编号" disabled type="number"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="选择场地" prop="locationId"> |
|||
<el-select v-model="dataForm.locationId" placeholder="选择场地" :clearable="true"> |
|||
<el-option :key="item.id" v-for="item in locations" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
<div> |
|||
<el-form-item label="分组" prop="groupId"> |
|||
<el-select v-model="dataForm.groupId" placeholder="分组" :clearable="true"> |
|||
<el-option |
|||
:key="item.id" |
|||
v-for="item in deviceGroups" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
<div class="last_row" style="display:flex;margin-left:120px"> |
|||
<el-form-item> |
|||
<el-button type="default" @click="resetForm1('ruleForm')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">修改</el-button> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
<!-- <el-form-item> |
|||
<el-button |
|||
type="primary" |
|||
@click="onSubmit" |
|||
>查询</el-button> |
|||
</el-form-item>--> |
|||
</template> |
|||
<script> |
|||
import { mapState, mapActions } from "vuex"; |
|||
import myalert from "@/utils/alert"; |
|||
import { setTimeout } from "timers"; |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
deviceId: "", |
|||
dataFormCopy: {} |
|||
}; |
|||
}, |
|||
mounted() { |
|||
var deviceId = this.$route.query.id; |
|||
this.getDeviceDetail({ id: deviceId }); |
|||
|
|||
this.getDeviceGroups(); |
|||
this.getLocations(); |
|||
}, |
|||
computed: { |
|||
...mapState("device/edit", { |
|||
dataForm: state => state.device, |
|||
loading: state => state.loading |
|||
}), |
|||
...mapState({ |
|||
roles: state => state.common.roles, |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups |
|||
}) |
|||
}, |
|||
methods: { |
|||
...mapActions("device/edit", [ |
|||
"getDeviceDetail", |
|||
"updateDevice", |
|||
"resetForm" |
|||
]), |
|||
...mapActions([ |
|||
"getRoles", |
|||
"getDeviceGroups", |
|||
"getLocations", |
|||
"delVisitedView" |
|||
]), |
|||
//update sure btn |
|||
onSubmit() { |
|||
var self = this; |
|||
this.$refs["form"].validate(valid => { |
|||
if (valid) { |
|||
self.updateDevice(self.dataForm).then(res => { |
|||
if (res.success) { |
|||
myalert.success(res.message); |
|||
setTimeout(() => { |
|||
self.delVisitedView(self.$route).then(res => { |
|||
self.$router.go(-1); |
|||
}); |
|||
}, 500); |
|||
} else { |
|||
myalert.fail(res.message); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
resetForm1() { |
|||
this.resetForm(); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.form { |
|||
background: #fff; |
|||
|
|||
.demo-form-inline { |
|||
width: 700px; |
|||
margin: auto; |
|||
padding-top: 60px; |
|||
padding-bottom: 60px; |
|||
} |
|||
} |
|||
</style> |
|||
|
@ -1,99 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form |
|||
ref="ruleForm" |
|||
:inline="true" |
|||
:model="formData" |
|||
class="demo-form-inline" |
|||
label-position="right" |
|||
label-width="100px" |
|||
> |
|||
<div> |
|||
<el-form-item label="设备名称"> |
|||
<el-input v-model="formData.query" placeholder="公司名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备编号"> |
|||
<el-input v-model="formData.id" placeholder="设备编号"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备状态"> |
|||
<el-select :clearable="true" v-model="formData.active" :value="''" placeholder="设备状态"> |
|||
<el-option label="在线" :value="true"></el-option> |
|||
<el-option label="离线" :value="false"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
<div> |
|||
<el-form-item label="场地"> |
|||
<el-select v-model="formData.locationId" placeholder="场地" :clearable="true"> |
|||
<el-option :key="item.id" v-for="item in locations" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="分组"> |
|||
<el-select v-model="formData.groupId" placeholder="分组" :clearable="true"> |
|||
<el-option |
|||
:key="item.id" |
|||
v-for="item in deviceGroups" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="类型"> |
|||
<el-select :clearable="true" v-model="formData.typeId" placeholder="类型"> |
|||
<el-option |
|||
:key="item.id" |
|||
v-for="item in deviceTypes" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<!-- <el-button type="default" @click="resetForm1('ruleForm')">重置</el-button> --> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { mapState, mapActions } from "vuex"; |
|||
|
|||
export default { |
|||
data() { |
|||
return {}; |
|||
}, |
|||
mounted() { |
|||
this.getDeviceTypes(); |
|||
this.getLocations(); |
|||
this.getDeviceGroups(); |
|||
}, |
|||
computed: { |
|||
...mapState("device/list", { |
|||
formData: state => state.params |
|||
}), |
|||
...mapState({ |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups |
|||
}) |
|||
}, |
|||
methods: { |
|||
...mapActions("device/list", ["getDeviceList", "resetForm"]), |
|||
...mapActions(["getDeviceTypes", "getLocations", "getDeviceGroups"]), |
|||
resetForm1(formName) { |
|||
this.resetForm(); |
|||
}, |
|||
onSubmit() { |
|||
this.getDeviceList(this.formData); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.form-container { |
|||
background: #fff; |
|||
padding: 30px; |
|||
} |
|||
</style> |
@ -1,211 +0,0 @@ |
|||
<template> |
|||
<div class="page-container"> |
|||
<form-container></form-container> |
|||
<div class="centerWrapper"> |
|||
<Profile :devicesNum="devicesNum"></Profile> |
|||
<div class="btns"> |
|||
<el-button type="primary" @click="addModal=true">添加设备</el-button> |
|||
</div> |
|||
<el-table v-loading="tableLoading" :data="lists" style="width: 100%"> |
|||
<el-table-column prop="id" label="编号"></el-table-column> |
|||
<el-table-column prop="name" label="设备"></el-table-column> |
|||
<!-- <el-table-column prop="typeName" label="设备类型"></el-table-column> --> |
|||
<el-table-column prop="typeName" label="场地地址"> |
|||
<template slot-scope="scope"> |
|||
<div>{{scope.row.locationName}}</div> |
|||
<div> |
|||
{{scope.row.province}} |
|||
{{scope.row.city}} |
|||
{{scope.row.district}} |
|||
{{scope.row.street}} |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="groupName" label="分组名称"></el-table-column> |
|||
<el-table-column prop="typeName" label="设备类型"></el-table-column> |
|||
<!-- <el-table-column prop="typeName" label="门状态"></el-table-column> --> |
|||
<el-table-column prop="createdDate" label="创建时间"> |
|||
<template slot-scope="scope">{{scope.row.createdDate|parseTime}}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="active" label="设备状态" width="50"> |
|||
<template slot-scope="scope"> |
|||
<span v-if="!scope.row.active">离线</span> |
|||
<span v-if="scope.row.active">在线</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column fixed="right" label="操作"> |
|||
<template slot-scope="scope"> |
|||
<router-link |
|||
type="text" |
|||
size="small" |
|||
style="color:#a90500;margin-right:10px;" |
|||
:to="`/device/list/edit?id=${scope.row.id}`" |
|||
>编辑</router-link> |
|||
<el-button type="text" size="small" @click="seeCode(scope.row.id)">二维码</el-button> |
|||
<el-button type="text" size="small" @click="seewxCode(scope.row.id)">小程序码</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
layout="prev, pager, next" |
|||
:current-page="page" |
|||
:page-size="size" |
|||
:total="parseInt(list_total)" |
|||
@current-change="currentChange" |
|||
></el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- add modal--> |
|||
<el-dialog |
|||
title="添加" |
|||
width="800px" |
|||
:visible.sync="addModal" |
|||
:before-close="handleCloseAddModal" |
|||
> |
|||
<AddModal ref="addmodalContainer"></AddModal> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="addModal = false">取消</el-button> |
|||
<el-button type="primary" @click="sureAddModal">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { mapState, mapActions } from "vuex"; |
|||
import { GET_wxCODE } from "../../../api/devices"; |
|||
import { BASE_API } from "../../../config"; |
|||
import myalert from "@/utils/alert"; |
|||
import { GET_CODE } from "@/api/devices"; |
|||
import { downLoad } from "@/utils/A"; |
|||
import { getCookie } from "../../../utils/cookie"; |
|||
|
|||
const FormContainer = () => import("./form.vue"); |
|||
const Profile = () => import("./profile.vue"); |
|||
const AddModal = () => import("./addModal"); |
|||
export default { |
|||
data() { |
|||
return { |
|||
addModal: false |
|||
}; |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
Profile, |
|||
AddModal |
|||
}, |
|||
mounted() { |
|||
var params = { |
|||
from: this.from, |
|||
size: this.size |
|||
}; |
|||
this.getData(params); |
|||
this.getListTotal({ ...this.params }); |
|||
this.setDevicesNum({ ...this.params }); |
|||
}, |
|||
computed: { |
|||
...mapState("device/list", { |
|||
tableLoading: state => state.tableLoading, |
|||
lists: state => state.lists, |
|||
params: state => state.params, |
|||
from: state => state.page.from, |
|||
list_total: state => state.list_total, |
|||
devicesNum: state => state.devicesNum, |
|||
size: state => state.page.size |
|||
}), |
|||
page: function() { |
|||
return parseInt(this.from / this.size) + 1; |
|||
}, |
|||
handleCloseAddModal() {} |
|||
}, |
|||
methods: { |
|||
...mapActions("device/list", [ |
|||
"changeDeviceListPage", |
|||
"setDevicesNum", |
|||
"getListTotal", |
|||
"addDeivce" |
|||
]), |
|||
currentChange(page) { |
|||
var params = { |
|||
from: (page - 1) * this.size, |
|||
size: this.size |
|||
}; |
|||
this.getData(params); |
|||
}, |
|||
getData({ from, size }) { |
|||
this.changeDeviceListPage({ from, size }); |
|||
}, |
|||
sureAddModal() { |
|||
var self = this; |
|||
var $addmodal = this.$refs["addmodalContainer"].$refs["form"]; |
|||
$addmodal.validate(valid => { |
|||
if (valid) { |
|||
self |
|||
.addDeivce() |
|||
.then(res => { |
|||
if (res.success) { |
|||
self.$data.addModal = false; |
|||
myalert.success("保存成功"); |
|||
} else { |
|||
self.$data.addModal = true; |
|||
// res.message.message |
|||
myalert.fail("设备id冲突,请填写其它id"); |
|||
} |
|||
}) |
|||
.catch(e => { |
|||
self.$data.addModal = true; |
|||
// res.message.message |
|||
myalert.fail("设备id冲突,请填写其它id"); |
|||
}); |
|||
} else { |
|||
self.$data.addModal = true; |
|||
} |
|||
}); |
|||
}, |
|||
//查看二维码 |
|||
seeCode(id) { |
|||
var self = this; |
|||
downLoad( |
|||
BASE_API + |
|||
`/api/admin/devices/qrcode?deviceId=${id}&access_token=${getCookie( |
|||
"access_token" |
|||
)}` |
|||
); |
|||
}, |
|||
seewxCode(id) { |
|||
var self = this; |
|||
downLoad( |
|||
BASE_API + |
|||
`/api/admin/devices/qrcodeText?deviceId=${id}&access_token=${getCookie( |
|||
"access_token" |
|||
)}` |
|||
); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/variables.scss"; |
|||
|
|||
.page-container { |
|||
.centerWrapper { |
|||
margin-top: 20px; |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
|
|||
.tableBtnsRow { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
font-size: 20px; |
|||
padding-bottom: 20px; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,48 +0,0 @@ |
|||
<template> |
|||
<div class="profile"> |
|||
<div class="item"> |
|||
<div class="small">总设备数</div> |
|||
<div class="strong">{{devicesNum.devices}}台</div> |
|||
</div> |
|||
<div class="item"> |
|||
<div class="small">离线设备</div> |
|||
<div class="strong">{{devicesNum .devices-devicesNum.activeDevices}}台</div> |
|||
</div> |
|||
<div class="item"> |
|||
<div class="small">在线设备</div> |
|||
<div class="strong">{{devicesNum.activeDevices}}台</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: ["devicesNum"] |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.profile { |
|||
display: flex; |
|||
justify-content: space-around; |
|||
margin-bottom: 40px; |
|||
border-bottom: 1px solid #ddd; |
|||
padding-bottom: 20px; |
|||
|
|||
.item { |
|||
width: 100%; |
|||
text-align: center; |
|||
border-right: 1px solid #ddd; |
|||
|
|||
.small { |
|||
} |
|||
|
|||
.strong { |
|||
margin-top: 10px; |
|||
font-size: 20px; |
|||
} |
|||
|
|||
&:last-child { |
|||
border-right: none; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,5 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
map deivxce |
|||
</div> |
|||
</templatdeivxcee> |
@ -1,119 +0,0 @@ |
|||
<template> |
|||
<el-row> |
|||
<el-col :span="24" style="margin-bottom: 10px;"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple">分润对象:</div> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple-light">分润比例:</div> |
|||
</el-col> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="24" v-for="(item,index) in lists" style="margin-bottom: 10px;"> |
|||
<el-form :inline="true" class="demo-form-inline"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-row :gutter="15"> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple"> |
|||
<el-select v-model="item.userId" :value="item.userId" placeholder="选择分润对象"> |
|||
<el-option v-for="opi in accounts" :label="opi.name" :value="opi.id"></el-option> |
|||
</el-select> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-input placeholder="" @input="limitMax(item.rate,index)" v-model="item.rate" |
|||
max="100" min="1"></el-input> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-button type="danger" @click="deleteObj(index)" icon="el-icon-delete"></el-button> |
|||
</div> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
</div> |
|||
</el-form> |
|||
</el-col> |
|||
<el-button @click="addObj">添加分润对象</el-button> |
|||
</el-row> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_ACCOUNT_LIST} from '@/api/privilegeManagement' |
|||
import {DETAIL_EQUIPMENT_LIST} from '@/api/distribution' |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
export default { |
|||
name: "detailsOfDistribution", |
|||
props: ['currId'], |
|||
data() { |
|||
return { |
|||
lists: [], |
|||
accounts: [] |
|||
} |
|||
}, |
|||
watch: { |
|||
currId() { |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getAccounts(); |
|||
this.getDetail(); |
|||
}, |
|||
methods: { |
|||
getDetail() { |
|||
let params = { |
|||
id: this.currId |
|||
}; |
|||
DETAIL_EQUIPMENT_LIST(params).then(res => { |
|||
this.lists = res |
|||
}) |
|||
}, |
|||
/** |
|||
* 添加分润对象 |
|||
*/ |
|||
addObj() { |
|||
let obj = { |
|||
userId: '', |
|||
rate: '' |
|||
}; |
|||
this.lists.push(obj) |
|||
}, |
|||
|
|||
/** |
|||
* 删除分润对象 |
|||
*/ |
|||
deleteObj(idx) { |
|||
let lists = []; |
|||
this.lists.map((item, index) => { |
|||
if (idx != index) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists |
|||
}, |
|||
getAccounts() { |
|||
GET_ACCOUNT_LIST().then(res => { |
|||
this.accounts = res; |
|||
}) |
|||
}, |
|||
limitMax(val, idx) { |
|||
if (val >= 100 || val <= 0) { |
|||
Alert.fail('值不能大于100,小于0'); |
|||
val = '' |
|||
} |
|||
|
|||
this.lists[idx].rate = val; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
</style> |
@ -1,92 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="设备编号"> |
|||
<el-input v-model="formInline.name" placeholder="设备编号"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备类型"> |
|||
<el-select v-model="formInline.typeId" value="" placeholder="设备类型"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in type" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="设备分组"> |
|||
<el-select v-model="formInline.groupId" value="" placeholder="设备分组"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in group" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="场地"> |
|||
<el-select v-model="formInline.locationId" value="" placeholder="场地"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in locationId" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('formInline')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_DEVICE_DEVICEGROUPS, GET_DEVICE_TYPES,GET_LOCATIONS} from '@/api/common' |
|||
|
|||
export default { |
|||
name: 'form-container', |
|||
props: ['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
name: '', |
|||
typeId: '', |
|||
locationId: '', |
|||
groupId: '' |
|||
}, |
|||
type: '', |
|||
locationId: '', |
|||
group: '' |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getType(); |
|||
this.getDeviceGroups(); |
|||
this.getLocationId(); |
|||
}, |
|||
methods: { |
|||
getType() { |
|||
GET_DEVICE_TYPES().then(res => { |
|||
this.type = res |
|||
}) |
|||
}, |
|||
getDeviceGroups() { |
|||
GET_DEVICE_DEVICEGROUPS().then(res => { |
|||
this.group = res |
|||
}) |
|||
}, |
|||
getLocationId() { |
|||
GET_LOCATIONS().then(res => { |
|||
this.locationId = res |
|||
}) |
|||
}, |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -1,274 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
<div class="table"> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="locationName" |
|||
label="场地名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="users" |
|||
label="分润人数"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="stateText" |
|||
label="状态"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="suspensionOfRelease(lists.row.id,lists.row.enabled)" |
|||
> |
|||
<span>{{lists.row.enabled==true?"暂停":"发布"}}</span> |
|||
</span> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
style="margin: 0 5px;" |
|||
class="option-span" |
|||
@click="editModal(lists.row.id)" |
|||
> |
|||
<span>编辑</span> |
|||
</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<el-dialog |
|||
width="400px" |
|||
:show-close="false" |
|||
:visible.sync="isEdit"> |
|||
<details-of-distribution ref="distribution" :currId="id" v-if="isEdit"></details-of-distribution> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="isEdit = false">取消</el-button> |
|||
<el-button type="primary" @click="determine('ruleForm')">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {pageSize} from '../../../config'; |
|||
|
|||
const FormContainer = () => import('./form.vue'); |
|||
const DetailsOfDistribution = () => import('./detailsOfDistribution.vue'); |
|||
import { |
|||
GET_EQUIPMENT_LIST, |
|||
POST_EQUIPMENT_LIST, |
|||
DETAIL_EQUIPMENT_LIST, |
|||
ENABLE_EQUIPMENT_LIST, |
|||
DISABLE_EQUIPMENT_LIST, |
|||
COUNT_EQUIPMENT_LIST |
|||
} from '@/api/distribution' |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
export default { |
|||
name: "index", |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
id: '', |
|||
isEdit: false, |
|||
lists: [], |
|||
params: { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '', |
|||
typeId: '', |
|||
locationId: '', |
|||
groupId: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList() |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
DetailsOfDistribution |
|||
}, |
|||
methods: { |
|||
submitForm(res) { |
|||
this.params = { |
|||
...this.params, |
|||
query: res.name, |
|||
typeId: res.typeId, |
|||
locationId: res.locationId, |
|||
groupId: res.groupId |
|||
}; |
|||
this.getList() |
|||
}, |
|||
resetForm() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize, |
|||
query: '', |
|||
typeId: '', |
|||
locationId: '', |
|||
groupId: '' |
|||
}; |
|||
this.getList() |
|||
}, |
|||
getList() { |
|||
GET_EQUIPMENT_LIST(this.params).then(res => { |
|||
res.map((item) => { |
|||
item.stateText = item.enabled ? '生效中' : '失效中'; |
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
|
|||
COUNT_EQUIPMENT_LIST(this.params).then(res => { |
|||
this.count = res |
|||
}) |
|||
|
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
...this.params, |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList() |
|||
}, |
|||
|
|||
editModal(id) { |
|||
this.isEdit = true; |
|||
this.id = id; |
|||
}, |
|||
|
|||
/** |
|||
* 状态操作 |
|||
*/ |
|||
suspensionOfRelease(id, enabled) { |
|||
if (enabled) { |
|||
this.PUBLISHED(id) |
|||
} else { |
|||
this.PAUSEDANDPENDING(id) |
|||
} |
|||
}, |
|||
/** |
|||
* 已发布 |
|||
* @constructor |
|||
*/ |
|||
PUBLISHED(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
DISABLE_EQUIPMENT_LIST(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '失效中'; |
|||
item.enabled = false; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success("已失效"); |
|||
}); |
|||
}, |
|||
/** |
|||
* 已暂停或者待发布 |
|||
* @constructor |
|||
*/ |
|||
PAUSEDANDPENDING(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
ENABLE_EQUIPMENT_LIST(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '生效中'; |
|||
item.enabled = true; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success("已生效"); |
|||
}); |
|||
}, |
|||
determine() { |
|||
let that = this; |
|||
let child = this.$refs.distribution.lists; |
|||
console.log(child); |
|||
let params = { |
|||
id: this.id, |
|||
items: child |
|||
}; |
|||
for (let index in child) { |
|||
if (!child[index].rate || !child[index].userId) { |
|||
Alert.fail("值不能为空"); |
|||
return false; |
|||
} |
|||
} |
|||
for (let i = 0; i < child.length; i++) { |
|||
for (let j = i + 1; j < child.length; j++) { |
|||
if (child[i].userId == child[j].userId) { |
|||
Alert.fail("分润对象不能一样"); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
POST_EQUIPMENT_LIST(params).then(res => { |
|||
Alert.success("添加成功"); |
|||
that.isEdit = false; |
|||
that.getList(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 30px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,118 +0,0 @@ |
|||
<template> |
|||
<el-row> |
|||
<el-col :span="24" style="margin-bottom: 10px;"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple">分润对象:</div> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="grid-content bg-purple-light">分润比例:</div> |
|||
</el-col> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="24" v-for="(item,index) in lists" style="margin-bottom: 10px;"> |
|||
<el-form :inline="true" class="demo-form-inline"> |
|||
<div class="grid-content bg-purple-dark"> |
|||
<el-row :gutter="15"> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple"> |
|||
<el-select v-model="item.userId" :value="item.userId" placeholder="选择分润对象"> |
|||
<el-option v-for="opi in accounts" :label="opi.name" :value="opi.id"></el-option> |
|||
</el-select> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="10"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-input placeholder="" @input="limitMax(item.rate,index)" v-model="item.rate" max="100" min="1"></el-input> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<div class="grid-content bg-purple-light"> |
|||
<el-button type="danger" @click="deleteObj(index)" icon="el-icon-delete"></el-button> |
|||
</div> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
</div> |
|||
</el-form> |
|||
</el-col> |
|||
<el-button @click="addObj">添加分润对象</el-button> |
|||
</el-row> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_ACCOUNT_LIST} from '@/api/privilegeManagement' |
|||
import {DETAIL_FIELD_LIST} from '@/api/distribution' |
|||
import Alert from "@/utils/alert"; |
|||
|
|||
export default { |
|||
name: "detailsOfDistribution", |
|||
props: ['currId'], |
|||
data() { |
|||
return { |
|||
lists: [], |
|||
accounts: [] |
|||
} |
|||
}, |
|||
watch: { |
|||
currId() { |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getAccounts(); |
|||
this.getDetail(); |
|||
}, |
|||
methods: { |
|||
getDetail() { |
|||
let params = { |
|||
id: this.currId |
|||
}; |
|||
DETAIL_FIELD_LIST(params).then(res => { |
|||
this.lists = res |
|||
}) |
|||
}, |
|||
/** |
|||
* 添加分润对象 |
|||
*/ |
|||
addObj() { |
|||
let obj = { |
|||
userId: '', |
|||
rate: '' |
|||
}; |
|||
this.lists.push(obj) |
|||
}, |
|||
|
|||
/** |
|||
* 删除分润对象 |
|||
*/ |
|||
deleteObj(idx) { |
|||
let lists = []; |
|||
this.lists.map((item, index) => { |
|||
if (idx != index) { |
|||
lists.push(item) |
|||
} |
|||
return item; |
|||
}); |
|||
this.lists = lists |
|||
}, |
|||
getAccounts() { |
|||
GET_ACCOUNT_LIST().then(res => { |
|||
this.accounts = res; |
|||
}) |
|||
}, |
|||
limitMax(val, idx) { |
|||
if (val >= 100 || val <= 0) { |
|||
Alert.fail('值不能大于100,小于0'); |
|||
val = '' |
|||
} |
|||
|
|||
this.lists[idx].rate = val; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
|
|||
</style> |
@ -1,60 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<el-form :inline="true" :model="formInline" class="demo-form-inline"> |
|||
<el-form-item label="场地"> |
|||
<el-select v-model="formInline.locationId" value="" placeholder="场地"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option v-for="item in locationId" :label="item.name" :value="item.id"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item style="padding-left:30px"> |
|||
<el-button type="default" @click="resetForm1('formInline')">重置</el-button> |
|||
<el-button type="primary" @click="onSubmit">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {GET_LOCATIONS} from '@/api/common' |
|||
|
|||
export default { |
|||
name: 'form-container', |
|||
props: ['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
locationId: '' |
|||
}, |
|||
locationId: '' |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getLocationId(); |
|||
}, |
|||
methods: { |
|||
getLocationId() { |
|||
GET_LOCATIONS().then(res => { |
|||
this.locationId = res |
|||
}) |
|||
}, |
|||
onSubmit() { |
|||
this.$emit('submit', this.formInline) |
|||
}, |
|||
resetForm1() { |
|||
this.formInline = { |
|||
name: '' |
|||
}; |
|||
this.$emit('resetForm'); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -1,269 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<form-container @submit="submitForm" @resetForm="resetForm"></form-container> |
|||
<div class="table"> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="name" |
|||
label="场地图片"> |
|||
<template slot-scope="lists"> |
|||
<img :src="lists.row.image" width="70" height="70" alt=""> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="name" |
|||
label="名称"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="locationName" |
|||
label="场地地址"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="users" |
|||
label="分润人数"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="stateText" |
|||
label="状态"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
> |
|||
<template slot-scope="lists"> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
class="option-span" |
|||
@click="suspensionOfRelease(lists.row.id,lists.row.enabled)" |
|||
> |
|||
<span>{{lists.row.enabled==true?"暂停":"发布"}}</span> |
|||
</span> |
|||
<span |
|||
type="text" |
|||
size="small" |
|||
style="margin: 0 5px;" |
|||
class="option-span" |
|||
@click="editModal(lists.row.id)" |
|||
> |
|||
<span>编辑</span> |
|||
</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<el-dialog |
|||
width="400px" |
|||
:show-close="false" |
|||
:visible.sync="isEdit"> |
|||
<details-of-distribution ref="distribution" :currId="id" v-if="isEdit"></details-of-distribution> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button @click="isEdit = false">取消</el-button> |
|||
<el-button type="primary" @click="determine('ruleForm')">确定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
const FormContainer = () => import('./form.vue'); |
|||
const DetailsOfDistribution = () => import('./detailsOfDistribution.vue'); |
|||
import { |
|||
GET_FIELD_LIST, |
|||
POST_FIELD_LIST, |
|||
ENABLE_FIELD_LIST, |
|||
DISABLE_FIELD_LIST, |
|||
COUNT_FIELD_LIST |
|||
} from '@/api/distribution' |
|||
import Alert from "@/utils/alert"; |
|||
import {pageSize} from '../../../config'; |
|||
|
|||
export default { |
|||
name: "index", |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
id: '', |
|||
isEdit: false, |
|||
lists: [], |
|||
params: { |
|||
from: 0, |
|||
size: pageSize, |
|||
locationId: '' |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.getList() |
|||
}, |
|||
components: { |
|||
FormContainer, |
|||
DetailsOfDistribution |
|||
}, |
|||
methods: { |
|||
submitForm(res) { |
|||
this.params = { |
|||
...this.params, |
|||
locationId: res.locationId, |
|||
}; |
|||
this.getList() |
|||
}, |
|||
resetForm() { |
|||
this.params = { |
|||
from: 0, |
|||
size: pageSize, |
|||
locationId: '' |
|||
}; |
|||
this.getList() |
|||
}, |
|||
getList() { |
|||
GET_FIELD_LIST(this.params).then(res => { |
|||
res.map((item) => { |
|||
item.stateText = item.enabled ? '生效中' : '失效中'; |
|||
item.locationName = item.province + item.city + item.district + item.name; |
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}); |
|||
|
|||
COUNT_FIELD_LIST(this.params).then(res => { |
|||
this.count = res |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 分页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
...this.params, |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getList() |
|||
}, |
|||
|
|||
editModal(id) { |
|||
this.isEdit = true; |
|||
this.id = id; |
|||
}, |
|||
|
|||
/** |
|||
* 状态操作 |
|||
*/ |
|||
suspensionOfRelease(id, enabled) { |
|||
if (enabled) { |
|||
this.PUBLISHED(id) |
|||
} else { |
|||
this.PAUSEDANDPENDING(id) |
|||
} |
|||
}, |
|||
/** |
|||
* 已发布 |
|||
* @constructor |
|||
*/ |
|||
PUBLISHED(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
DISABLE_FIELD_LIST(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '失效中'; |
|||
item.enabled = false; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success("已失效"); |
|||
}); |
|||
}, |
|||
/** |
|||
* 已暂停或者待发布 |
|||
* @constructor |
|||
*/ |
|||
PAUSEDANDPENDING(id) { |
|||
let params = { |
|||
id |
|||
}; |
|||
ENABLE_FIELD_LIST(params).then((res) => { |
|||
let lists = []; |
|||
this.lists.map((item) => { |
|||
if (item.id == id) { |
|||
item.stateText = '生效中'; |
|||
item.enabled = true; |
|||
} |
|||
lists.push(item); |
|||
return item; |
|||
}); |
|||
this.lists = lists; |
|||
Alert.success("已生效"); |
|||
}); |
|||
}, |
|||
determine() { |
|||
let that = this; |
|||
let child = this.$refs.distribution.lists; |
|||
let params = { |
|||
id: this.id, |
|||
items: child |
|||
}; |
|||
|
|||
for (let index in child) { |
|||
if (!child[index].rate || !child[index].userId) { |
|||
Alert.fail("值不能为空"); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
for (let i = 0; i < child.length; i++) { |
|||
for (let j = i + 1; j < child.length; j++) { |
|||
if (child[i].userId == child[j].userId) { |
|||
Alert.fail("分润对象不能一样"); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
} |
|||
POST_FIELD_LIST(params).then(res => { |
|||
Alert.success("添加成功"); |
|||
that.isEdit = false; |
|||
that.getList(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.table { |
|||
margin-top: 20px; |
|||
padding: 30px; |
|||
background: #fff; |
|||
|
|||
.option-span { |
|||
color: #a90500; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
.pagination { |
|||
margin-top: 20px; |
|||
} |
|||
</style> |
@ -1,81 +0,0 @@ |
|||
<template> |
|||
<div class="form-container"> |
|||
<div style="display:inline-block"> |
|||
<span class="demonstration">日期筛选 </span> |
|||
<el-date-picker |
|||
v-model="dateValue" |
|||
type="daterange" |
|||
align="right" |
|||
unlink-panels |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
:picker-options="pickerOptions2"> |
|||
</el-date-picker> |
|||
</div> |
|||
<el-button style="margin-left: 30px;" type="primary" @click="onSubmit">查询</el-button> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {dateTimeFormate} from '@/filters' |
|||
export default { |
|||
name: 'form-container', |
|||
props:['label'], |
|||
data() { |
|||
return { |
|||
formInline: { |
|||
name: '' |
|||
}, |
|||
pickerOptions2: { |
|||
shortcuts: [{ |
|||
text: '最近一周', |
|||
onClick(picker) { |
|||
const end = new Date(); |
|||
const start = new Date(); |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); |
|||
picker.$emit('pick', [start, end]); |
|||
} |
|||
}, { |
|||
text: '最近一个月', |
|||
onClick(picker) { |
|||
const end = new Date(); |
|||
const start = new Date(); |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); |
|||
picker.$emit('pick', [start, end]); |
|||
} |
|||
}, { |
|||
text: '最近三个月', |
|||
onClick(picker) { |
|||
const end = new Date(); |
|||
const start = new Date(); |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); |
|||
picker.$emit('pick', [start, end]); |
|||
} |
|||
}] |
|||
}, |
|||
dateValue: '' |
|||
} |
|||
}, |
|||
methods: { |
|||
onSubmit() { |
|||
let date = { |
|||
start:dateTimeFormate(this.dateValue[0]), |
|||
end:dateTimeFormate(this.dateValue[1]) |
|||
}; |
|||
this.$emit('onSubmit',date); |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.form-container { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
.demonstration{ |
|||
margin-right: 10px; |
|||
} |
|||
</style> |
@ -1,157 +0,0 @@ |
|||
<template> |
|||
<div class="finance"> |
|||
<form-con @onSubmit="onSubmit"></form-con> |
|||
<profile class="profile" :moneyNum="moneyNum"></profile> |
|||
<div class="tabs"> |
|||
<el-tabs v-model="activeName" @tab-click="handleClick"> |
|||
<el-tab-pane label="全部" name="all"></el-tab-pane> |
|||
<el-tab-pane label="收入" name="INCOME"></el-tab-pane> |
|||
<el-tab-pane label="提现" name="WITHDRAW"></el-tab-pane> |
|||
</el-tabs> |
|||
<el-table |
|||
:data="lists" |
|||
style="width: 100%"> |
|||
<el-table-column |
|||
prop="id" |
|||
label="账单流水号"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="amount" |
|||
label="金额(元)"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="type" |
|||
label="类型"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="state" |
|||
label="状态"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="createdDate" |
|||
label="交易时间"> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="params.size" |
|||
layout="prev, pager, next" |
|||
:total="count" |
|||
@current-change="currentChange" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import profile from './profile' |
|||
import {dateTimeFormateHHmm} from '@/filters' |
|||
import moment from 'moment' |
|||
import formCon from './form' |
|||
import {SUMMARY, TRANSACTIONS, TRANSACTIONS_COUNT} from '@/api/finance' |
|||
import {pageSize} from '../../config'; |
|||
|
|||
export default { |
|||
name: "index", |
|||
data() { |
|||
return { |
|||
count: 0, |
|||
moneyNum: { |
|||
balance: 0, |
|||
income: 0, |
|||
cashWithdrawal: 0 |
|||
}, |
|||
params: { |
|||
from: 0, |
|||
size: pageSize, |
|||
type: '', |
|||
start: '', |
|||
end: '' |
|||
}, |
|||
activeName: 'all', |
|||
lists: [] |
|||
} |
|||
}, |
|||
components: { |
|||
profile, |
|||
formCon |
|||
}, |
|||
mounted() { |
|||
this.getSUMMARY(); |
|||
this.getTRANSACTIONS(); |
|||
this.getTRANSACTIONS_COUNT(); |
|||
}, |
|||
methods: { |
|||
getSUMMARY() { |
|||
SUMMARY().then(res => { |
|||
this.moneyNum = { |
|||
balance: res.balance || 0, |
|||
income: res.totalIncome || 0, |
|||
cashWithdrawal: res.totalExpense || 0 |
|||
} |
|||
}) |
|||
}, |
|||
getTRANSACTIONS() { |
|||
TRANSACTIONS(this.params).then(res => { |
|||
res.map((item) => { |
|||
item.state = item.state == 'SUCCEEDED' ? '交易成功' : '交易失败'; |
|||
item.type = item.type == 'INCOME' ? '收入' : '提现'; |
|||
item.createdDate = moment(item.createdDate).format('YYYY-MM-DD HH:mm:ss'); |
|||
return item |
|||
}); |
|||
this.lists = res |
|||
}) |
|||
}, |
|||
getTRANSACTIONS_COUNT() { |
|||
TRANSACTIONS_COUNT(this.params).then(res => { |
|||
this.count = res |
|||
}) |
|||
}, |
|||
handleClick() { |
|||
let activeName = this.activeName == 'all' ? '' : this.activeName; |
|||
this.params = { |
|||
...this.params, |
|||
type: activeName, |
|||
}; |
|||
this.getTRANSACTIONS_COUNT(); |
|||
this.getTRANSACTIONS(); |
|||
}, |
|||
|
|||
/** |
|||
* 翻页 |
|||
*/ |
|||
currentChange(res) { |
|||
this.params = { |
|||
...this.params, |
|||
from: parseInt(res - 1) * this.params.size, |
|||
size: pageSize, |
|||
}; |
|||
this.getTRANSACTIONS(); |
|||
}, |
|||
onSubmit(val) { |
|||
this.params = { |
|||
...this.params, |
|||
start: val.start, |
|||
end: val.end, |
|||
}; |
|||
this.getTRANSACTIONS(); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
.finance { |
|||
.profile { |
|||
margin-top: 20px; |
|||
} |
|||
|
|||
.tabs { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
} |
|||
</style> |
@ -1,49 +0,0 @@ |
|||
<template> |
|||
<div class="profile"> |
|||
<div class="item"> |
|||
<div class="small">账户余额</div> |
|||
<div class="strong">{{moneyNum.balance}}元</div> |
|||
</div> |
|||
<div class="item"> |
|||
<div class="small">收入</div> |
|||
<div class="strong">{{moneyNum.income}}元</div> |
|||
</div> |
|||
<div class="item"> |
|||
<div class="small">支出</div> |
|||
<div class="strong">{{moneyNum.cashWithdrawal}}元</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: ["moneyNum"] |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.profile { |
|||
background: #fff; |
|||
display: flex; |
|||
justify-content: space-around; |
|||
border-bottom: 1px solid #ddd; |
|||
padding: 40px; |
|||
|
|||
.item { |
|||
width: 100%; |
|||
text-align: center; |
|||
border-right: 1px solid #ddd; |
|||
|
|||
.small { |
|||
} |
|||
|
|||
.strong { |
|||
margin-top: 10px; |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
&:last-child { |
|||
border-right: none; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -1,186 +0,0 @@ |
|||
|
|||
<template> |
|||
<div class="tableWrapper" v-loading="loading"> |
|||
<div class="formcontainer"> |
|||
<el-form :inline="true" :model="tableFormModal" class="demo-form-inline"> |
|||
<el-form-item label="类型"> |
|||
<el-select v-model="tableFormModal.types" placeholder="类型" :clearable="true"> |
|||
<el-option label="入货" value="STOCKIN"></el-option> |
|||
<el-option label="退货" value="RETURN"></el-option> |
|||
<el-option label="发货" value="TRANSFER"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="时间"> |
|||
<el-date-picker |
|||
v-model="tableFormModal.time" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
></el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="search1" type="primary">搜索</el-button> |
|||
<el-button @click="$router.go(-1)">返回</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
<div class="tableCongtainert"> |
|||
<el-table :data="lists" style="width: 100%"> |
|||
<el-table-column prop="id" label="编号"></el-table-column> |
|||
|
|||
<el-table-column prop="userName" label="操作人"></el-table-column> |
|||
<el-table-column prop="amount" label="件数"></el-table-column> |
|||
<el-table-column prop="beforeStock" label="起初库存"></el-table-column> |
|||
<el-table-column prop="afterStock" label="结束库存"></el-table-column> |
|||
<!-- <el-table-column prop="warehouseName" label="场地"></el-table-column> --> |
|||
<el-table-column prop="price" label="场地地址"> |
|||
<template slot-scope="scope"> |
|||
<span> |
|||
{{scope.row.province}} |
|||
{{scope.row.city}} |
|||
{{scope.row.district}} |
|||
{{scope.row.street}} |
|||
</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="type" label="操作类型"> |
|||
<template slot-scope="scope"> |
|||
<span v-if="scope.row.type=='STOCKIN'">入库</span> |
|||
<span v-if="scope.row.type=='RETURN'">退货</span> |
|||
<span v-if="scope.row.type=='TRANSFER'">发货</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="createdDate" label="操作时间"> |
|||
<template slot-scope="scope"> |
|||
<span>{{scope.row.createdDate|dateTimeFormate}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="pagination"> |
|||
<el-pagination |
|||
background |
|||
:page-size="form.size" |
|||
layout="prev, pager, next" |
|||
:total="parseInt(total)" |
|||
@current-change="pageChange" |
|||
></el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { get_list_audits, get_list_audits_total } from "@/api/inventory"; |
|||
import { formatTime } from "@/filters"; |
|||
|
|||
import myalert from "@/utils/alert"; |
|||
import auditsmix from "../mixins/audits"; |
|||
import commonmix from "../mixins/comm.js"; |
|||
import { dateFormate } from "../../../../utils/date"; |
|||
var tableFormModal = Object.defineProperties( |
|||
{ |
|||
productId: "", |
|||
locationId: "", |
|||
type: "", |
|||
time: "" |
|||
}, |
|||
{ |
|||
start: { |
|||
get() { |
|||
if (!this.time) return ""; |
|||
return dateFormate(this.time[0]); |
|||
} |
|||
}, |
|||
end: { |
|||
get() { |
|||
if (!this.time) return ""; |
|||
return dateFormate(this.time[2]); |
|||
} |
|||
} |
|||
} |
|||
); |
|||
|
|||
export default { |
|||
mixins: [auditsmix, commonmix], |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
tableFormModal |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.init(); |
|||
}, |
|||
computed: {}, |
|||
methods: { |
|||
async search1() { |
|||
await this.setStore({ |
|||
form: { |
|||
...this.form, |
|||
...this.tableFormModal, |
|||
start: this.tableFormModal.start + "", |
|||
end: this.tableFormModal.end + "" |
|||
} |
|||
}); |
|||
this.init(); |
|||
}, |
|||
init() { |
|||
var self = this; |
|||
self.setStore({ loading: true }); |
|||
get_list_audits_total({ |
|||
...this.form, |
|||
productId: this.$route.query.productId, |
|||
locationId: this.$route.query.locationId |
|||
}).then(total => { |
|||
self.setStore({ total }); |
|||
}); |
|||
get_list_audits({ |
|||
...this.form, |
|||
productId: this.$route.query.productId, |
|||
locationId: this.$route.query.locationId |
|||
}) |
|||
.then(lists => { |
|||
self.setStore({ lists, loading: false }); |
|||
}) |
|||
.catch(e => { |
|||
self.setStore({ loading: false }); |
|||
myalert.fail("查询失败"); |
|||
console.error(e); |
|||
}); |
|||
}, |
|||
async pageChange(page) { |
|||
var self = this; |
|||
this.form.from = (page - 1) * this.form.size; |
|||
await self.setStore({ form: this.form }); |
|||
this.init(); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.btns { |
|||
padding: 20px; |
|||
background: #fff; |
|||
} |
|||
.tableWrapper { |
|||
margin-top: 20px; |
|||
} |
|||
.pagination { |
|||
padding-top: 20px; |
|||
padding-bottom: 20px; |
|||
background: #fff; |
|||
} |
|||
.tableWrapper { |
|||
.formcontainer { |
|||
background: #fff; |
|||
padding: 20px; |
|||
} |
|||
.tableCongtainert { |
|||
background: #fff; |
|||
margin-top: 20px; |
|||
padding: 20px; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
|
@ -1,19 +0,0 @@ |
|||
export default { |
|||
id: "", |
|||
productId: "", |
|||
productName: "", |
|||
productImage: "", |
|||
type: "", |
|||
beforeStock: "", |
|||
afterStock: "", |
|||
warehouseId: "", |
|||
warehouseName: "", |
|||
province: "广东省", |
|||
city: "广州市", |
|||
district: "番禺区", |
|||
street: "", |
|||
latitude: "", |
|||
longitude: "", |
|||
createdDate: "", |
|||
amount: "" |
|||
} |
@ -1,269 +0,0 @@ |
|||
<template> |
|||
<div style="display:flex;" class="form" v-loading="loading"> |
|||
<el-form :model="dataForm1" class="demo-form-inline" label-width="120px" ref="form1"> |
|||
<div> |
|||
<el-form-item label="入库" prop="name"> |
|||
<el-switch |
|||
@change="changeform(1)" |
|||
v-model="dataForm1.checked" |
|||
active-color="#13ce66" |
|||
inactive-color="#ccc" |
|||
></el-switch> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="入库数量" prop="amount" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input |
|||
:disabled="dataForm1.disabled" |
|||
type="number" |
|||
v-model="dataForm1.amount" |
|||
placeholder="入库数量" |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="备注" prop="note" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input :disabled="dataForm1.disabled" v-model="dataForm1.note" placeholder="备注"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
|
|||
<el-form :model="dataForm2" class="demo-form-inline" label-width="120px" ref="form2"> |
|||
<div> |
|||
<el-form-item label="退货" prop="name"> |
|||
<el-switch |
|||
v-model="dataForm2.checked" |
|||
active-color="#13ce66" |
|||
@change="changeform(2)" |
|||
inactive-color="#ccc" |
|||
></el-switch> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="退货数量" prop="amount" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input |
|||
:disabled="dataForm2.disabled" |
|||
type="number" |
|||
v-model="dataForm2.amount" |
|||
placeholder="退货数量" |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="退货原因" prop="note" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input :disabled="dataForm2.disabled" v-model="dataForm2.note" placeholder="退货原因"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
|
|||
<el-form :model="dataForm3" class="demo-form-inline" label-width="120px" ref="form3"> |
|||
<div> |
|||
<el-form-item label="发货"> |
|||
<el-switch |
|||
v-model="dataForm3.checked" |
|||
@change="changeform(3)" |
|||
active-color="#13ce66" |
|||
inactive-color="#ccc" |
|||
></el-switch> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="发货数量" prop="amount" :rules="[ { required: true, message: '不能为空'}, ]"> |
|||
<el-input |
|||
:disabled="dataForm3.disabled" |
|||
type="number" |
|||
v-model="dataForm3.amount" |
|||
placeholder="入库数量" |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item |
|||
label="发货场地" |
|||
prop="toLocationId" |
|||
:rules="[ { required: true, message: '不能为空'}, ]" |
|||
> |
|||
<el-select |
|||
:disabled="dataForm3.disabled" |
|||
v-model="dataForm3.toLocationId" |
|||
placeholder="发货场地" |
|||
> |
|||
<el-option |
|||
v-for="item1 in localtions" |
|||
:key="item1.id" |
|||
:label="item1.name" |
|||
:value="item1.id" |
|||
></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="备注" prop="note"> |
|||
<el-input :disabled="dataForm3.disabled" v-model="dataForm3.note" placeholder="备注"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
</el-form> |
|||
<div style="display:flex;align-items:flex-end;padding-bottom:23px;padding-left:20px;"> |
|||
<div> |
|||
<el-button @click="sure" type="primary">确认</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { |
|||
post_stockin, |
|||
post_return, |
|||
post_transfer, |
|||
get_audits_detail |
|||
} from "@/api/inventory"; |
|||
import myalert from "../../../utils/alert"; |
|||
import detailModal from "./detail"; |
|||
import { get_list_in_locations } from "../../../api/inventory"; |
|||
import detailmixin from "./mixins/detail.js"; |
|||
export default { |
|||
mixins: [detailmixin], |
|||
props: { |
|||
// detail: { |
|||
// type: Object, |
|||
// default: detailModal |
|||
// }, |
|||
// locationId: { |
|||
// type: [String, Number] |
|||
// }, |
|||
// localtions: { |
|||
// //下拉 地址 select options |
|||
// type: Array |
|||
// } |
|||
}, |
|||
data() { |
|||
return { |
|||
type: 1, |
|||
loading: false, |
|||
dataForm1: { |
|||
locationId: this.locationId, |
|||
productId: this.detail.productId, |
|||
amount: 1, |
|||
note: "", |
|||
disabled: false, |
|||
checked: true |
|||
}, |
|||
dataForm2: { |
|||
locationId: this.locationId, |
|||
productId: this.detail.productId, |
|||
amount: 1, |
|||
note: "", |
|||
disabled: true, |
|||
checked: false |
|||
}, |
|||
dataForm3: { |
|||
fromLocationId: this.locationId, |
|||
productId: this.detail.productId, |
|||
amount: 1, |
|||
toLocationId: "", |
|||
note: "", |
|||
disabled: true, |
|||
checked: false |
|||
} |
|||
}; |
|||
}, |
|||
mounted() {}, |
|||
methods: { |
|||
sure() { |
|||
var self = this; |
|||
if (this.$data.type == 1) { |
|||
this.$refs["form1"].validate(valid => { |
|||
if (valid) { |
|||
self.$data.loading = true; |
|||
post_stockin({ |
|||
...this.$data.dataForm1, |
|||
locationId: this.locationId, |
|||
productId: this.detail.productId |
|||
}) |
|||
.then(res => { |
|||
self.$data.loading = false; |
|||
myalert.success("保存成功"); |
|||
}) |
|||
.catch(e => { |
|||
console.error(e); |
|||
self.$data.loading = false; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
if (this.$data.type == 2) { |
|||
this.$refs["form2"].validate(valid => { |
|||
if (valid) { |
|||
self.$data.loading = true; |
|||
post_return({ |
|||
...this.$data.dataForm2, |
|||
locationId: this.locationId, |
|||
productId: this.detail.productId |
|||
}) |
|||
.then(res => { |
|||
self.$data.loading = false; |
|||
myalert.success("保存成功"); |
|||
}) |
|||
.catch(e => { |
|||
console.error(e); |
|||
self.$data.loading = false; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
if (this.$data.type == 3) { |
|||
this.$refs["form3"].validate(valid => { |
|||
if (valid) { |
|||
self.$data.loading = true; |
|||
post_transfer({ |
|||
...this.$data.dataForm3, |
|||
fromLocationId: this.locationId, |
|||
productId: this.detail.productId |
|||
}) |
|||
.then(res => { |
|||
self.$data.loading = false; |
|||
myalert.success("保存成功"); |
|||
}) |
|||
.catch(e => { |
|||
console.error(e); |
|||
self.$data.loading = false; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
changeform(type) { |
|||
this.$data.type = type; |
|||
if (type == 1) { |
|||
this.$refs["form3"].resetFields(); |
|||
this.$refs["form2"].resetFields(); |
|||
this.$data.dataForm1.disabled = false; |
|||
this.$data.dataForm2.disabled = true; |
|||
this.$data.dataForm3.disabled = true; |
|||
|
|||
this.$data.dataForm1.checked = true; |
|||
this.$data.dataForm2.checked = false; |
|||
this.$data.dataForm3.checked = false; |
|||
} |
|||
if (type == 2) { |
|||
this.$refs["form1"].resetFields(); |
|||
this.$refs["form3"].resetFields(); |
|||
this.$data.dataForm1.disabled = true; |
|||
this.$data.dataForm2.disabled = false; |
|||
this.$data.dataForm3.disabled = true; |
|||
|
|||
this.$data.dataForm1.checked = false; |
|||
this.$data.dataForm2.checked = true; |
|||
this.$data.dataForm3.checked = false; |
|||
} |
|||
if (type == 3) { |
|||
this.$refs["form1"].resetFields(); |
|||
this.$refs["form2"].resetFields(); |
|||
this.$data.dataForm1.disabled = true; |
|||
this.$data.dataForm2.disabled = true; |
|||
this.$data.dataForm3.disabled = false; |
|||
|
|||
this.$data.dataForm1.checked = false; |
|||
this.$data.dataForm2.checked = false; |
|||
this.$data.dataForm3.checked = true; |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.form { |
|||
background: #fff; |
|||
} |
|||
</style> |
|||
|
|||
|
@ -1,87 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<Profile/> |
|||
<MyTable1></MyTable1> |
|||
<!-- <div class="tabContaner"> |
|||
<el-tabs v-model="activename" @tab-click="handleClick"> |
|||
<el-tab-pane |
|||
:label="item.locationName" |
|||
:name="item.locationName" |
|||
v-for="item in localtions" |
|||
:key="item.locationId" |
|||
> |
|||
<MyForm :detail="detail" :locationId="locationId" :localtions="localtionOptions"/> |
|||
</el-tab-pane> |
|||
</el-tabs> |
|||
</div>--> |
|||
|
|||
<!-- <div class="tableContainer"> |
|||
<MyTable :detail="detail" :locationId="locationId" :localtions="localtionOptions"/> |
|||
</div>--> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import MyForm from "./form"; |
|||
import MyTable1 from "./table1"; |
|||
import Profile from "./profile"; |
|||
import detailModal from "./detail"; |
|||
import { GET_LOCATIONS } from "@/api/common"; |
|||
import { get_audits_detail, get_list_in_locations } from "@/api/inventory"; |
|||
import { mapActions, mapState } from "vuex"; |
|||
import detailmixin from "./mixins/detail"; |
|||
export default { |
|||
mixins: [detailmixin], |
|||
components: { |
|||
MyForm, |
|||
MyTable1, |
|||
Profile |
|||
}, |
|||
data() { |
|||
return { |
|||
// dataForm: {}, |
|||
// localtions: [], |
|||
// locationId: "", |
|||
// activename: "", |
|||
// localtionOptions: [] |
|||
}; |
|||
}, |
|||
mounted() { |
|||
var self = this; |
|||
get_audits_detail(this.$route.query.id).then(res => { |
|||
self.$data.detail = res; |
|||
}); |
|||
var self = this; |
|||
get_list_in_locations({ id: this.$route.query.id }).then(localtions => { |
|||
if (localtions.length != 0) { |
|||
self.$data.localtions = localtions; |
|||
self.$nextTick(() => { |
|||
self.$data.locationId = localtions[0].locationId + ""; |
|||
self.$data.activename = localtions[0].locationName + ""; |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
GET_LOCATIONS().then(localtionOptions => { |
|||
self.$data.localtionOptions = localtionOptions; |
|||
}); |
|||
|
|||
this.setEditRow(this.list_editRow); |
|||
}, |
|||
methods: { |
|||
handleClick(item) { |
|||
this.$data.locationId = this.$data.localtions[item.index].locationId + ""; |
|||
this.$data.activename = |
|||
this.$data.localtions[item.index].locationName + ""; |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.tabContaner { |
|||
margin-top: 20px; |
|||
background: #fff; |
|||
padding: 20px; |
|||
} |
|||
</style> |
|||
|
|||
|
@ -1,53 +0,0 @@ |
|||
import { mapActions, mapState } from 'vuex' |
|||
export default { |
|||
computed: { |
|||
...mapState({ |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
roles: state => state.common.roles, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups, |
|||
locationTypes: state => state.common.locationTypes, |
|||
}), |
|||
...mapState("inventory/detail", { |
|||
editRow: state => state.editRow, |
|||
editRow2: state => state.editRow2, |
|||
}), |
|||
...mapState("inventory/audits", { |
|||
loading: state => state.loading, |
|||
lists: state => state.lists, |
|||
total: state => state.total, |
|||
form: state => state.form, |
|||
}), |
|||
}, |
|||
methods: { |
|||
...mapActions([ |
|||
"getDeviceGroups", |
|||
"getRoles", |
|||
"getLocations", |
|||
"getDeviceTypes", |
|||
"getLocationTypes" |
|||
]), |
|||
...mapActions("inventory/audits", |
|||
[ |
|||
"setStore" |
|||
]) |
|||
}, |
|||
mounted() { |
|||
if (!this.deviceTypes.length) { |
|||
this.getDeviceGroups() |
|||
} |
|||
if (!this.roles.length) { |
|||
this.getRoles() |
|||
} |
|||
if (!this.locations.length) { |
|||
this.getLocations() |
|||
} |
|||
if (!this.deviceGroups.length) { |
|||
this.getDeviceTypes() |
|||
} |
|||
if (!this.locationTypes.length) { |
|||
this.getLocationTypes() |
|||
} |
|||
|
|||
}, |
|||
} |
@ -1,41 +0,0 @@ |
|||
import { mapActions, mapState } from 'vuex' |
|||
export default { |
|||
computed: { |
|||
...mapState({ |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
roles: state => state.common.roles, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups, |
|||
locationTypes: state => state.common.locationTypes, |
|||
}), |
|||
|
|||
}, |
|||
methods: { |
|||
...mapActions([ |
|||
"getDeviceGroups", |
|||
"getRoles", |
|||
"getLocations", |
|||
"getDeviceTypes", |
|||
"getLocationTypes" |
|||
]), |
|||
|
|||
}, |
|||
mounted() { |
|||
if (!this.deviceTypes.length) { |
|||
this.getDeviceGroups() |
|||
} |
|||
if (!this.roles.length) { |
|||
this.getRoles() |
|||
} |
|||
if (!this.locations.length) { |
|||
this.getLocations() |
|||
} |
|||
if (!this.deviceGroups.length) { |
|||
this.getDeviceTypes() |
|||
} |
|||
if (!this.locationTypes.length) { |
|||
this.getLocationTypes() |
|||
} |
|||
|
|||
}, |
|||
} |
@ -1,61 +0,0 @@ |
|||
import { mapActions, mapState } from 'vuex' |
|||
export default { |
|||
computed: { |
|||
...mapState("inventory/list", { |
|||
list_editRow: state => state.editRow |
|||
}), |
|||
...mapState({ |
|||
deviceTypes: state => state.common.deviceTypes, |
|||
roles: state => state.common.roles, |
|||
locations: state => state.common.locations, |
|||
deviceGroups: state => state.common.deviceGroups, |
|||
locationTypes: state => state.common.locationTypes, |
|||
}), |
|||
...mapState("inventory/detail", { |
|||
editRow: state => state.editRow, |
|||
lists: state => state.lists, |
|||
loading: state => state.loading, |
|||
"form": state => state.form, |
|||
"total": state => state.total, |
|||
tablelist1: state => state.tablelist1, |
|||
stockshow: state => state.stockshow, |
|||
editRow2: state => state.editRow2, |
|||
transfershow: state => state.transfershow, |
|||
returnshow: state => state.returnshow, |
|||
}), |
|||
}, |
|||
methods: { |
|||
...mapActions([ |
|||
"getDeviceGroups", |
|||
"getRoles", |
|||
"getLocations", |
|||
"getDeviceTypes", |
|||
"getLocationTypes" |
|||
]), |
|||
...mapActions("inventory/detail", |
|||
[ |
|||
"setEditRow", |
|||
"search", |
|||
"getLists", |
|||
"setStore" |
|||
]) |
|||
}, |
|||
mounted() { |
|||
if (!this.deviceTypes.length) { |
|||
this.getDeviceGroups() |
|||
} |
|||
if (!this.roles.length) { |
|||
this.getRoles() |
|||
} |
|||
if (!this.locations.length) { |
|||
this.getLocations() |
|||
} |
|||
if (!this.deviceGroups.length) { |
|||
this.getDeviceTypes() |
|||
} |
|||
if (!this.locationTypes.length) { |
|||
this.getLocationTypes() |
|||
} |
|||
|
|||
}, |
|||
} |
@ -1,70 +0,0 @@ |
|||
<template> |
|||
<div class="profileContainer"> |
|||
<div class="left"> |
|||
<img :src="editRow.image" alt> |
|||
</div> |
|||
<div class="right"> |
|||
<h3>{{editRow.name}}</h3> |
|||
<div class="row"> |
|||
<!-- <div class="item"> |
|||
<strong>成本价:</strong> |
|||
<strong></strong> |
|||
</div> |
|||
<div class="item"> |
|||
<strong>零售价:</strong> |
|||
<strong></strong> |
|||
</div>--> |
|||
<div class="item"> |
|||
<strong>库存:</strong> |
|||
<strong>{{editRow.availableStock||0}}件</strong> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import detailmix from "./mixins/detail.js"; |
|||
export default { |
|||
mixins: [detailmix], |
|||
mounted() {} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.profileContainer { |
|||
padding: 30px; |
|||
background: #fff; |
|||
display: flex; |
|||
h3 { |
|||
padding-bottom: 10px; |
|||
small { |
|||
font-size: 16px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.left { |
|||
width: 100px; |
|||
height: 100px; |
|||
img { |
|||
width: 100px; |
|||
height: 100px; |
|||
} |
|||
} |
|||
.right { |
|||
padding-left: 10px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-around; |
|||
} |
|||
.row { |
|||
display: flex; |
|||
.item { |
|||
display: flex; |
|||
align-items: center; |
|||
strong { |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue