Browse Source

添加花材

shish 2 years ago
parent
commit
ed1e71d367

+ 2 - 0
ghs/src/cool/request/index.js

@@ -67,12 +67,14 @@ import bookChange from '@/service/book-change/index';
 import bookOnChange from '@/service/book-on-change/index';
 import bookOnChange from '@/service/book-on-change/index';
 import bookRoadChange from '@/service/book-road-change/index';
 import bookRoadChange from '@/service/book-road-change/index';
 import bookItemGhs from '@/service/book-item-ghs/index';
 import bookItemGhs from '@/service/book-item-ghs/index';
+import orderItem from '@/service/order-item/index';
 
 
 export function SET_SERVICE({ store }) {
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const ignore = ['./request.js'];
 	// const ignore = ['./request.js'];
 
 
 	let modules = {
 	let modules = {
+		orderItem,
 		bookItemGhs,
 		bookItemGhs,
 		bookCgChange,
 		bookCgChange,
 		bookChange,
 		bookChange,

+ 17 - 0
ghs/src/service/order-item/index.js

@@ -0,0 +1,17 @@
+import { BaseService, Service } from '@/cool';
+import store from '@/store';
+import { baseUrl } from '@/config/env';
+
+@Service('order-item')
+export class OrderItemService extends BaseService {
+
+	addItem(data) {
+		return this.request({
+			url: '/add-item',
+			method: 'POST',
+			data: data
+		});
+	}
+
+}
+export default new OrderItemService();

+ 28 - 10
ghs/src/views/order/components/simple-item.vue

@@ -23,6 +23,10 @@
                         <span style="font-size:13px;">{{ scope.row.stock?parseFloat(scope.row.stock):0 }}</span>
                         <span style="font-size:13px;">{{ scope.row.stock?parseFloat(scope.row.stock):0 }}</span>
                     </template>
                     </template>
 
 
+                    <template #table-column-showUsePrice="{ scope }">
+                        <el-input v-model="scope.row.showUsePrice" placeholder="价格"></el-input>
+                    </template>
+
                     <template #table-column-bigCount="{ scope }">
                     <template #table-column-bigCount="{ scope }">
                         <el-input v-model="scope.row.bigCount" placeholder="数量"></el-input>
                         <el-input v-model="scope.row.bigCount" placeholder="数量"></el-input>
                     </template>
                     </template>
@@ -41,9 +45,9 @@
 </template>
 </template>
 <script>
 <script>
 export default {
 export default {
-	name: 'loan-item',
+	name: 'simple-item',
 	props: {
 	props: {
-		currentData: {
+		simpleData: {
 			type: Object,
 			type: Object,
 			default: () => {}
 			default: () => {}
 		}
 		}
@@ -78,25 +82,33 @@ export default {
 			this.showArea = false;
 			this.showArea = false;
 		},
 		},
         confirmAdd(info){
         confirmAdd(info){
-
+			if(Number(info.bigCount)<=0){
+				this.$message.error('请填写数量')
+				return false
+			}
+			let showUsePrice = Number(info.showUsePrice)>0 ? info.showUsePrice: 100
+			let data = [{id:info.id,bigCount:info.bigCount,price:showUsePrice}]
+			this.$service.orderItem.addItem({data:JSON.stringify(data),id:this.simpleData.id}).then(res => {
+				this.$notify({ title: '添加成功', message: '', type: 'success'})
+				this.$emit('renewArrival',this.simpleData)
+				this.closeFn()
+			})
         },
         },
 		onLoad({ ctx, app }) {
 		onLoad({ ctx, app }) {
 			this.app = app;
 			this.app = app;
-
 			let logHost = () => {
 			let logHost = () => {
 				return this.$service.item.simpleList({name:this.search})
 				return this.$service.item.simpleList({name:this.search})
 			};
 			};
 			ctx.service({
 			ctx.service({
 				page: logHost
 				page: logHost
 			})
 			})
-
 			.set('table', {
 			.set('table', {
 				columns: [
 				columns: [
                     {
                     {
 						label: 'ID',
 						label: 'ID',
 						prop: 'id',
 						prop: 'id',
 						align: 'center',
 						align: 'center',
-                        width:80
+                        width:70
 					},
 					},
 					{
 					{
 						label: '图片',
 						label: '图片',
@@ -108,19 +120,25 @@ export default {
 						label: '名称',
 						label: '名称',
 						prop: 'name',
 						prop: 'name',
 						align: 'center',
 						align: 'center',
-                        width:300
+                        width:200
 					},
 					},
 					{
 					{
-						label: '可借',
+						label: '库存',
 						prop: 'stock',
 						prop: 'stock',
 						align: 'center',
 						align: 'center',
+                        width:90
+					},
+					{
+						label: '价格',
+						prop: 'showUsePrice',
+						align: 'center',
                         width:100
                         width:100
 					},
 					},
 					{
 					{
-						label: '要借',
+						label: '数量',
 						prop: 'bigCount',
 						prop: 'bigCount',
 						align: 'center',
 						align: 'center',
-                        width:130
+                        width:100
 					}
 					}
 				],
 				],
 				op: {
 				op: {

+ 7 - 4
ghs/src/views/order/list.vue

@@ -164,13 +164,12 @@
 
 
     <arrival ref="arrivalRef" :arrivalData="arrivalData" @addNewItem="addNewItem" />
     <arrival ref="arrivalRef" :arrivalData="arrivalData" @addNewItem="addNewItem" />
 
 
-    <simple-item ref="simpleItemRef" :simpleData="simpleData" />
+    <simple-item ref="simpleItemRef" :simpleData="simpleData" @renewArrival="renewArrival" />
 
 
-    <!-- 用户详情 -->
     <order-detail ref="orderDetail" :orderOperate="optionData" />
     <order-detail ref="orderDetail" :orderOperate="optionData" />
-    <!-- 发货状态 -->
+
     <sel-order ref="selOrder" :id="optionData.id" @song-success="onSongSuccess" />
     <sel-order ref="selOrder" :id="optionData.id" @song-success="onSongSuccess" />
-    <!-- 配送单 -->
+
     <div class="print-html-box">
     <div class="print-html-box">
       <table border="0" width="730" style="border:solid 1px #fff;border-collapse:collapse">
       <table border="0" width="730" style="border:solid 1px #fff;border-collapse:collapse">
         <tr>
         <tr>
@@ -223,6 +222,7 @@
         </tr>
         </tr>
       </table>
       </table>
     </div>
     </div>
+
   </div>
   </div>
 </template>
 </template>
 
 
@@ -332,6 +332,9 @@ export default {
   
   
 	},
 	},
   methods: {
   methods: {
+    renewArrival(info){
+      this.confirmArrival(info)
+    },
     addNewItem(data){
     addNewItem(data){
       this.simpleData = data
       this.simpleData = data
       setTimeout(() => {
       setTimeout(() => {