Commit 1cb9d20e authored by Menethil's avatar Menethil
Browse files

Merge remote-tracking branch 'origin/master'

parents c4f48302 96208795
...@@ -78,53 +78,4 @@ public class AdminAddressController { ...@@ -78,53 +78,4 @@ public class AdminAddressController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
@PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallAddress address){
if(adminId == null){
return ResponseUtil.unlogin();
}
String mobile = address.getMobile();
if(!RegexUtil.isMobileExact(mobile)){
return ResponseUtil.fail(403, "手机号格式不正确");
}
address.setAddTime(LocalDateTime.now());
addressService.add(address);
Map<String, Object> addressVo = toVo(address);
return ResponseUtil.ok(addressVo);
}
@GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id){
if(adminId == null){
return ResponseUtil.unlogin();
}
LitemallAddress address = addressService.findById(id);
Map<String, Object> addressVo = toVo(address);
return ResponseUtil.ok(addressVo);
}
@PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallAddress address){
if(adminId == null){
return ResponseUtil.unlogin();
}
addressService.updateById(address);
Map<String, Object> addressVo = toVo(address);
return ResponseUtil.ok(addressVo);
}
@PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallAddress address){
if(adminId == null){
return ResponseUtil.unlogin();
}
addressService.delete(address.getId());
return ResponseUtil.ok();
}
} }
...@@ -45,45 +45,4 @@ public class AdminCollectController { ...@@ -45,45 +45,4 @@ public class AdminCollectController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
@PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallCollect collect){
if(adminId == null){
return ResponseUtil.unlogin();
}
return ResponseUtil.unsupport();
}
@GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id){
if(adminId == null){
return ResponseUtil.unlogin();
}
if(id == null){
return ResponseUtil.badArgument();
}
LitemallCollect collect = collectService.findById(id);
return ResponseUtil.ok(collect);
}
@PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallCollect collect){
if(adminId == null){
return ResponseUtil.unlogin();
}
collectService.updateById(collect);
return ResponseUtil.ok();
}
@PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallCollect collect){
if(adminId == null){
return ResponseUtil.unlogin();
}
collectService.deleteById(collect.getId());
return ResponseUtil.ok();
}
} }
...@@ -50,53 +50,4 @@ public class AdminFeedbackController { ...@@ -50,53 +50,4 @@ public class AdminFeedbackController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
@PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallFeedback feedback) {
if(adminId == null){
return ResponseUtil.unlogin();
}
String mobile = feedback.getMobile();
if(!RegexUtil.isMobileExact(mobile)){
return ResponseUtil.fail(403, "手机号格式不正确");
}
feedback.setAddTime(LocalDateTime.now());
feedbackService.add(feedback);
return ResponseUtil.ok(feedback);
}
@GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id){
if(adminId == null){
return ResponseUtil.unlogin();
}
if(id == null){
return ResponseUtil.badArgument();
}
LitemallFeedback feedback = feedbackService.findById(id);
return ResponseUtil.ok(feedback);
}
@PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallFeedback feedback) {
if(adminId == null){
return ResponseUtil.unlogin();
}
feedbackService.updateById(feedback);
return ResponseUtil.ok(feedback);
}
@PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallFeedback feedback){
if(adminId == null){
return ResponseUtil.unlogin();
}
feedbackService.delete(feedback.getId());
return ResponseUtil.ok();
}
} }
...@@ -45,41 +45,4 @@ public class AdminFootprintController { ...@@ -45,41 +45,4 @@ public class AdminFootprintController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
@PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallFootprint footprint){
if(adminId == null){
return ResponseUtil.unlogin();
}
return ResponseUtil.unsupport();
}
@GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id){
if(adminId == null){
return ResponseUtil.unlogin();
}
LitemallFootprint footprint = footprintService.findById(id);
return ResponseUtil.ok(footprint);
}
@PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallFootprint footprint){
if(adminId == null){
return ResponseUtil.unlogin();
}
footprintService.updateById(footprint);
return ResponseUtil.ok();
}
@PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallFootprint footprint){
if(adminId == null){
return ResponseUtil.unlogin();
}
footprintService.deleteById(footprint.getId());
return ResponseUtil.ok();
}
} }
...@@ -42,45 +42,4 @@ public class AdminHistoryController { ...@@ -42,45 +42,4 @@ public class AdminHistoryController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
@PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallSearchHistory history){
if(adminId == null){
return ResponseUtil.unlogin();
}
return ResponseUtil.unsupport();
}
@GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, Integer id){
if(adminId == null){
return ResponseUtil.unlogin();
}
if(id == null){
return ResponseUtil.badArgument();
}
LitemallSearchHistory history = searchHistoryService.findById(id);
return ResponseUtil.ok(history);
}
@PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallSearchHistory history){
if(adminId == null){
return ResponseUtil.unlogin();
}
searchHistoryService.updateById(history);
return ResponseUtil.ok();
}
@PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallSearchHistory history){
if(adminId == null){
return ResponseUtil.unlogin();
}
searchHistoryService.deleteById(history.getId());
return ResponseUtil.ok();
}
} }
...@@ -134,7 +134,7 @@ public class AdminOrderController { ...@@ -134,7 +134,7 @@ public class AdminOrderController {
try { try {
// 设置订单取消状态 // 设置订单取消状态
order.setOrderStatus(OrderUtil.STATUS_REFUND_CONFIRM); order.setOrderStatus(OrderUtil.STATUS_REFUND_CONFIRM);
orderService.update(order); orderService.updateById(order);
// 商品货品数量增加 // 商品货品数量增加
List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(orderId); List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(orderId);
...@@ -204,7 +204,7 @@ public class AdminOrderController { ...@@ -204,7 +204,7 @@ public class AdminOrderController {
order.setShipSn(shipSn); order.setShipSn(shipSn);
order.setShipChannel(shipChannel); order.setShipChannel(shipChannel);
order.setShipTime(LocalDateTime.now()); order.setShipTime(LocalDateTime.now());
orderService.update(order); orderService.updateById(order);
//TODO 发送邮件和短信通知,这里采用异步发送 //TODO 发送邮件和短信通知,这里采用异步发送
// 发货会发送通知短信给用户 // 发货会发送通知短信给用户
......
import request from '@/utils/request'
export function listAddress(query) {
return request({
url: '/address/list',
method: 'get',
params: query
})
}
export function createAddress(data) {
return request({
url: '/address/create',
method: 'post',
data
})
}
export function readAddress(data) {
return request({
url: '/address/read',
method: 'get',
data
})
}
export function updateAddress(data) {
return request({
url: '/address/update',
method: 'post',
data
})
}
export function deleteAddress(data) {
return request({
url: '/address/delete',
method: 'post',
data
})
}
import request from '@/utils/request'
export function listCollect(query) {
return request({
url: '/collect/list',
method: 'get',
params: query
})
}
export function createCollect(data) {
return request({
url: '/collect/create',
method: 'post',
data
})
}
export function readCollect(data) {
return request({
url: '/collect/read',
method: 'get',
data
})
}
export function updateCollect(data) {
return request({
url: '/collect/update',
method: 'post',
data
})
}
export function deleteCollect(data) {
return request({
url: '/collect/delete',
method: 'post',
data
})
}
import request from '@/utils/request'
export function listFeedback(query) {
return request({
url: '/feedback/list',
method: 'get',
params: query
})
}
export function createFeedback(data) {
return request({
url: '/feedback/create',
method: 'post',
data
})
}
export function readFeedback(data) {
return request({
url: '/feedback/read',
method: 'get',
data
})
}
export function updateFeedback(data) {
return request({
url: '/feedback/update',
method: 'post',
data
})
}
export function deleteFeedback(data) {
return request({
url: '/feedback/delete',
method: 'post',
data
})
}
import request from '@/utils/request'
export function listFootprint(query) {
return request({
url: '/footprint/list',
method: 'get',
params: query
})
}
export function createFootprint(data) {
return request({
url: '/footprint/create',
method: 'post',
data
})
}
export function readFootprint(data) {
return request({
url: '/footprint/read',
method: 'get',
data
})
}
export function updateFootprint(data) {
return request({
url: '/footprint/update',
method: 'post',
data
})
}
export function deleteFootprint(data) {
return request({
url: '/footprint/delete',
method: 'post',
data
})
}
import request from '@/utils/request'
export function listHistory(query) {
return request({
url: '/history/list',
method: 'get',
params: query
})
}
export function createHistory(data) {
return request({
url: '/history/create',
method: 'post',
data
})
}
export function readHistory(data) {
return request({
url: '/history/read',
method: 'get',
data
})
}
export function updateHistory(data) {
return request({
url: '/history/update',
method: 'post',
data
})
}
export function deleteHistory(data) {
return request({
url: '/history/delete',
method: 'post',
data
})
}
...@@ -31,3 +31,44 @@ export function updateUser(data) { ...@@ -31,3 +31,44 @@ export function updateUser(data) {
data data
}) })
} }
export function listAddress(query) {
return request({
url: '/address/list',
method: 'get',
params: query
})
}
export function listCollect(query) {
return request({
url: '/collect/list',
method: 'get',
params: query
})
}
export function listFeedback(query) {
return request({
url: '/feedback/list',
method: 'get',
params: query
})
}
export function listFootprint(query) {
return request({
url: '/footprint/list',
method: 'get',
params: query
})
}
export function listHistory(query) {
return request({
url: '/history/list',
method: 'get',
params: query
})
}
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入收货人名称" v-model="listQuery.name"> <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入收货人名称" v-model="listQuery.name">
</el-input> </el-input>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button> <el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div> </div>
...@@ -38,12 +37,6 @@ ...@@ -38,12 +37,6 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
...@@ -53,57 +46,11 @@ ...@@ -53,57 +46,11 @@
</el-pagination> </el-pagination>
</div> </div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId"></el-input>
</el-form-item>
<el-form-item label="收货人名称" prop="name">
<el-input v-model="dataForm.name"></el-input>
</el-form-item>
<el-form-item label="收获人手机" prop="mobile">
<el-input v-model="dataForm.mobile"></el-input>
</el-form-item>
<el-form-item label="区域地址">
<el-select v-model="dataForm.provinceId" placeholder="省" @change="provinceChange">
<el-option v-for="item in provinces" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select v-model="dataForm.cityId" placeholder="市" @change="cityChange">
<el-option v-for="item in cities" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select v-model="dataForm.areaId" placeholder="区" @change="areaChange">
<el-option v-for="item in areas" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="详细地址" prop="address">
<el-input v-model="dataForm.address"></el-input>
</el-form-item>
<el-form-item label="是否默认地址" prop="isDefault">
<el-select v-model="dataForm.isDefault" placeholder="请选择">
<el-option label="否" :value="false">
</el-option>
<el-option label="是" :value="true">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listAddress, createAddress, updateAddress, deleteAddress } from '@/api/address' import { listAddress } from '@/api/user'
import { listSubRegion } from '@/api/region'
export default { export default {
name: 'UserAddress', name: 'UserAddress',
...@@ -120,41 +67,11 @@ export default { ...@@ -120,41 +67,11 @@ export default {
sort: 'add_time', sort: 'add_time',
order: 'desc' order: 'desc'
}, },
provinces: {},
cities: {},
areas: {},
dataForm: {
id: undefined,
userId: undefined,
name: undefined,
mobile: undefined,
address: undefined,
isDefault: undefined,
provinceId: undefined,
cityId: undefined,
areaId: undefined
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
name: [{ required: true, message: '收货人名称不能为空', trigger: 'blur' }],
mobile: [{ required: true, message: '收货人手机号码不能为空', trigger: 'blur' }],
provinceId: [{ required: true, message: '收货人所在省不能为空', trigger: 'blur' }],
cityId: [{ required: true, message: '收货人所在市不能为空', trigger: 'blur' }],
areaId: [{ required: true, message: '收货人所在区不能为空', trigger: 'blur' }],
address: [{ required: true, message: '收货人地址不能为空', trigger: 'blur' }]
},
downloadLoading: false downloadLoading: false
} }
}, },
created() { created() {
this.getList() this.getList()
this.getProvinces()
}, },
methods: { methods: {
getList() { getList() {
...@@ -168,36 +85,6 @@ export default { ...@@ -168,36 +85,6 @@ export default {
this.total = 0 this.total = 0
this.listLoading = false this.listLoading = false
}) })
},
getProvinces() {
listSubRegion({ id: 0 }).then(response => {
this.provinces = response.data.data
})
},
provinceChange(val) {
if (val === undefined) {
return
}
this.cities = {}
this.dataForm.cityId = undefined
this.areas = {}
this.dataForm.areaId = undefined
listSubRegion({ id: val }).then(response => {
this.cities = response.data.data
})
},
cityChange(val) {
if (val === undefined) {
return
}
this.areas = {}
this.dataForm.areaId = undefined
listSubRegion({ id: val }).then(response => {
this.areas = response.data.data
})
},
areaChange(val) {
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1 this.listQuery.page = 1
...@@ -211,96 +98,6 @@ export default { ...@@ -211,96 +98,6 @@ export default {
this.listQuery.page = val this.listQuery.page = val
this.getList() this.getList()
}, },
resetForm() {
this.dataForm = {
id: undefined,
userId: undefined,
name: undefined,
mobile: undefined,
address: undefined,
isDefault: undefined,
provinceId: undefined,
cityId: undefined,
areaId: undefined
}
},
handleCreate() {
this.resetForm()
this.cities = {}
this.areas = {}
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createAddress(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.cities = {}
this.areas = {}
listSubRegion({ id: this.dataForm.provinceId }).then(response => {
this.cities = response.data.data
})
listSubRegion({ id: this.dataForm.cityId }).then(response => {
this.areas = response.data.data
})
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateAddress(this.dataForm).then(response => {
const updatedAddress = response.data.data
for (const v of this.list) {
if (v.id === updatedAddress.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, updatedAddress)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteAddress(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.valueId"> <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.valueId">
</el-input> </el-input>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button> <el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div> </div>
...@@ -26,12 +25,6 @@ ...@@ -26,12 +25,6 @@
<el-table-column align="center" min-width="100px" label="添加时间" prop="addTime"> <el-table-column align="center" min-width="100px" label="添加时间" prop="addTime">
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
...@@ -41,32 +34,11 @@ ...@@ -41,32 +34,11 @@
</el-pagination> </el-pagination>
</div> </div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId"></el-input>
</el-form-item>
<el-form-item label="商品ID" prop="valueId">
<el-input v-model="dataForm.valueId"></el-input>
</el-form-item>
<el-form-item label="添加时间" prop="addTime">
<el-date-picker v-model="dataForm.addTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listCollect, createCollect, updateCollect, deleteCollect } from '@/api/collect' import { listCollect } from '@/api/user'
export default { export default {
name: 'Collect', name: 'Collect',
...@@ -83,22 +55,6 @@ export default { ...@@ -83,22 +55,6 @@ export default {
sort: 'add_time', sort: 'add_time',
order: 'desc' order: 'desc'
}, },
dataForm: {
id: undefined,
userId: '',
valueId: '',
addTime: undefined
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
valueId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }]
},
downloadLoading: false downloadLoading: false
} }
}, },
...@@ -138,72 +94,6 @@ export default { ...@@ -138,72 +94,6 @@ export default {
addTime: undefined addTime: undefined
} }
}, },
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createCollect(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateCollect(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteCollect(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入反馈ID" v-model="listQuery.id"> <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入反馈ID" v-model="listQuery.id">
</el-input> </el-input>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button> <el-button class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
</div> </div>
...@@ -39,12 +38,6 @@ ...@@ -39,12 +38,6 @@
<el-table-column align="center" label="时间" prop="addTime"> <el-table-column align="center" label="时间" prop="addTime">
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
...@@ -54,78 +47,14 @@ ...@@ -54,78 +47,14 @@
</el-pagination> </el-pagination>
</div> </div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="反馈ID" prop="id">
<el-input v-model="dataForm.id"></el-input>
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="dataForm.username"></el-input>
</el-form-item>
<el-form-item label="手机号码" prop="mobile">
<el-input v-model="dataForm.mobile" type="textarea" :rows="1"></el-input>
</el-form-item>
<el-form-item label="反馈类型" prop="feedType">
<el-input v-model="dataForm.feedType" type="textarea" :rows="4"></el-input>
</el-form-item>
<el-form-item label="反馈内容" prop="content">
<el-input v-model="dataForm.content" type="textarea" :rows="4"></el-input>
</el-form-item>
<el-form-item label="反馈时间" prop="addTime">
<el-date-picker v-model="dataForm.addTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="反馈图片" prop="picUrls">
<!-- <el-input v-model="dataForm.picUrls"></el-input> -->
<el-upload action="#" list-type="picture" :headers="headers" :show-file-list="false" :limit="5" :http-request="uploadPicUrls">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<style>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 200px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
</style>
<script> <script>
import { listFeedback, createFeedback, updateFeedback, deleteFeedback } from '@/api/Feedback' import { listFeedback } from '@/api/user'
import { createStorage } from '@/api/storage'
import { getToken } from '@/utils/auth'
export default { export default {
name: 'Feedback', name: 'Feedback',
computed: {
headers() {
return {
'Admin-Token': getToken()
}
}
},
data() { data() {
return { return {
list: undefined, list: undefined,
...@@ -138,26 +67,6 @@ export default { ...@@ -138,26 +67,6 @@ export default {
sort: 'add_time', sort: 'add_time',
order: 'desc' order: 'desc'
}, },
dataForm: {
id: undefined,
username: undefined,
mobile: undefined,
feedType: undefined,
content: undefined,
hasPicture: false,
picUrls: []
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
// valueId: [{ required: true, message: '反馈ID不能为空', trigger: 'blur' }],
content: [{ required: true, message: '反馈内容不能为空', trigger: 'blur' }]
},
downloadLoading: false downloadLoading: false
} }
}, },
...@@ -189,92 +98,6 @@ export default { ...@@ -189,92 +98,6 @@ export default {
this.listQuery.page = val this.listQuery.page = val
this.getList() this.getList()
}, },
resetForm() {
this.dataForm = {
id: undefined,
username: undefined,
mobile: undefined,
feedType: undefined,
content: undefined,
picUrls: []
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
uploadPicUrls(item) {
const formData = new FormData()
formData.append('file', item.file)
createStorage(formData).then(res => {
this.dataForm.picUrls.push(res.data.data.url)
this.dataForm.hasPicture = true
}).catch(() => {
this.$message.error('上传失败,请重新上传')
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createFeedback(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateFeedback(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteFeedback(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.goodsId"> <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入商品ID" v-model="listQuery.goodsId">
</el-input> </el-input>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button> <el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div> </div>
...@@ -26,12 +25,6 @@ ...@@ -26,12 +25,6 @@
<el-table-column align="center" min-width="100px" label="添加时间" prop="addTime"> <el-table-column align="center" min-width="100px" label="添加时间" prop="addTime">
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
...@@ -41,32 +34,11 @@ ...@@ -41,32 +34,11 @@
</el-pagination> </el-pagination>
</div> </div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId"></el-input>
</el-form-item>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId"></el-input>
</el-form-item>
<el-form-item label="添加时间" prop="addTime">
<el-date-picker v-model="dataForm.addTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listFootprint, createFootprint, updateFootprint, deleteFootprint } from '@/api/footprint' import { listFootprint } from '@/api/user'
export default { export default {
name: 'FootPrint', name: 'FootPrint',
...@@ -83,22 +55,6 @@ export default { ...@@ -83,22 +55,6 @@ export default {
sort: 'add_time', sort: 'add_time',
order: 'desc' order: 'desc'
}, },
dataForm: {
id: undefined,
userId: '',
goodsId: '',
addTime: undefined
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
goodsId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }]
},
downloadLoading: false downloadLoading: false
} }
}, },
...@@ -130,80 +86,6 @@ export default { ...@@ -130,80 +86,6 @@ export default {
this.listQuery.page = val this.listQuery.page = val
this.getList() this.getList()
}, },
resetForm() {
this.dataForm = {
id: undefined,
userId: '',
goodsId: '',
addTime: undefined
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createFootprint(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
updateFootprint(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteFootprint(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入搜索历史关键字" v-model="listQuery.keyword"> <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入搜索历史关键字" v-model="listQuery.keyword">
</el-input> </el-input>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button> <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
<el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button> <el-button class="filter-item" type="primary" :loading="downloadLoading" icon="el-icon-download" @click="handleDownload">导出</el-button>
</div> </div>
...@@ -40,32 +39,11 @@ ...@@ -40,32 +39,11 @@
</el-pagination> </el-pagination>
</div> </div>
<!-- 添加或修改对话框 -->
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId"></el-input>
</el-form-item>
<el-form-item label="关键字" prop="keyword">
<el-input v-model="dataForm.keyword"></el-input>
</el-form-item>
<el-form-item label="添加时间" prop="addTime">
<el-date-picker v-model="dataForm.addTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
<el-button v-else type="primary" @click="updateData">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listHistory, createHistory, updateHistory, deleteHistory } from '@/api/history' import { listHistory } from '@/api/user'
export default { export default {
name: 'History', name: 'History',
...@@ -82,26 +60,6 @@ export default { ...@@ -82,26 +60,6 @@ export default {
sort: 'add_time', sort: 'add_time',
order: 'desc' order: 'desc'
}, },
dataForm: {
id: undefined,
userId: '',
keyword: '',
addTime: undefined
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '创建'
},
rules: {
userId: [
{ required: true, message: '用户ID不能为空', trigger: 'blur' }
],
keyword: [
{ required: true, message: '搜索关键字不能为空', trigger: 'blur' }
]
},
downloadLoading: false downloadLoading: false
} }
}, },
...@@ -133,80 +91,6 @@ export default { ...@@ -133,80 +91,6 @@ export default {
this.listQuery.page = val this.listQuery.page = val
this.getList() this.getList()
}, },
resetForm() {
this.dataForm = {
id: undefined,
userId: '',
goodsId: '',
addTime: undefined
}
},
handleCreate() {
this.resetForm()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
createHistory(this.dataForm).then(response => {
this.list.unshift(response.data.data)
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleUpdate(row) {
this.dataForm = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
updateHistory(this.dataForm).then(() => {
for (const v of this.list) {
if (v.id === this.dataForm.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.dataForm)
break
}
}
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
})
},
handleDelete(row) {
deleteHistory(row).then(response => {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
})
},
handleDownload() { handleDownload() {
this.downloadLoading = true this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
......
...@@ -56,8 +56,8 @@ public class LitemallAdService { ...@@ -56,8 +56,8 @@ public class LitemallAdService {
return (int) adMapper.countByExample(example); return (int) adMapper.countByExample(example);
} }
public void updateById(LitemallAd ad) { public int updateById(LitemallAd ad) {
adMapper.updateByPrimaryKeySelective(ad); return adMapper.updateWithVersionByPrimaryKeySelective(ad.getVersion(), ad);
} }
public void deleteById(Integer id) { public void deleteById(Integer id) {
......
...@@ -30,7 +30,7 @@ public class LitemallAddressService { ...@@ -30,7 +30,7 @@ public class LitemallAddressService {
} }
public int update(LitemallAddress address) { public int update(LitemallAddress address) {
return addressMapper.updateByPrimaryKeySelective(address); return addressMapper.updateWithVersionByPrimaryKeySelective(address.getVersion(), address);
} }
public void delete(Integer id) { public void delete(Integer id) {
...@@ -85,8 +85,4 @@ public class LitemallAddressService { ...@@ -85,8 +85,4 @@ public class LitemallAddressService {
return (int)addressMapper.countByExample(example); return (int)addressMapper.countByExample(example);
} }
public void updateById(LitemallAddress address) {
addressMapper.updateByPrimaryKeySelective(address);
}
} }
...@@ -52,8 +52,8 @@ public class LitemallAdminService { ...@@ -52,8 +52,8 @@ public class LitemallAdminService {
return (int)adminMapper.countByExample(example); return (int)adminMapper.countByExample(example);
} }
public void updateById(LitemallAdmin admin) { public int updateById(LitemallAdmin admin) {
adminMapper.updateByPrimaryKeySelective(admin); return adminMapper.updateWithVersionByPrimaryKeySelective(admin.getVersion(), admin);
} }
public void deleteById(Integer id) { public void deleteById(Integer id) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment