|
|
@@ -1,60 +1,75 @@
|
|
|
-<!--姜枫 2021.04.11-->
|
|
|
<template>
|
|
|
+<view class="app-content">
|
|
|
<view class="billing_box_bg">
|
|
|
<view class="input-wrap" >
|
|
|
+ <view style="padding:0upx 0upx 0upx 0upx;margin-right:15upx;" >
|
|
|
+ <button class="admin-button-com middle blue" @click="selectFlowerNumFn()">图片分类</button>
|
|
|
+ </view>
|
|
|
<view class="search-bar">
|
|
|
- <app-search-module v-model="py" placeholder="输入拼音首字母搜索" @input="searchFn" />
|
|
|
+ <app-search-module ref="globalSearchRef" v-model="globalPy" placeholder="这里搜索" @input="globalSearch" />
|
|
|
</view>
|
|
|
- <view style="float:right">
|
|
|
- <button class="admin-button-com middle blue" @click="removeFromSave(0)">清除花材</button>
|
|
|
+ <view style="float:right;margin-left:15upx;">
|
|
|
+ <button class="admin-button-com middle blue" @click="removeFromSave(option.customId)">清空购物车</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="scroll-middle_bx">
|
|
|
|
|
|
+ <button class="admin-button-com middle blue" @click="confirmToSave" style="position: absolute;top:120upx;right:24upx;z-index:99;">选好了</button>
|
|
|
+
|
|
|
+ <view class="scroll-middle_bx">
|
|
|
<scroll-view scroll-y scroll-with-animation class="tab-view">
|
|
|
- <div v-for="(item, index) in globalClassItemList" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
|
|
|
- <text>{{ item.className || "" }}</text>
|
|
|
+ <!--分类-->
|
|
|
+ <div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="globalClassIndex == index ? 'active' : ''" :data-current="index" @tap.stop="globalSwitchClass(index,item)">
|
|
|
+ <text style="text-align: center;">{{ item.name || "" }}</text>
|
|
|
</div>
|
|
|
<view style="height: 120upx"></view>
|
|
|
</scroll-view>
|
|
|
- <scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view"
|
|
|
- scroll-with-animation="true"
|
|
|
- @scroll="scroll_detail"
|
|
|
- lower-threshold="100"
|
|
|
- @scrolltolower="scroll_bottom">
|
|
|
- <block v-if="!$util.isEmpty(globalClassItemList)">
|
|
|
- <view class="item_list_bx selectAll" v-for="(classItem, classIndex) in globalClassItemList" :key="classIndex" :id="`class_${classIndex}`">
|
|
|
- <view class="item_list_title">
|
|
|
- {{ classItem.className }}
|
|
|
+ <scroll-view scroll-y class="right-box" :scroll-top="globalScrollTopPlace" @scroll="globalGetScroll"
|
|
|
+ :scroll-into-view="scroll_into_view" scroll-with-animation="true" lower-threshold="100" @scrolltolower="globalScrollBottom">
|
|
|
+ <!--花材列表-->
|
|
|
+ <block v-if="!$util.isEmpty(globalItemData)">
|
|
|
+ <view class="item_list_bx selectAll">
|
|
|
+ <view v-if="!$util.isEmpty(globalItemData)">
|
|
|
+ <template v-for="(productItem, productIndex) in globalItemData">
|
|
|
+ <view class="item_list_title" v-if="productItem.className && productItem.className!=''">{{ productItem.className }}</view>
|
|
|
+ <view style="height: 175upx" :key="productIndex">
|
|
|
+ <Commondity
|
|
|
+ :selectJobType="selectJobType"
|
|
|
+ :info="productItem"
|
|
|
+ @showAddModelFn="showAddModelFn"
|
|
|
+ @replaceItemFn="replaceItemFn"
|
|
|
+ ></Commondity>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
</view>
|
|
|
- <template v-for="(productItem, productIndex) in classItem.child">
|
|
|
- <view style="height: 160upx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
|
|
|
- <Commondity v-if="classItem.isActive"
|
|
|
- :offVerifyRepertory = 'true'
|
|
|
- :info="productItem"
|
|
|
- :checkStock="true"
|
|
|
- :selectJobType="selectJobType"
|
|
|
- @showAddModelFn="showAddModelFn"
|
|
|
- @replaceItemFn="replaceItemFn"
|
|
|
- ></Commondity>
|
|
|
+ <view v-else>
|
|
|
+ <view style="height:260upx;text-align:center;color:#CCCCCC;position: relative;">
|
|
|
+ <view style="position: absolute;margin:auto;top:130upx;left:0;right:0;bottom:0;">暂无花材</view>
|
|
|
</view>
|
|
|
- </template>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</block>
|
|
|
<block v-else>
|
|
|
- <app-wrapper-empty title="加载中..." :is-empty="$util.isEmpty(globalClassItemList)" />
|
|
|
+ <app-wrapper-empty title="加载中" :is-empty="$util.isEmpty(globalItemData)" />
|
|
|
</block>
|
|
|
</scroll-view>
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
- <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx">
|
|
|
+ <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx" >
|
|
|
<template slot="customContent">
|
|
|
<view class="select-cmd_bx" v-if="customData">
|
|
|
<view class="kc">
|
|
|
- <text class="unit_price">库存 {{ parseFloat(customData.stock) }}</text>
|
|
|
- <text>{{customData.ratio}}{{customData.smallUnit}}/{{customData.bigUnit}}</text>
|
|
|
+ <text>库存 {{ customData.stock?parseFloat(customData.stock):0 }}</text>
|
|
|
+ <text style="margin-left:14upx;">¥{{ parseFloat(customData.price) }}</text>
|
|
|
+ <text style="margin-left:14upx;">{{customData.ratio}}{{customData.smallUnit}}/{{customData.bigUnit}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="num_bx">
|
|
|
+ <input style="width:280upx" v-model="customData.userPrice" @focus="customData.userPrice = null" :class="[Number(customData.cost) > Number(customData.userPrice) ? 'warning-price' : '']"
|
|
|
+ :disabled="false" type="digit" placeholder="单价" />
|
|
|
+ <text style="font-size:35upx;font-weight:bold;color:#666666;">元</text>
|
|
|
</view>
|
|
|
<view class="num_bx">
|
|
|
+
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
<input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" type="number" />
|
|
|
<text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">{{customData.bigUnit}}</text>
|
|
|
@@ -63,45 +78,46 @@
|
|
|
<!-- #endif -->
|
|
|
|
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
|
- <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" :focus="isAddInputFocus" type="number" />
|
|
|
+ <input style="width: 280upx" v-model="customData.bigCount" v-if="globalUnitType == 0" type="number" />
|
|
|
<text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 0">{{customData.bigUnit}}</text>
|
|
|
- <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" :focus="isAddInputFocus" type="number" />
|
|
|
+ <input style="width: 280upx" v-model="customData.smallCount" v-if="globalUnitType == 1" type="number" />
|
|
|
<text style="font-size:35upx;font-weight:bold;color:#666666;" v-if="globalUnitType == 1">{{customData.smallUnit}}</text>
|
|
|
<!-- #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>
|
|
|
-
|
|
|
</view>
|
|
|
<view class="num_bx">
|
|
|
- <input style="width: 280upx" v-model="customData.userPrice" @focus="customData.userPrice = null"
|
|
|
- :disabled="false" type="digit" placeholder="单价" />
|
|
|
- <text style="font-size:35upx;font-weight:bold;color:#666666;">元</text>
|
|
|
+ <input style="width: 280upx;height:40upx;font-size:25upx;" v-model="customData.remark" type="text" placeholder="备注" />
|
|
|
</view>
|
|
|
- <view style="text-align:center;margin-bottom:30upx;font-size:33upx;">¥{{calcPrice}}</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
</modal-module>
|
|
|
|
|
|
- <FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent"></FooterCart>
|
|
|
-
|
|
|
- <sel-popup :show="popupShow" :info="infoData" @close="hidePopup" />
|
|
|
+ <footer-cart :price="allPrice" :count="allCount" @confirm="confirmToSave" ></footer-cart>
|
|
|
|
|
|
+ <uni-popup ref="globalClassImgRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
|
|
|
+ <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
|
|
|
+ <view v-for="(item, index) in globalClassData" :key="index" @tap.stop="globalChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
|
|
|
+ <image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
|
|
|
+ <view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
+</view>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script>
|
|
|
import AppSearchModule from "@/components/module/app-search";
|
|
|
import AppTabs from "@/components/plugin/tabs";
|
|
|
import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
-import Commondity from "@/components/module/app-cg-commodity";
|
|
|
+import Commondity from "./components/cgItem";
|
|
|
import FooterCart from "@/components/module/app-footer-cart";
|
|
|
import ModalModule from "@/components/plugin/modal";
|
|
|
-import SelPopup from "@/components/sel-popup.vue";
|
|
|
import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
-import productMins from "@/mixins/product";
|
|
|
+import productMins from "@/mixins/product2";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
- name: "addCg",
|
|
|
+ name: "index",
|
|
|
components: {
|
|
|
AppTabs,
|
|
|
AppSearchModule,
|
|
|
@@ -109,91 +125,44 @@ export default {
|
|
|
Commondity,
|
|
|
ModalModule,
|
|
|
FooterCart,
|
|
|
- SelPopup
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
data() {
|
|
|
return {
|
|
|
COMMODITY_TYPE,
|
|
|
isSmallCount:false,
|
|
|
- isFocus: false,
|
|
|
- offVerifyRepertory: true,
|
|
|
- customData: {
|
|
|
- bigCount: 0,
|
|
|
- smallCount: 0
|
|
|
- },
|
|
|
- showSubmitModel: false,
|
|
|
- popupShow:false,
|
|
|
- infoData:{},
|
|
|
- selectJobType:'cgItem',
|
|
|
- checkStock:false
|
|
|
+ globalCheckStock:false,
|
|
|
+ autoLoad: false,
|
|
|
+ selectJobType: "cg",
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- calcPrice() {
|
|
|
- if(Number(this.customData.userPrice)>0 && (Number(this.customData.bigCount)>0 || Number(this.customData.smallCount)>0)){
|
|
|
- let num = Number(this.customData.bigCount)>0 ? this.customData.bigCount : this.customData.smallCount
|
|
|
- return parseFloat((this.customData.userPrice*num).toFixed(2))
|
|
|
- }
|
|
|
- return 0
|
|
|
- }
|
|
|
+ ...mapGetters(["getLoginInfo"]),
|
|
|
},
|
|
|
- onLoad(){
|
|
|
- if(this.option.ghsId){
|
|
|
- this.selectJobId = this.option.ghsId
|
|
|
- }
|
|
|
+ onShow() {
|
|
|
+
|
|
|
+ },
|
|
|
+ onLoad () {
|
|
|
+ if(this.option.ghsName){
|
|
|
+ uni.setNavigationBarTitle({ title: this.option.ghsName })
|
|
|
+ }
|
|
|
+ if (this.option.ghsId){
|
|
|
+ this.selectJobId = this.option.ghsId
|
|
|
+ }
|
|
|
+ this.globalRequestType = 'cg'
|
|
|
this.initData()
|
|
|
},
|
|
|
methods: {
|
|
|
- showPopup() {
|
|
|
- this.popupShow = true;
|
|
|
- },
|
|
|
- hidePopup() {
|
|
|
- this.popupShow = false;
|
|
|
- },
|
|
|
- modalCancel() {
|
|
|
- this.isAddModel = false;
|
|
|
- this.customData = {};
|
|
|
- },
|
|
|
- cancelEvent() {
|
|
|
- this.showSubmitModel = false;
|
|
|
+ selectFlowerNumFn(){
|
|
|
+ this.$refs.globalClassImgRef.open('top')
|
|
|
},
|
|
|
- submitEvent(val) {
|
|
|
- if (val.index === 0) {
|
|
|
- this.cancelEvent();
|
|
|
- } else {
|
|
|
- console.log(444, this.selectList);
|
|
|
- uni.navigateTo({
|
|
|
- url: "/admin/billing/affirm"
|
|
|
- });
|
|
|
- this.cancelEvent();
|
|
|
- }
|
|
|
- },
|
|
|
- confirmSelectGoodsEvent() {
|
|
|
- if (this.selectList.length > 0) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/admin/billing/affirmGoods"
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$msg("请选择花材");
|
|
|
- }
|
|
|
- },
|
|
|
- confirmSelectEvent() {
|
|
|
+ confirmToSave() {
|
|
|
if(this.$util.isEmpty(this.selectList)){
|
|
|
this.$msg('请选择花材')
|
|
|
return false
|
|
|
}
|
|
|
- //因历史遗留原因,打开花材页马上点花材出现数量0或null的情况,需要过滤 shish 20210716
|
|
|
- let selectList = this.selectList;
|
|
|
- let list = [];
|
|
|
- for (let i=0;i<selectList.length;i++){
|
|
|
- if(/(^[1-9]\d*$)/.test(selectList[i].bigCount) == false && /(^[1-9]\d*$)/.test(selectList[i].smallCount) == false){
|
|
|
- continue
|
|
|
- }
|
|
|
- list.push(selectList[i])
|
|
|
- }
|
|
|
- if(list.length <= 0){
|
|
|
- this.$msg("请选择花材")
|
|
|
+ if (this.$util.isEmpty(this.option.ghsId)){
|
|
|
+ this.$msg("请选择供货商")
|
|
|
return
|
|
|
}
|
|
|
let ghsName = this.option.ghsName ? this.option.ghsName : '';
|
|
|
@@ -203,16 +172,18 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.billing_box_bg {
|
|
|
+ background: white;
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
.input-wrap {
|
|
|
- padding: 22upx 20upx 22upx 30upx;
|
|
|
+ display: flex;
|
|
|
+ padding: 22upx 20upx 22upx 13upx;
|
|
|
.search-bar {
|
|
|
- display:inline-block;
|
|
|
- width:530upx;
|
|
|
+ flex: 1;
|
|
|
}
|
|
|
}
|
|
|
.scroll-middle_bx {
|
|
|
@@ -223,6 +194,7 @@ export default {
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.tab-view {
|
|
|
+ position: relative;
|
|
|
height: calc(100vh - 140upx);
|
|
|
width: 170upx;
|
|
|
flex-shrink: 0;
|
|
|
@@ -255,14 +227,12 @@ export default {
|
|
|
margin-bottom: 110upx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
.active {
|
|
|
position: relative;
|
|
|
color: $mainColor;
|
|
|
font-size: 26upx;
|
|
|
background: #fff;
|
|
|
}
|
|
|
-
|
|
|
.active::before {
|
|
|
content: "";
|
|
|
position: absolute;
|
|
|
@@ -278,6 +248,7 @@ export default {
|
|
|
}
|
|
|
.item_list_bx {
|
|
|
padding: 40upx 16upx;
|
|
|
+ //padding: 0 16upx;
|
|
|
&:last-child{
|
|
|
margin-bottom: 70upx;
|
|
|
}
|
|
|
@@ -303,7 +274,7 @@ export default {
|
|
|
& .num_bx {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- margin-bottom:30upx;
|
|
|
+ margin-bottom: 40upx;
|
|
|
padding-left:110upx;
|
|
|
& > input {
|
|
|
width: 212upx;
|
|
|
@@ -316,8 +287,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .PxClass-box{
|
|
|
- width: 100%;
|
|
|
- }
|
|
|
+}
|
|
|
+.class-popup-style{
|
|
|
+ z-index:999999;
|
|
|
+}
|
|
|
+.warning-price{
|
|
|
+ color:red;
|
|
|
+ font-weight:bold;
|
|
|
}
|
|
|
</style>
|