shish 3 лет назад
Родитель
Сommit
6a46069da1

+ 3 - 1
ghsApp/src/admin/billing/index.vue

@@ -87,7 +87,9 @@
 						<!-- #endif -->
 
 						<image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`" 
-						style="width:86upx;height:86upx;position:relative;top:-60upx;right:0upx;" mode="widthFix"></image>
+						style="width:86upx;height:86upx;position:absolute;top:300upx;right:40upx;" mode="widthFix"></image>
+
+						<button class="admin-button-com mini-btn" @click="customData.userPrice=0.01" style="position:absolute;top:200upx;right:33upx;">赠送</button>
 
 					</view>
 				</view>

+ 55 - 6
ghsApp/src/admin/billing/result.vue

@@ -1,6 +1,6 @@
 <template>
 
-  <appResult :title="option.title">
+<appResult :title="option.title">
   <!-- #ifdef MP-WEIXIN -->
   <button v-if="option.title != '报损成功'" class="admin-button-com big blue" open-type="share">
     分享给<text style="font-weight:bold;margin-left:12upx;">{{customName}}</text>
@@ -16,13 +16,30 @@
 	<button class="admin-button-com big" @click="goBackHome">返回首页</button>
   <view>
     <block v-for="(item, index) in detailInfo.product" :key="index">
-      <view v-if="item.xhUnitType == 1" style="text-align:center;margin-bottom:10upx;">
-        <text style="font-size:30upx;">{{item.name}}</text>
-        <button class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="partOne(item)">拆1份</button>
+      <view style="text-align:center;margin-bottom:10upx;">
+        <text style="font-size:30upx;">
+        {{item.name}}
+        <text v-if="item.giveNum && Number(item.giveNum)>0" style="color:green;">,已赠{{item.giveNum}}{{item.xhUnitName}}</text>
+        </text>
+        <button v-if="item.xhUnitType == 1" class="admin-button-com middle" style="margin:10upx auto 0 auto;" @click="partOne(item)">拆1份</button>
+        <button v-else class="admin-button-com middle blue" style="margin:10upx auto 0 auto;" @click="giveItemFn(item)">赠送</button>
       </view>
     </block>
   </view>
-  </appResult>
+
+		<modal-module :show="givePopShow" @click="confirmGive" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="giveNum" :adjust-position="false" class="inp-input" @focus="giveNum=''" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
+
+</appResult>
 
 </template>
 <script>
@@ -32,10 +49,13 @@ import { getDetail,cloudPrintOrder} from "@/api/order"
 import { getWeixinId } from "@/api/invite"
 import { IMGHOST } from '@/config'
 import { partItem } from "@/api/part"
+import { giveItem } from "@/api/order-item"
+import ModalModule from "@/components/plugin/modal"
 export default {
   name: "result",
   components: {
     appResult,
+    ModalModule
   },
   mixins: [],
   data() {
@@ -43,7 +63,10 @@ export default {
       detailInfo: {},
       customName:'客户',
       getappIdList: {},
-			title:'新订单'
+			title:'新订单',
+			giveTargetId:0,
+			givePopShow:false,
+			giveNum:1
     };
   },
 	computed: {
@@ -59,11 +82,37 @@ export default {
 		}
 	},
   methods: {
+    giveItemFn(item){
+      this.givePopShow = true
+      this.giveNum = 1
+      this.giveTargetId = item.id
+    },
+    confirmGive(){
+      let that = this
+      if(Number(this.giveTargetId)<=0){
+        this.$msg('请选择要赠送的花材')
+        return false
+      }
+      if(Number(this.giveNum)<=0){
+        this.$msg('请填写赠送数量')
+        return false
+      }
+      uni.showLoading({mask:true})
+      giveItem({id:this.giveTargetId,num:this.giveNum}).then(res=>{
+        uni.hideLoading()
+        if(res.code == 1){
+          that.givePopShow = false
+          that.init()
+          that.$msg(that.msg)
+        }
+      })
+    },
     partOne(item){
       let that = this
       let product = [{ productId: item.productId, bigNum: 1, smallNum: 0, classId: 0, itemId: item.itemId, ratio:item.ratio }]
       that.$util.confirmModal({content:'确认拆1份?'},() => {
           partItem({product:JSON.stringify(product),remark:'开单拆散'}).then((res) => {
+            that.init()
             that.$msg(res.msg)
           })
       })

+ 5 - 0
ghsApp/src/api/order-item/index.js

@@ -1,5 +1,10 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 
+//赠送花材
+export const giveItem = data => {
+	return https.post("/order-item/give-item", data);
+};
+
 //获取订单的花材
 export const getOrderProduct = data => {
 	return https.get("/order-item/get-order-product", data);

+ 51 - 6
ghsApp/src/pagesOrder/detail.vue

@@ -123,9 +123,11 @@
 			<view class="module-com content-box">
 				<view class="commodity-view">
 					<view class="commodity-list">
-						<view v-for="(s, idx) in detailInfo.product" :key="idx" class="commodity-item" >
+						<view v-for="(s, idx) in detailInfo.product" :key="idx" class="commodity-item" style="position:relative;">
 							<image class="item-icon" :src="s.cover" @click.stop="previewImage(s.bigCover)" />
-							<button v-if="s.xhUnitType == 1" style="position:absolute;left:57upx;" class="admin-button-com blue mini-btn" @click="partOne(s)">拆1份</button>
+							<button v-if="s.xhUnitType == 1" style="position:absolute;left:15upx;" class="admin-button-com blue mini-btn" @click="partOne(s)">拆1份</button>
+							<button style="position:absolute;left:155upx;top:78upx;" class="admin-button-com mini-btn" @click="giveItemFn(s)">发起赠送</button>
+							<text v-if="s.giveNum && Number(s.giveNum)>0" style="position:absolute;left:320upx;top:90upx;color:#333333;">已赠 {{parseFloat(s.giveNum)}}</text>
 							<view class="item-info" @click="pageTo({url:'/admin/item/detail',query:{id: s.productId}})">
 								<view class="info-line">
 									<text class="item-name">{{ s.name }}</text>
@@ -252,6 +254,19 @@
 			:size="32"
 			padding="30upx 30upx"
 		></modal-module>
+
+		<modal-module :show="givePopShow" @click="confirmGive" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="number" ref="input" style="width:61.8%;text-align:center;" v-model="giveNum" :adjust-position="false" class="inp-input" @focus="giveNum=''" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
+
 	</view>
 </template>
 
@@ -260,7 +275,7 @@ import { mapGetters } from "vuex";
 import stepStatus from "./components/stepStatus";
 import TuiListCell from "@/components/plugin/list-cell";
 import { getDetail,debtPay,hasPay, freeShipping,confirmFinish,cancel } from "@/api/order";
-import { getOrderProduct } from "@/api/order-item";
+import { getOrderProduct,giveItem } from "@/api/order-item";
 import productMins from "@/mixins/product";
 import { ORDER_STATUS } from "@/utils/declare";
 import BLE from "@/mixins/BLE";
@@ -269,11 +284,13 @@ import { hasHitNavigate } from "@/api/map";
 import { getWeixinId } from "@/api/invite";
 import { IMGHOST } from '@/config'
 import { partItem } from "@/api/part"
+import ModalModule from "@/components/plugin/modal"
 export default {
 	name: "orderDetail",
 	components: {
 		stepStatus,
-		TuiListCell
+		TuiListCell,
+		ModalModule
 	},
 	mixins: [productMins,BLE],
 	data() {
@@ -293,7 +310,10 @@ export default {
 			settlePrice:0,
 			showCancelBtn: true,
 			getappIdList: {},
-			title:'新订单'
+			title:'新订单',
+			giveTargetId:0,
+			givePopShow:false,
+			giveNum:1
 		};
 	},
 	onPullDownRefresh() {
@@ -322,6 +342,31 @@ export default {
 		}
 	},
 	methods: {
+		giveItemFn(item){
+			this.givePopShow = true
+			this.giveNum = 1
+			this.giveTargetId = item.id
+		},
+		confirmGive(){
+			let that = this
+			if(Number(this.giveTargetId)<=0){
+				this.$msg('请选择要赠送的花材')
+				return false
+			}
+			if(Number(this.giveNum)<=0){
+				this.$msg('请填写赠送数量')
+				return false
+			}
+			uni.showLoading({mask:true})
+			giveItem({id:this.giveTargetId,num:this.giveNum}).then(res=>{
+				uni.hideLoading()
+				if(res.code == 1){
+				that.givePopShow = false
+				that.init()
+				that.$msg(that.msg)
+				}
+			})
+		},
 		partOne(item){
 			let that = this
 			let product = [{ productId: item.productId, bigNum: 1, smallNum: 0, classId: 0, itemId: item.itemId, ratio:item.ratio }]
@@ -751,7 +796,7 @@ export default {
 						align-items: flex-end;
 						.item-name {
 							color: black;
-							font-size: 30upx;
+							font-size:34upx;
 							font-weight: 700;
 							overflow: hidden;
 							white-space: nowrap;