shish пре 5 година
родитељ
комит
db27ddaaa9

+ 83 - 44
ghsApp/src/admin/billing/affirm.vue

@@ -6,17 +6,8 @@
         <view class="module-com">
           <view class="commodity-view">
             <view class="commodity-list">
-              <view
-                class="commodity-item"
-                v-for="(item, index) in selectList"
-                :key="index"
-              >
-                <image
-                  class="item-icon"
-                  :src="item.cover"
-                  alt="商品图"
-                />
-
+              <view class="commodity-item" v-for="(item, index) in selectList" :key="index">
+                <image class="item-icon" :src="item.cover" alt="商品图" />
                 <view class="item-info">
                   <view class="info-line">
                     <text class="item-name">{{ item.itemName }}</text>
@@ -44,10 +35,7 @@
               </view>
             </view>
             <view class="summary-bar">
-              <view
-                class="operate-view"
-                @click="gobackEvent"
-              >
+              <view class="operate-view" @click="gobackEvent">
                 <text class="iconfont icongouwuche"></text>
                 重选花材
               </view>
@@ -61,6 +49,11 @@
         </view>
         <!-- 登录信息 -->
         <view class="module-com input-line-wrap">
+									<view class="tab-box flex-space">
+										<view class="flex-center tab" :class="isBilling?'active':''" @tap="isBilling=true">开单</view>
+										<view class="flex-center tab" :class="isBilling?'':'active'" @tap="isBilling=false">损耗登记</view>
+									</view>
+									<view class="" v-if="isBilling">
           <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="showCustomer = true">
             <view class="tui-title">客户</view>
             <view class="tui-input" v-if="form.customId" >{{ form.customName }}</view>
@@ -104,18 +97,18 @@
 										<view class="tui-title">优惠</view>
 										<text style="color: #3385FF">{{	(allPrice.toFixed(2) - modifyPrice + Number(this.form.sendCost)).toFixed(2) }}</text>
 									</tui-list-cell>
-
+									</view>
         </view>
       </form>
     </view>
     <view class="under-bar">
       <view class="price-view">
-        <text class="price-title">{{form.debt == 1 ? "欠款" : "已收款"}}</text>
+        <text class="price-title" v-if="isBilling">{{form.debt == 1 ? "欠款" : "已收款"}}</text>
+        <text class="price-title" v-else>金额</text>
         <text class="price-number">
           ¥
-          <!--<text class="large" v-if="form.sendType == 1">{{	(allPrice + Number(form.sendCost)).toFixed(2) }}</text>-->
-          <!--<text class="large" v-else >{{ allPrice.toFixed(2) }}</text>-->
-          <text class="large" >{{ modifyPrice?modifyPrice:0 }}</text>
+									<text class="large" v-if="isBilling">{{ modifyPrice?modifyPrice:0 }}</text>
+									<text class="large" v-else>{{ allPrice.toFixed(2) }}</text>
         </text>
       </view>
       <button class="admin-button-com blue middle" @click="affirmFormSubmit">
@@ -139,7 +132,7 @@ import appAddressGroup from "@/components/app-address-group";
 import appSendTime from "@/components/app-send-time";
 import appFormSend from "@/components/app-form-send";
 const formUtil = require("@/utils/formValidation.js");
-import { createOrder, freight } from "@/api/order/index";
+import { createOrder, freight,wastage } from "@/api/order/index";
 import { mapActions, mapGetters } from "vuex";
 export default {
   name: "BillingAffirm", // 开单确认
@@ -158,6 +151,7 @@ export default {
   data () {
     return {
       autoLoad: false,
+      isBilling: true,
       form: {
         debt: 1, //付款方式 1欠款订单 0正常订单
         shopId: "",
@@ -177,7 +171,7 @@ export default {
         product: "",
       },
       money: "",
-			modifyPrice: 0,
+      modifyPrice: 0,
       showCustomer: false
     };
   },
@@ -285,29 +279,58 @@ export default {
       });
     },
     affirmFormSubmit () {
-      let rules = [
-        {
-          name: "customId",
-          rule: ["required"],
-          msg: ["请选择客户"],
-        },
-      ];
-      let checkRes = formUtil.validation(this.form, rules);
-      if (checkRes) {
-        this.$msg(checkRes);
-        return false;
-      }
+					let self = this;
+    	if(this.isBilling){
+						let rules = [
+							{
+								name: "customId",
+								rule: ["required"],
+								msg: ["请选择客户"],
+							},
+						];
+						let checkRes = formUtil.validation(this.form, rules);
+						if (checkRes) {
+							this.$msg(checkRes);
+							return false;
+						}
+						uni.showModal({
+							title: "提示",
+							content: "确认开单?",
+							success: function (res) {
+								if (res.confirm) {
+									self.formSubmit();
+								}
+							},
+						});
+					}else{
+						let product = this.selectList.map((ele) => {
+							return {
+								productId: ele.id,
+								bigNum: ele.bigCount,
+								smallNum: ele.smallCount,
+								classId: ele.classId,
+								itemId: ele.itemId,
+							};
+						});
+						console.log(product)
+						// formData.product = JSON.stringify(product);
+						uni.showModal({
+							title: "提示",
+							content: "损耗登记?",
+							success: function (res) {
+								if (res.confirm) {
+									wastage({product:JSON.stringify(product)}).then((res) => {
+										self.resetSelectInfoByType(self.pageType);
+										const {data: { id, orderSn },} = res;
+										let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
+										uni.redirectTo({url: url,success: (result) => { },fail: () => { },complete: () => { },
+										});
+									});
+								}
+							},
+						});
+					}
 
-      let self = this;
-      uni.showModal({
-        title: "提示",
-        content: "确认开单?",
-        success: function (res) {
-          if (res.confirm) {
-            self.formSubmit();
-          }
-        },
-      });
     },
     // 表单验证
     async formSubmit (e) {
@@ -452,6 +475,22 @@ export default {
 
       border-radius: 10px;
       overflow: hidden;
+					.tab-box{
+						padding: 10rpx 30rpx 30rpx;
+						.tab{
+							width: 45%;
+							height: 80rpx;
+							color: #a2a2a2;
+							border: 1px solid #dcdcdc;
+							border-radius: 10rpx;
+							font-size: 28rpx;
+							font-weight: 700;
+							&.active{
+								color: #ff4d4d;
+								border: 1px solid #ff4d4d;
+							}
+						}
+					}
       .member-wrap {
         .member-det {
           font-size: 24px;

+ 7 - 0
ghsApp/src/api/order/index.js

@@ -13,6 +13,13 @@ export const getDetail = data => {
 	return https.get("/order/detail", data);
 };
 
+/** *
+	* 损耗生成订单
+	*/
+export const wastage = data => {
+	return https.post("/order/wastage", data);
+};
+
 /** *
  * 订单评价 m
  */

+ 2 - 1
ghsApp/src/pagesClient/member/add.vue

@@ -129,6 +129,7 @@ export default {
 			this.$refs.simpleAddress.open();
 		},
 		confirmFn() {
+      uni.showLoading({title: "加载中"})
 			let pattern = /^1\d{10}$/;  //验证以1开头11位数
 			if(this.$util.isEmpty(this.form.name)){this.$msg('请输入花店名称');return;}
 			if(!pattern.test(this.form.mobile)){this.$msg('请输入正确的手机号');return;}
@@ -140,7 +141,7 @@ export default {
 				address:this.form.address,
 				debt:this.form.debt?1:0,
 			}).then(res => {
-				this.$msg('添加成功!');
+				uni.hideLoading();
 				uni.setStorageSync('newClient', res.data)
 				setTimeout(() => {
 					// uni.reLaunch({

+ 6 - 2
hdApp/src/admin/recharge/renew.vue

@@ -60,7 +60,7 @@ export default {
       }).catch(err => { console.log(err) })
     },
     _getGhsList() {
-      getList().then(res => {
+      getList({type: '0'}).then(res => {
         console.log(res, 58)
         this.ghsList = res.data.list
       }).catch(err => {})
@@ -168,9 +168,13 @@ export default {
       margin-top: 20upx;
     }
     & > .use_margin {
-      margin-top: 60upx;
+      margin-top: 50upx;
     }
     & > .user_avator {
+      position: absolute;
+      bottom: 20upx;
+      left: 50%;
+      transform: translateX(-50%);
       text-align: center;
       margin-top: 20upx;
       & > image {