|
@@ -81,6 +81,21 @@
|
|
|
v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="运力包名称" align="center" v-if="user.type != 2">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.packageDeliveryName || '- -' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优惠包名称" align="center" v-if="user.type != 2">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.packageDiscountName || '- -' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="佣金包名称" align="center" v-if="user.type != 2">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.packageCommissionName || '- -' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
@@ -90,18 +105,29 @@
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['module:shop:edit']"
|
|
|
>修改</el-button>
|
|
|
- <!-- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['module:shop:remove']"
|
|
|
- >删除</el-button> -->
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
@click="gotoWaimaiInfo(scope.row.id)"
|
|
|
>详情</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="user.type != 2"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleDelivery(scope.row.id, 0)"
|
|
|
+ >绑定运力包</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="user.type != 2"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleDiscount(scope.row.id, 1)"
|
|
|
+ >绑定优惠包</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="user.type != 2"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleCommission(scope.row.id, 2)"
|
|
|
+ >绑定佣金包</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -159,33 +185,43 @@
|
|
|
<el-form-item label="联系电话" prop="mobile">
|
|
|
<el-input v-model="form.mobile" placeholder="请输入联系电话" />
|
|
|
</el-form-item>
|
|
|
- <!-- <el-form-item label="开始营业时间" prop="startTime">
|
|
|
- <el-time-picker
|
|
|
- v-model="form.startTime"
|
|
|
- value-format="HH:mm:ss" format="HH:mm:ss"
|
|
|
- placeholder="任意时间点">
|
|
|
- </el-time-picker>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="结束营业时间" prop="endTime">
|
|
|
- <el-time-picker
|
|
|
- v-model="form.endTime"
|
|
|
- value-format="HH:mm:ss" format="HH:mm:ss"
|
|
|
- placeholder="任意时间点">
|
|
|
- </el-time-picker>
|
|
|
- </el-form-item> -->
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="绑定包配置" :visible.sync="packageRequestOpen" width="700px" append-to-body>
|
|
|
+ <el-form ref="packageRequest" :model="packageRequest" :rules="packageRequestRules" label-width="130px">
|
|
|
+ <el-form-item label="选择包" prop="packageId">
|
|
|
+ <el-select v-model="packageRequest.packageId" placeholder="请选择运力包" v-if="packageRequest.packageType == 0" clearable>
|
|
|
+ <el-option v-for="item in this.packageDeliveryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-select v-model="packageRequest.packageId" placeholder="请选择优惠包" v-if="packageRequest.packageType == 1" clearable>
|
|
|
+ <el-option v-for="item in this.packageDiscountList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-select v-model="packageRequest.packageId" placeholder="请选择佣金包" v-if="packageRequest.packageType == 2" clearable>
|
|
|
+ <el-option v-for="item in this.packageCommissionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitFormPackage">确 定</el-button>
|
|
|
+ <el-button @click="cancelPackage">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { listShop, getShop, delShop, addShop, updateShop, exportShop } from "@/api/module/shop";
|
|
|
import { getMerchantCategoryList } from "@/api/module/merchant";
|
|
|
-import Area from '@/components/area'
|
|
|
+import area from '@/api/oldCity'
|
|
|
+import Area from '@/components/area/oldArea'
|
|
|
+import user from '@/store/modules/user'
|
|
|
|
|
|
export default {
|
|
|
name: "Shop",
|
|
@@ -194,6 +230,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ user: {},
|
|
|
typeOption:[{
|
|
|
value: 1,
|
|
|
label:'直营店'
|
|
@@ -263,6 +300,16 @@ export default {
|
|
|
endTime: undefined,
|
|
|
status: undefined
|
|
|
},
|
|
|
+ packageRequest: {
|
|
|
+ packageType: undefined,
|
|
|
+ packageId: undefined,
|
|
|
+ shopId: undefined
|
|
|
+ },
|
|
|
+ packageRequestRules: {},
|
|
|
+ packageRequestOpen: false,
|
|
|
+ packageDeliveryList: [],
|
|
|
+ packageCommissionList: [],
|
|
|
+ packageDiscountList: [],
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
@@ -304,12 +351,51 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ this.user = user.actions.getSysUser()
|
|
|
getMerchantCategoryList().then(response => {
|
|
|
this.merchantCategoryList = response.data
|
|
|
})
|
|
|
//this.getList();
|
|
|
+ this.$http.get("/module/packageDelivery/getDeliveryList").then(({ data }) => {
|
|
|
+ this.packageDeliveryList = data
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$http.get("/module/packageDiscount/getDiscountList").then(({ data }) => {
|
|
|
+ this.packageDiscountList = data
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$http.get("/module/packageCommission/getCommissionList").then(({ data }) => {
|
|
|
+ this.packageCommissionList = data
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleCommission(shopId, packageType) {
|
|
|
+ this.packageRequest.shopId = shopId;
|
|
|
+ this.packageRequest.packageType = packageType;
|
|
|
+ getShop(shopId).then(response => {
|
|
|
+ this.packageRequest.packageId = response.data.packageCommissionId
|
|
|
+ });
|
|
|
+ this.packageRequestOpen = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDiscount(shopId, packageType) {
|
|
|
+ this.packageRequest.shopId = shopId;
|
|
|
+ this.packageRequest.packageType = packageType;
|
|
|
+ getShop(shopId).then(response => {
|
|
|
+ this.packageRequest.packageId = response.data.packageDiscountId
|
|
|
+ });
|
|
|
+ this.packageRequestOpen = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDelivery(shopId, packageType) {
|
|
|
+ this.packageRequest.shopId = shopId;
|
|
|
+ this.packageRequest.packageType = packageType;
|
|
|
+ getShop(shopId).then(response => {
|
|
|
+ this.packageRequest.packageId = response.data.packageDeliveryId
|
|
|
+ });
|
|
|
+ this.packageRequestOpen = true;
|
|
|
+ },
|
|
|
+
|
|
|
init(id) {
|
|
|
this.queryParams.merchantId = id;
|
|
|
this.getList()
|
|
@@ -352,6 +438,14 @@ export default {
|
|
|
this.open = false;
|
|
|
this.reset();
|
|
|
},
|
|
|
+ cancelPackage() {
|
|
|
+ this.packageRequestOpen = false;
|
|
|
+ this.packageRequest = {
|
|
|
+ packageType: undefined,
|
|
|
+ packageId: undefined,
|
|
|
+ shopId: undefined
|
|
|
+ };
|
|
|
+ },
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
@@ -379,6 +473,9 @@ export default {
|
|
|
endTime: undefined,
|
|
|
status: 0,
|
|
|
photoList: [],
|
|
|
+ packageDeliveryId: undefined,
|
|
|
+ packageDiscountId: undefined,
|
|
|
+ packageCommissionid: undefined
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -413,7 +510,35 @@ export default {
|
|
|
this.startArea.district = response.data.districtId
|
|
|
this.startArea.city = response.data.cityId
|
|
|
this.areaProp = JSON.parse(JSON.stringify(this.startArea))
|
|
|
+
|
|
|
+ this.startArea.provinceName = response.data.provinceName
|
|
|
+ this.startArea.districtName = response.data.districtName
|
|
|
+ this.startArea.cityName = response.data.cityName
|
|
|
+ if(response.data.provinceName == undefined && response.data.districtName == undefined && response.data.cityName == undefined) {
|
|
|
+ this.startArea.provinceName = response.data.provinceName
|
|
|
+ this.startArea.districtName = response.data.districtName
|
|
|
+ this.startArea.cityName = response.data.cityName
|
|
|
+ }else {
|
|
|
+ const func = array => {
|
|
|
+ // 如果传入的不是数组 则返回
|
|
|
+ if (!Array.isArray(array)) return
|
|
|
+ // 使用reduce遍历数组,给定义一个初始值空数组,如果遍历的当前子元素是数组,那么拼接它继续递归后的结果,如果不是数组那么就是值,直接concat添加到数组尾部
|
|
|
+ return array.reduce(
|
|
|
+ (prev, curr) =>
|
|
|
+ Array.isArray(curr.childs) ? prev.concat(curr).concat(func(curr.childs)) : prev.concat(curr),
|
|
|
+ []
|
|
|
+ )
|
|
|
+ }
|
|
|
+ this.startArea.province = (func(area).find(item => {return item.name === this.startArea.provinceName && item.level === 1}) || {}).id
|
|
|
+ this.startArea.city = (func(area).find(item => {return item.name === this.startArea.cityName && item.level === 2}) || {}).id
|
|
|
+ var cityId = this.startArea.city.substr(0,4)
|
|
|
+ this.startArea.district = (func(area).find(item => {return item.name === this.startArea.districtName && item.id.includes(cityId) && item.level === 3}) || {}).id
|
|
|
+ }
|
|
|
+ this.areaProp = JSON.parse(JSON.stringify(this.startArea))
|
|
|
this.form = response.data;
|
|
|
+ this.form.provinceId = this.startArea.province
|
|
|
+ this.form.cityId = this.startArea.city
|
|
|
+ this.form.districtId = this.startArea.district
|
|
|
if (response.data.photoAlbum){
|
|
|
this.form.photoList = response.data.photoAlbum.split(",")
|
|
|
}
|
|
@@ -426,7 +551,7 @@ export default {
|
|
|
// if (this.form.startTime != '' && this.form.endTime != ''){
|
|
|
// this.form.openingHours = this.form.startTime + ' ~ ' + this.form.endTime
|
|
|
// }
|
|
|
- if (this.form.photoList.length > 0){
|
|
|
+ if (this.form.photoList != undefined && this.form.photoList.length > 0){
|
|
|
for (var i=0; i<this.form.photoList.length; i++){
|
|
|
if (i==0){
|
|
|
this.form.photoAlbum = this.form.photoList[i]
|
|
@@ -445,9 +570,6 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- this.form.provinceId = this.startArea.province
|
|
|
- this.form.cityId = this.startArea.city
|
|
|
- this.form.districtId = this.startArea.district
|
|
|
if (this.form.id != null) {
|
|
|
updateShop(this.form).then(response => {
|
|
|
this.msgSuccess("修改成功");
|
|
@@ -464,6 +586,38 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ submitFormPackage() {
|
|
|
+ this.$refs["packageRequest"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.packageRequest.packageType == 0) {
|
|
|
+ this.$http.post('/module/shop/bindDeliveryPackage', this.packageRequest).then(( { data }) => {
|
|
|
+ if(data) {
|
|
|
+ this.$message.success('绑定成功!')
|
|
|
+ this.packageRequestOpen = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.packageRequest.packageType == 1) {
|
|
|
+ this.$http.post('/module/shop/bindDiscountPackage', this.packageRequest).then(( { data }) => {
|
|
|
+ if(data) {
|
|
|
+ this.$message.success('绑定成功!')
|
|
|
+ this.packageRequestOpen = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.packageRequest.packageType == 2) {
|
|
|
+ this.$http.post('/module/shop/bindCommissionPackage', this.packageRequest).then(( { data }) => {
|
|
|
+ if(data) {
|
|
|
+ this.$message.success('绑定成功!')
|
|
|
+ this.packageRequestOpen = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|