diff --git a/.env.production b/.env.production
index c6152f0..8c2ed2b 100644
--- a/.env.production
+++ b/.env.production
@@ -3,9 +3,9 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
# 测试
-# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
+VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# 生产
-VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
+# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'wss://123.56.110.252
diff --git a/package.json b/package.json
index e827f30..f91c1d7 100644
--- a/package.json
+++ b/package.json
@@ -48,6 +48,7 @@
"reconnecting-websocket": "^4.4.0",
"screenfull": "4.2.0",
"sortablejs": "^1.15.2",
+ "terser-webpack-plugin": "^4.2.3",
"vue": "^2.6.14",
"vue-amap": "^0.5.10",
"vue-clipboard2": "^0.3.3",
diff --git a/src/views/invoicing/components/consumableList.vue b/src/views/invoicing/components/consumableList.vue
index 9bf2ac2..62d8314 100644
--- a/src/views/invoicing/components/consumableList.vue
+++ b/src/views/invoicing/components/consumableList.vue
@@ -17,7 +17,8 @@
-
+
+
@@ -29,16 +30,20 @@
{{ formatDecimal(scope.row.stockNumber - scope.row.stockConsume, 2, true) }}
-
+
+
@@ -71,9 +76,18 @@ export default {
this.resetSearchForm = { ...this.searchForm }
},
methods: {
+ firstSelectChange() {
+ // console.log(selection)
+ let selection = this.$refs.table.selection
+ if (selection.length > 1 && this.isselect) {
+ const del_row = selection.shift();
+ this.$refs.table.toggleRowSelection(del_row, false);
+ }
+ },
// 确定选商品
- confirmHandle(row) {
- this.$emit('success', row)
+ confirmHandle() {
+ let res = this.$refs.table.selection
+ this.$emit('success', res)
this.close()
},
// 重置查询
@@ -120,9 +134,25 @@ export default {
},
show(goods) {
this.dialogVisible = true
+ if (goods && goods.length) {
+ this.goods = goods
+ } else {
+ this.goods = []
+ }
+ this.resetHandle()
+ this.getTableData()
},
close() {
this.dialogVisible = false
+ },
+ selection() {
+ this.goods.forEach(row => {
+ this.tableData.list.forEach((item, index) => {
+ if (row.id == item.id) {
+ this.$refs.table.toggleRowSelection(this.tableData.list[index]);
+ }
+ })
+ });
}
}
}
diff --git a/src/views/invoicing/operation_in.vue b/src/views/invoicing/operation_in.vue
index 10a4e55..fbf0b84 100644
--- a/src/views/invoicing/operation_in.vue
+++ b/src/views/invoicing/operation_in.vue
@@ -5,7 +5,7 @@
+ :class="{ active: inTabValue == item.value }" @click="tabChange(item.value, item.type)">
{{ item.label }}
@@ -89,7 +89,7 @@
- 选择耗材
选择商品
@@ -113,14 +113,14 @@
{ queryForm.totalAmount = formatDecimal(e * scope.row.stockNumber) }">
+ @change="consCountTotal()">
原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }}
{ queryForm.totalAmount = formatDecimal(e * scope.row.price) }">
+ @change="consCountTotal()">
入库前:{{ scope.row.number }}{{ scope.row.conUnit }}
@@ -226,11 +226,13 @@ export default {
inTabs: [
{
label: '商品入库',
- value: 'goods'
+ value: 'goods',
+ type: 'purveyor'
},
{
label: '耗材入库',
- value: 'consumable'
+ value: 'consumable',
+ type: 'in'
}
],
shopTypesActive: 0,
@@ -294,16 +296,26 @@ export default {
},
methods: {
// 切换入库内容
- tabChange(value) {
+ tabChange(value, type) {
this.inTabValue = value
this.shopTypesActive = 0
+ this.queryForm.type = type
},
+ // 计算耗材总价
+ consCountTotal() {
+ let zong = 0
+ this.tableData.list.forEach(ele => {
+ zong += ele.price * ele.stockNumber
+ })
+ this.queryForm.totalAmount = formatDecimal(zong)
+ },
+ // 计算商品总价
modifyPrice() {
let zong = 0
this.tableData.list.forEach(ele => {
zong += ele.costPrice * ele.number
})
- this.queryForm.totalAmount = parseFloat(zong.toFixed(2))
+ this.queryForm.totalAmount = formatDecimal(zong)
},
// 提交
submitHandle() {
@@ -317,17 +329,12 @@ export default {
await tbProductStockOperateOutAndOn(this.queryForm)
break;
case 'consumable':
- const con = { ...this.tableData.list[0] }
- await stockInOut({
- accountsPayable: this.queryForm.totalAmount,
- actualPayment: this.queryForm.paidAmount,
- conInfoId: con.id,
- paymentTime: this.queryForm.paidAt,
- price: con.price,
- stockNumber: con.stockNumber,
- supplierId: this.queryForm.purveyorId,
- type: 'in'
- })
+ this.queryForm.accountsPayable = this.queryForm.totalAmount
+ this.queryForm.actualPayment = this.queryForm.paidAmount
+ this.queryForm.paymentTime = this.queryForm.paidAt
+ this.queryForm.supplierId = this.queryForm.purveyorId
+ this.queryForm.list = this.tableData.list
+ await stockInOut(this.queryForm)
break;
default:
break;
@@ -343,12 +350,13 @@ export default {
},
// 选择耗材
selectConsumable(res) {
- const n_res = { ...res }
- res.costPrice = n_res.price
- res.number = n_res.stockNumber - n_res.stockConsume
- res.stockNumber = 0
- this.tableData.list = [res]
- this.queryForm.totalAmount = formatDecimal(res.price * res.stockNumber)
+ this.tableData.list = res.map(item => {
+ item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
+ item.stockNumber = 0
+ item.costPrice = item.price
+ item.conInfold = item.id
+ return item
+ })
},
// 选择商品
selectShop(res) {
@@ -373,6 +381,7 @@ export default {
this.showResult = false
this.queryForm = { ...this.resetForm }
this.tableData.list = []
+ this.$refs.queryForm.resetFields()
},
// 切换类型
changeTypeEnum(index) {
diff --git a/src/views/invoicing/operation_out.vue b/src/views/invoicing/operation_out.vue
index 3be3b4e..e7bcf83 100644
--- a/src/views/invoicing/operation_out.vue
+++ b/src/views/invoicing/operation_out.vue
@@ -5,7 +5,7 @@
+ :class="{ active: inTabValue == item.value }" @click="tabChange(item.value, item.type)">
{{ item.label }}
@@ -89,7 +89,7 @@
- 选择耗材
选择商品
@@ -101,7 +101,6 @@
-
@@ -111,14 +110,14 @@
{ queryForm.totalAmount = formatDecimal(e * scope.row.stockNumber) }">
+ @change="consCountTotal()">
原价¥{{ scope.row.costPrice }}/{{ scope.row.conUnit }}
{ queryForm.totalAmount = formatDecimal(e * scope.row.price) }">
+ @change="consCountTotal()">
出库前:{{ scope.row.number }}{{ scope.row.conUnit }}
@@ -223,11 +222,13 @@ export default {
inTabs: [
{
label: '商品出库',
- value: 'goods'
+ value: 'goods',
+ type: 'reject'
},
{
label: '耗材出库',
- value: 'consumable'
+ value: 'consumable',
+ type: 'out'
}
],
shopTypesActive: 0,
@@ -260,7 +261,7 @@ export default {
time: dayjs().format('YYYY-MM-DD'),
totalAmount: 0,
type: 'reject',
- shopId: localStorage.getItem('shopId')
+ shopId: localStorage.getItem('shopId'),
},
queryRules: {
purveyorId: [
@@ -291,10 +292,20 @@ export default {
},
methods: {
// 切换入库内容
- tabChange(value) {
+ tabChange(value, type) {
this.inTabValue = value
this.shopTypesActive = 0
+ this.queryForm.type = type
},
+ // 计算耗材总价
+ consCountTotal() {
+ let zong = 0
+ this.tableData.list.forEach(ele => {
+ zong += ele.price * ele.stockNumber
+ })
+ this.queryForm.totalAmount = formatDecimal(zong)
+ },
+ // 计算商品总价
modifyPrice() {
let zong = 0
this.tableData.list.forEach(ele => {
@@ -314,17 +325,13 @@ export default {
await tbProductStockOperateOutAndOn(this.queryForm)
break;
case 'consumable':
- const con = { ...this.tableData.list[0] }
- await stockInOut({
- accountsPayable: this.queryForm.totalAmount,
- actualPayment: this.queryForm.paidAmount,
- conInfoId: con.id,
- paymentTime: this.queryForm.paidAt,
- price: con.price,
- stockNumber: con.stockNumber,
- supplierId: this.queryForm.purveyorId,
- type: 'out'
- })
+ this.queryForm.accountsPayable = this.queryForm.totalAmount
+ this.queryForm.actualPayment = this.queryForm.paidAmount
+ this.queryForm.paymentTime = this.queryForm.paidAt
+ this.queryForm.supplierId = this.queryForm.purveyorId
+ this.queryForm.list = this.tableData.list
+ this.queryForm.type = 'out'
+ await stockInOut(this.queryForm)
break;
default:
break;
@@ -340,12 +347,13 @@ export default {
},
// 选择耗材
selectConsumable(res) {
- const n_res = { ...res }
- res.costPrice = n_res.price
- res.number = n_res.stockNumber - n_res.stockConsume
- res.stockNumber = 0
- this.tableData.list = [res]
- this.queryForm.totalAmount = formatDecimal(res.price * res.stockNumber)
+ this.tableData.list = res.map(item => {
+ item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
+ item.stockNumber = 0
+ item.costPrice = item.price
+ item.conInfold = item.id
+ return item
+ })
},
// 选择商品
selectShop(res) {
@@ -370,6 +378,7 @@ export default {
this.showResult = false
this.queryForm = { ...this.resetForm }
this.tableData.list = []
+ this.$refs.queryForm.resetFields()
},
// 切换类型
changeTypeEnum(index) {
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..b593fbe
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,17 @@
+const TerserPlugin = require("terser-webpack-plugin");
+
+module.exports = {
+ // 其他配置项...
+ optimization: {
+ minimize: true, // 必须开启,否则配置不失效
+ minimizer: [
+ new TerserPlugin({
+ terserOptions: {
+ compress: {
+ drop_console: true
+ }
+ }
+ })
+ ]
+ }
+};
\ No newline at end of file