|
@@ -7,7 +7,7 @@
|
|
|
<span>关键词:</span>
|
|
|
<el-input style="width:220px;" @keyup.enter.native="currentPage=1&&_getCameraData()" v-model="searchKey" placeholder="关键词"></el-input>
|
|
|
<el-button type="primary" @click="currentPage=1&&_getCameraData()" color='red'>搜索</el-button>
|
|
|
- <el-button icon="el-icon-plus" type="primary" style="float: right;" @click="showCameraDialog" color='red'>添加相机</el-button>
|
|
|
+ <el-button icon="el-icon-plus" type="primary" style="float: right;" @click="showCameraDialog(null)" color='red'>添加相机</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 全部 -->
|
|
@@ -38,6 +38,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="showCameraDialog(scope.row)" class="new_edit_btn">编辑</el-button>
|
|
|
<el-button type="text" @click="showDialog(scope.row)" class="edit_btn">点数</el-button>
|
|
|
<el-button type="text" v-if="scope.row.userName!='未绑定'" @click="_unbindDevice(scope.row)" class="delete_btn">解绑</el-button>
|
|
|
</template>
|
|
@@ -45,19 +46,19 @@
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="order-management-pagination">
|
|
|
- <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pagesize" layout="total, prev, pager, next, jumper" :total="total">
|
|
|
+ <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pagesize" layout="total, prev, pager, next, jumper" :total="total">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-dialog width="450px" title="点数修改" :visible.sync="dialogFormVisible">
|
|
|
- <el-form :model="form" >
|
|
|
- <el-form-item >
|
|
|
+ <el-form :model="form">
|
|
|
+ <el-form-item>
|
|
|
<div style="display: flex;justify-content: space-between;font-size: 14px;">
|
|
|
<span>设备ID:
|
|
|
- <span>{{currentChildName}}</span>
|
|
|
+ <span>{{currentChildName}}</span>
|
|
|
</span>
|
|
|
<span>当前余额:
|
|
|
- <span>{{currentBalance}}</span>
|
|
|
+ <span>{{currentBalance}}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
@@ -81,8 +82,8 @@
|
|
|
<el-form-item label="出库类型" prop="own">
|
|
|
<el-select v-model="ruleForm.own" placeholder="请选择出库类型">
|
|
|
<el-option label="正常销售" value="0"></el-option>
|
|
|
- <el-option label="礼品赠送" value="2"></el-option>
|
|
|
<el-option label="员工自用" value="1"></el-option>
|
|
|
+ <el-option label="礼品赠送" value="2"></el-option>
|
|
|
<el-option label="其他" value="3"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -95,28 +96,29 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="wifi名称" prop="wifi">
|
|
|
- <el-input v-model="ruleForm.wifi"></el-input>
|
|
|
+ <el-input v-model="ruleForm.wifi" :disabled="editStatus==2 && ruleForm.wifi!=''"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="物理地址" prop="address">
|
|
|
- <el-input v-model="ruleForm.address"></el-input>
|
|
|
+ <el-input v-model="ruleForm.address" :disabled="editStatus==2&& ruleForm.address!=''"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="sn码" prop="snCode">
|
|
|
- <el-input v-model="ruleForm.snCode"></el-input>
|
|
|
+ <el-input v-model="ruleForm.snCode" :disabled="editStatus==2&& ruleForm.snCode!=''"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="初始点数" @keyup.native="_checkPointInput" prop="initPoint">
|
|
|
- <el-input v-model="ruleForm.initPoint"></el-input>
|
|
|
+ <el-input v-model="ruleForm.initPoint" :disabled="editStatus==2&& ruleForm.initPoint!=''"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="订单号" prop="orderNum">
|
|
|
<el-input v-model="ruleForm.orderNum"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客户名称" prop="own">
|
|
|
<el-select v-model="ruleForm.companyId" placeholder="请选择">
|
|
|
+ <el-option label="-" :value="0">-</el-option>
|
|
|
<el-option v-for="(item,i) in companyList" :key="i" :label="item.companyName" :value="item.id">{{item.companyName}}</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="cameraVisible = false">取 消</el-button>
|
|
|
+ <el-button @click="closeCamera()">取 消</el-button>
|
|
|
<el-button type="primary" @click="_addCamera">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -125,11 +127,15 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
- tabs: [{ name: '设备ID', idx: 0 }, { name: '手机号', idx: 1 }, { name: '当前余额', idx: 2 }, { name: '历史充值', idx: 3 }],
|
|
|
+ tabs: [
|
|
|
+ { name: '设备ID', idx: 0 },
|
|
|
+ { name: '手机号', idx: 1 },
|
|
|
+ { name: '当前余额', idx: 2 },
|
|
|
+ { name: '历史充值', idx: 3 }
|
|
|
+ ],
|
|
|
expands: [],
|
|
|
expandedArr: [],
|
|
|
cameras: [],
|
|
@@ -137,19 +143,19 @@ export default {
|
|
|
key_input: '',
|
|
|
fullscreenLoading: false,
|
|
|
product: {
|
|
|
- 'name': '',
|
|
|
- 'packageName': '',
|
|
|
- 'count': '',
|
|
|
- 'amount': '',
|
|
|
- 'url': ''
|
|
|
+ name: '',
|
|
|
+ packageName: '',
|
|
|
+ count: '',
|
|
|
+ amount: '',
|
|
|
+ url: ''
|
|
|
},
|
|
|
// labelPosition: 'right',
|
|
|
receive: {
|
|
|
- 'name': '',
|
|
|
- 'phone': '',
|
|
|
- 'address': '',
|
|
|
- 'invoice': '',
|
|
|
- 'expressNum': ''
|
|
|
+ name: '',
|
|
|
+ phone: '',
|
|
|
+ address: '',
|
|
|
+ invoice: '',
|
|
|
+ expressNum: ''
|
|
|
},
|
|
|
searchKey: '',
|
|
|
total: 0,
|
|
@@ -199,7 +205,6 @@ export default {
|
|
|
{ required: true, message: '请输入初始点数', trigger: 'blur' }
|
|
|
// { type: "number", message: '必须为数字值', trigger: 'blur' }
|
|
|
]
|
|
|
-
|
|
|
},
|
|
|
cameraInfo: {
|
|
|
wifi: '',
|
|
@@ -215,7 +220,9 @@ export default {
|
|
|
currentChildName: '',
|
|
|
currentDeviceId: '',
|
|
|
currentBalance: '',
|
|
|
- pagesize: 10
|
|
|
+ pagesize: 10,
|
|
|
+ currentId: 0,
|
|
|
+ editStatus: 1
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -224,6 +231,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ closeCamera () {
|
|
|
+ this.cameraVisible = false
|
|
|
+ this.$refs['ruleForm'].resetFields()
|
|
|
+ },
|
|
|
async _getCameraData () {
|
|
|
this.fullscreenLoading = true
|
|
|
if (!Number(this.currentPage)) this.currentPage = 1
|
|
@@ -251,8 +262,12 @@ export default {
|
|
|
temp[i]['own'] = '其他'
|
|
|
break
|
|
|
}
|
|
|
- temp[i]['userName'] = temp[i]['userName'] ? temp[i]['userName'] : '未绑定'
|
|
|
- temp[i]['activatedTime'] = temp[i]['activatedTime'] ? new Date(temp[i]['activatedTime']).format('yyyy-MM-dd hh:mm:ss') : '/'
|
|
|
+ temp[i]['userName'] = temp[i]['userName']
|
|
|
+ ? temp[i]['userName']
|
|
|
+ : '未绑定'
|
|
|
+ temp[i]['activatedTime'] = temp[i]['activatedTime']
|
|
|
+ ? new Date(temp[i]['activatedTime']).format('yyyy-MM-dd hh:mm:ss')
|
|
|
+ : '/'
|
|
|
}
|
|
|
this.cameras = temp
|
|
|
this.total = res.data.total ? res.data.total : this.total
|
|
@@ -278,31 +293,33 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(async () => {
|
|
|
- this.fullscreenLoading = true
|
|
|
- console.log(row)
|
|
|
- let res = await this.$http.post('/manager/camera/unbind', {
|
|
|
- cameraId: row.id
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ this.fullscreenLoading = true
|
|
|
+ console.log(row)
|
|
|
+ let res = await this.$http.post('/manager/camera/unbind', {
|
|
|
+ cameraId: row.id
|
|
|
+ })
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '解绑成功!'
|
|
|
+ })
|
|
|
+ this._getCameraData()
|
|
|
+ } else {
|
|
|
+ this.$alert('解绑失败', '提示', {
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.fullscreenLoading = false
|
|
|
})
|
|
|
- if (res.code === 0) {
|
|
|
+ .catch(() => {
|
|
|
this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '解绑成功!'
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消解绑'
|
|
|
})
|
|
|
- this._getCameraData()
|
|
|
- } else {
|
|
|
- this.$alert('解绑失败', '提示', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- })
|
|
|
- }
|
|
|
- this.fullscreenLoading = false
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消解绑'
|
|
|
+ this.fullscreenLoading = false
|
|
|
})
|
|
|
- this.fullscreenLoading = false
|
|
|
- })
|
|
|
},
|
|
|
_checkInput: function (e) {
|
|
|
this.form.point += ''
|
|
@@ -326,9 +343,7 @@ export default {
|
|
|
if (!body) {
|
|
|
this.$alert('请选择充值类型', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
-
|
|
|
- }
|
|
|
+ callback: (action) => {}
|
|
|
})
|
|
|
} else {
|
|
|
let res = await this.$http.post('/manager/camera/modifyPoints', {
|
|
@@ -363,27 +378,100 @@ export default {
|
|
|
companyId,
|
|
|
orderNum: orderSn
|
|
|
} = this.ruleForm
|
|
|
- if (wifiName === '' || childName === '' || snCode === '' || balance === '' || own === '' || type === '') {
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (wifiName === '' || childName === '' || snCode === '' || balance === '' || own === '' || type === '') {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ this.$refs['ruleForm'].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.fullscreenLoading = true
|
|
|
|
|
|
- this.fullscreenLoading = true
|
|
|
- let res = await this.$http.post('/manager/camera/add', {
|
|
|
- childName,
|
|
|
- wifiName,
|
|
|
- orderSn,
|
|
|
- snCode,
|
|
|
- companyId,
|
|
|
- balance: Number(balance),
|
|
|
- type: Number(type),
|
|
|
- own
|
|
|
+ let res
|
|
|
+ if (this.editStatus === 1) {
|
|
|
+ res = await this.$http.post('/manager/camera/add', {
|
|
|
+ childName,
|
|
|
+ wifiName,
|
|
|
+ orderSn,
|
|
|
+ snCode,
|
|
|
+ companyId,
|
|
|
+ balance: Number(balance),
|
|
|
+ type: Number(type),
|
|
|
+ own
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ res = await this.$http.post('/manager/camera/update', {
|
|
|
+ cameraId: this.currentId,
|
|
|
+ childName,
|
|
|
+ wifiName,
|
|
|
+ orderSn,
|
|
|
+ snCode,
|
|
|
+ companyId,
|
|
|
+ balance: Number(balance),
|
|
|
+ type: Number(type),
|
|
|
+ own
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.fullscreenLoading = false
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$alert('该相机信息已成功添加入库', '添加成功', {
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ this._getCameraData()
|
|
|
+ this.ruleForm.address = ''
|
|
|
+ this.ruleForm.wifi = ''
|
|
|
+ this.ruleForm.own = ''
|
|
|
+ this.ruleForm.orderNum = ''
|
|
|
+ this.ruleForm.snCode = ''
|
|
|
+ this.ruleForm.type = ''
|
|
|
+ this.ruleForm.initPoint = ''
|
|
|
+ this.ruleForm.companyId = ''
|
|
|
+
|
|
|
+ this.cameraVisible = false
|
|
|
+ } else {
|
|
|
+ this.$alert(res.msg, '添加失败', {
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
})
|
|
|
- this.fullscreenLoading = false
|
|
|
- if (res.code === 0) {
|
|
|
- this.$alert('该相机信息已成功添加入库', '添加成功', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- })
|
|
|
- this._getCameraData()
|
|
|
+ },
|
|
|
+ showCameraDialog (row) {
|
|
|
+ this.cameraVisible = true
|
|
|
+ if (row) {
|
|
|
+ console.log(row)
|
|
|
+ this.editStatus = 2
|
|
|
+ this.currentId = row.id
|
|
|
+ this.ruleForm.address = row.childName
|
|
|
+ this.ruleForm.wifi = ''
|
|
|
+ let own = ''
|
|
|
+ switch (row.own) {
|
|
|
+ case '正常销售':
|
|
|
+ own = '0'
|
|
|
+ break
|
|
|
+ case '员工自用':
|
|
|
+ own = '1'
|
|
|
+ break
|
|
|
+ case '礼品赠送':
|
|
|
+ own = '2'
|
|
|
+ break
|
|
|
+ case '其他':
|
|
|
+ own = '3'
|
|
|
+ break
|
|
|
+ }
|
|
|
+
|
|
|
+ this.ruleForm.own = own
|
|
|
+ this.ruleForm.orderNum = row.orderSn
|
|
|
+ this.ruleForm.snCode = row.snCode
|
|
|
+ this.ruleForm.type = row.cameraType
|
|
|
+ this.ruleForm.initPoint = row.balance
|
|
|
+ this.ruleForm.companyId = row.companyId
|
|
|
+ this.ruleForm.wifi = row.wifiName
|
|
|
+ } else {
|
|
|
+ this.editStatus = 1
|
|
|
+ this.currentId = 0
|
|
|
this.ruleForm.address = ''
|
|
|
this.ruleForm.wifi = ''
|
|
|
this.ruleForm.own = ''
|
|
@@ -392,16 +480,7 @@ export default {
|
|
|
this.ruleForm.type = ''
|
|
|
this.ruleForm.initPoint = ''
|
|
|
this.ruleForm.companyId = ''
|
|
|
-
|
|
|
- this.cameraVisible = false
|
|
|
- } else {
|
|
|
- this.$alert(res.msg, '添加失败', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- })
|
|
|
}
|
|
|
- },
|
|
|
- showCameraDialog (row) {
|
|
|
- this.cameraVisible = true
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -409,22 +488,20 @@ export default {
|
|
|
this.getCompanyList()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</script>
|
|
|
<style lang="css" scoped>
|
|
|
-@import './style.css';
|
|
|
+@import "./style.css";
|
|
|
</style>
|
|
|
<style type="text/css">
|
|
|
-.el-table__expand-icon>i {
|
|
|
+.el-table__expand-icon > i {
|
|
|
display: none !important;
|
|
|
}
|
|
|
|
|
|
.edit_btn span {
|
|
|
- color: #09e1c0
|
|
|
+ color: #09e1c0;
|
|
|
}
|
|
|
|
|
|
.delete_btn span {
|
|
|
- color: #f56c6c
|
|
|
+ color: #f56c6c;
|
|
|
}
|
|
|
-
|
|
|
</style>
|