|
|
@@ -14,6 +14,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
+ <button class="admin-button-com middle blue" @click="scanCode" style="position: absolute;top:120upx;right:160upx;z-index:99;">扫一扫</button>
|
|
|
<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">
|
|
|
@@ -101,7 +102,48 @@
|
|
|
</template>
|
|
|
</modal-module>
|
|
|
|
|
|
- <footer-cart :price="allPrice" :count="allCount" @confirm="confirmToSave" ></footer-cart>
|
|
|
+ <footer-cart :price="allPrice" :count="allCount" @confirm="confirmToSave" @showCartItem="showCartItem" ></footer-cart>
|
|
|
+
|
|
|
+ <view v-if="cartItemShow == true" style="position: fixed;z-index: 190;top: 0;left: 0;width: 100vw;height: 145vh;background: rgba(0, 0, 0, 0.6);color: #fff;" @click="hideCartItem()">
|
|
|
+ <view style="position: fixed;bottom: 108upx;width:100vw;background-color:white;" @click.stop="">
|
|
|
+ <view class="commodity-view">
|
|
|
+ <view class="summary-bar">
|
|
|
+ <button class="admin-button-com blue middle" style="border:none;" @click.stop="delMemory()">清空购物车</button>
|
|
|
+ <button class="admin-button-com middle blue" @click.stop="scanCode()" style="border:none;padding:22upx 34upx; display:flex; align-items:center;">
|
|
|
+ <view class="btn-content">
|
|
|
+ <text class="btn-text" style="font-size: 28upx;color:#fff;">扫一扫</text>
|
|
|
+ </view>
|
|
|
+ </button>
|
|
|
+ </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="item-info">
|
|
|
+ <view class="info-line">
|
|
|
+ <text class="item-name">{{ item.name }}</text>
|
|
|
+ <text class="item-price">
|
|
|
+ <text class="unit"></text>
|
|
|
+ <text class="price">
|
|
|
+ ¥{{ item.userPrice ? parseFloat(item.userPrice) : 0 }}
|
|
|
+ </text>
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ <view style="text-align:right;">
|
|
|
+ <view class="open-bx" >
|
|
|
+ <i class="iconfont iconjian" @click.stop="delCurrent(item)" v-if="item.bigCount > 0 || item.smallCount > 0"></i>
|
|
|
+ <text class="num" @click.stop="customUpdate(item)">
|
|
|
+ <text v-if="item.bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ item.bigCount }}</text>
|
|
|
+ <text v-if="item.smallCount > 0"><text v-if="item.bigCount > 0">/</text>{{ item.smallCount }}</text>
|
|
|
+ </text>
|
|
|
+ <i class="iconfont iconzeng" @click.stop="addCurrent(item)"></i>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
|
|
|
<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;">
|
|
|
@@ -125,6 +167,7 @@ import ModalModule from "@/components/plugin/modal";
|
|
|
import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
import productMins from "@/mixins/product2";
|
|
|
import { delStatusUpdate } from '@/api/product';
|
|
|
+import { getItemList } from '@/api/item';
|
|
|
import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
@@ -145,6 +188,8 @@ export default {
|
|
|
autoLoad: false,
|
|
|
xjData:{},
|
|
|
xjDataInfo:{},
|
|
|
+ cartItemShow:false,
|
|
|
+ localItemData:[],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -194,6 +239,12 @@ export default {
|
|
|
this.globalRequestType = 'book'
|
|
|
this.initData()
|
|
|
}
|
|
|
+ getItemList({classId: 0,requestType: 'kd',page: 1,search: '',customId: this.option.customId, pageSize: 10000}).then(res => {
|
|
|
+ if(res.code == 1){
|
|
|
+ this.localItemData = res.data.list
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
delProduct(info){
|
|
|
@@ -236,6 +287,83 @@ export default {
|
|
|
let reduceStock = this.option.reduceStock?this.option.reduceStock:0
|
|
|
this.$util.pageTo({ url: '/admin/billing/affirm?customId='+customId+'&customName='+customName+'&orderId='+orderId+'&book='+book+'&reduceStock='+reduceStock+'&fromType=item',type:2})
|
|
|
},
|
|
|
+ showCartItem(){
|
|
|
+ if(this.cartItemShow == true){
|
|
|
+ this.cartItemShow = false
|
|
|
+ }else{
|
|
|
+ if(!this.$util.isEmpty(this.selectList)){
|
|
|
+ this.cartItemShow = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ hideCartItem(){
|
|
|
+ this.cartItemShow = false
|
|
|
+ },
|
|
|
+ delMemory(){
|
|
|
+ this.cartItemShow = false
|
|
|
+ this.removeFromSave(this.option.customId)
|
|
|
+ },
|
|
|
+ addCurrent(info){
|
|
|
+ if(info.$orig){ info = info.$orig }
|
|
|
+ this.replaceItemFn(info, 0, 'add')
|
|
|
+ },
|
|
|
+ delCurrent(info){
|
|
|
+ if(info.$orig){ info = info.$orig }
|
|
|
+ this.replaceItemFn(info, 0, 'sub')
|
|
|
+ },
|
|
|
+ customUpdate(info){
|
|
|
+ if(info.$orig){ info = info.$orig }
|
|
|
+ this.showAddModelFn(info)
|
|
|
+ },
|
|
|
+ scanCode(){
|
|
|
+ uni.scanCode({
|
|
|
+ onlyFromCamera: false,
|
|
|
+ scanType: ['barCode'],
|
|
|
+ success: (res) => {
|
|
|
+ const itemId = res.result
|
|
|
+ let foundItem = null
|
|
|
+ if(!this.$util.isEmpty(this.localItemData)){
|
|
|
+ for (let i = 0; i < this.localItemData.length; i++) {
|
|
|
+ const productItem = this.localItemData[i]
|
|
|
+ if (productItem && productItem.itemId == itemId) {
|
|
|
+ foundItem = productItem
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (foundItem) {
|
|
|
+ if(Number(foundItem.stock) <= 0 && Number(foundItem.bigNum) <= 0 && Number(foundItem.smallNum) <= 0){
|
|
|
+ uni.showToast({title:'没有货了',icon:'none'})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const ratio = Number(foundItem.ratio) || 1
|
|
|
+ const selectItem = this.getSelectItemById(foundItem.id, foundItem.classId)
|
|
|
+ const curBig = selectItem && Number(selectItem.bigCount) > 0 ? Number(selectItem.bigCount) : 0
|
|
|
+ const curSmall = selectItem && Number(selectItem.smallCount) > 0 ? Number(selectItem.smallCount) : 0
|
|
|
+ if (curBig * ratio + curSmall + 1 > Number(foundItem.bigNum) * ratio + Number(foundItem.smallNum)) {
|
|
|
+ this.$msg('库存只剩'+foundItem.bigNum)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ ...foundItem,
|
|
|
+ bigCount: curBig,
|
|
|
+ smallCount: curSmall,
|
|
|
+ userPrice: (selectItem && Number(selectItem.userPrice) > 0) ? Number(selectItem.userPrice) : Number(foundItem.bigPrice) || 0,
|
|
|
+ aboutPrice: selectItem && selectItem.aboutPrice ? selectItem.aboutPrice : 0,
|
|
|
+ totalPrice: selectItem && selectItem.totalPrice ? selectItem.totalPrice : 0,
|
|
|
+ assignSeat: selectItem && selectItem.assignSeat ? selectItem.assignSeat : 1
|
|
|
+ }
|
|
|
+ this.replaceItemFn(params, 0, 'add')
|
|
|
+ this.cartItemShow = true
|
|
|
+ } else {
|
|
|
+ this.$msg('未找到对应商品')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
goHs(){
|
|
|
let customName = this.option.customName ? this.option.customName : '';
|
|
|
let orderId = this.option.orderId ? this.option.orderId : 0
|
|
|
@@ -370,4 +498,78 @@ export default {
|
|
|
color:red;
|
|
|
font-weight:bold;
|
|
|
}
|
|
|
+.commodity-view {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .commodity-list {
|
|
|
+ overflow:scroll;
|
|
|
+ height:60vh;
|
|
|
+ padding: 20upx;
|
|
|
+ .commodity-item {
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 20upx;
|
|
|
+ .item-icon {
|
|
|
+ flex-shrink: 0;
|
|
|
+ width: 140upx;
|
|
|
+ height: 140upx;
|
|
|
+ }
|
|
|
+ .item-info {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ flex: 1;
|
|
|
+ margin-left: 20upx;
|
|
|
+ .info-line {
|
|
|
+ margin-bottom: 20upx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: flex-end;
|
|
|
+ .item-name {
|
|
|
+ color: #333333;
|
|
|
+ font-size: 30upx;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ width:400upx;
|
|
|
+ }
|
|
|
+ .item-price {
|
|
|
+ color: #333;
|
|
|
+ font-size: 22upx;
|
|
|
+ .price {
|
|
|
+ font-size: 32upx;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .open-bx {
|
|
|
+ align-items: center;
|
|
|
+ & .iconfont {
|
|
|
+ color: #3385ff;
|
|
|
+ font-size: 60upx;
|
|
|
+ }
|
|
|
+ & > .num {
|
|
|
+ display: inline-block;
|
|
|
+ width: 130upx;
|
|
|
+ height:55upx;
|
|
|
+ line-height:55upx;
|
|
|
+ text-align:center;
|
|
|
+ margin: 0 8upx;
|
|
|
+ color: #868686;
|
|
|
+ border-radius: 22upx;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ font-size: 28upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .summary-bar {
|
|
|
+ padding: 0 20upx;
|
|
|
+ height: 90upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ border-top: 1px solid #eeeeee;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|