|
|
@@ -0,0 +1,286 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content">
|
|
|
+
|
|
|
+ <view class="input-wrap" >
|
|
|
+ <view class="search-bar">
|
|
|
+ <app-search-module v-model="py" placeholder="输入英文字母搜索" @input="searchFn" />
|
|
|
+ </view>
|
|
|
+ <view style="float:right">
|
|
|
+ <button class="admin-button-com middle blue" style="margin-right:10upx;" @click="clearSelect()">清除已选</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="app-middle">
|
|
|
+ <scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
|
|
|
+ <view v-for="(item,index) in tabbar" :key="index" class="tab-bar-item" :class="[currentTab==index ? 'active' : '']" :data-current="index" @tap.stop="swichTab($event ,item)" >
|
|
|
+ <text>{{item.categoryName || ''}}</text>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ <block v-for="(item,index) in tabbar" :key="index">
|
|
|
+ <scroll-view scroll-y class="right-box" v-if="currentTab==index" @scrolltolower="goBottom">
|
|
|
+ <block v-if="!$util.isEmpty(list.data)">
|
|
|
+ <view class="page-view">
|
|
|
+ <view class="goods-list" v-for="(goodsItem, idx) in list.data" :key="idx">
|
|
|
+
|
|
|
+ <flowerItem :goodsInfo="goodsItem" @showAddModelFn="showAddModelFn" @replaceItemFn="replaceItemFn"></flowerItem>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
|
|
|
+ </block>
|
|
|
+ </scroll-view>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <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">
|
|
|
+ <view class="kc"><text class="unit_price">库存 {{ customData.stock }}</text></view>
|
|
|
+ </view>
|
|
|
+ <view class="select-cmd_bx">
|
|
|
+ <view class="num_bx">
|
|
|
+ <text style="font-size:35upx;font-weight:bold;color:#666666;margin-right:20upx;">数量</text>
|
|
|
+ <input style="width: 430upx" v-model="customData.bigCount" @focus="customData.bigCount=''" :focus="isAddInputFocus" type="number" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </modal-module>
|
|
|
+
|
|
|
+ <FooterCart :price="allPrice" :count="allCount" @confirm="confirmToSave" :showPrice="false" ></FooterCart>
|
|
|
+
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import AppSearchModule from "@/components/module/app-search";
|
|
|
+import OperateModule from "@/admin/home/components/module/operate";
|
|
|
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
+import ModalModule from "@/components/plugin/modal";
|
|
|
+import flowerItem from "./components/flower-item";
|
|
|
+import {categoryListB,getCategoryGoodsB,changeStatusB} from "@/api/goods";
|
|
|
+import FooterCart from "@/components/module/app-footer-cg-plant-cart";
|
|
|
+import { list } from "@/mixins";
|
|
|
+import productMins from "@/mixins/cgPlantProduct";
|
|
|
+export default {
|
|
|
+ name: "flower",
|
|
|
+ components: {
|
|
|
+ OperateModule,
|
|
|
+ AppWrapperEmpty,
|
|
|
+ ModalModule,
|
|
|
+ AppSearchModule,
|
|
|
+ flowerItem,
|
|
|
+ FooterCart
|
|
|
+ },
|
|
|
+ mixins: [list,productMins],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ selectJobType: "flower",
|
|
|
+ tabbar: [],
|
|
|
+ height: 0,
|
|
|
+ currentTab: 0,
|
|
|
+ scrollTop: 0,
|
|
|
+ form: {
|
|
|
+ catId: ""
|
|
|
+ },
|
|
|
+ delModal: false,
|
|
|
+ operateData: {},
|
|
|
+ operateShow: false,
|
|
|
+ operateIndex: null,
|
|
|
+ operateTop: 0,
|
|
|
+ checkStock:false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ onLoad: function() {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ clearSelect(){
|
|
|
+ let that = this
|
|
|
+ that.$util.confirmModal({content:'确认清除?'},() => {
|
|
|
+ that.removeFromSaveDirect()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirmToSave(){
|
|
|
+ if (this.$util.isEmpty(this.selectList)){
|
|
|
+ this.$msg('请选择商品')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.$util.pageTo({url:"/admin/goodsManage/flowerConfirm",type:2})
|
|
|
+ },
|
|
|
+ goBottom(){
|
|
|
+ if (!this.list.finished) {
|
|
|
+ this.getPlantList().then((res) => {
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ newCg(){
|
|
|
+ this.$util.pageTo({url:"/admin/goodsManage/cgNewPlant",type:2})
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ this.getPlantClass()
|
|
|
+ },
|
|
|
+ getPlantClass() {
|
|
|
+ categoryListB({flower:1}).then(res => {
|
|
|
+ this.tabbar = res.data;
|
|
|
+ if(this.tabbar && this.tabbar[0] && this.tabbar[0].id){
|
|
|
+ this.form.catId = this.tabbar[0].id
|
|
|
+ this.getPlantList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getPlantList() {
|
|
|
+ return getCategoryGoodsB({status:1,page:this.list.page,...this.form,flower:1}).then(res => {
|
|
|
+ this.completes(res)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ swichTab(e, item) {
|
|
|
+ let cur = e.currentTarget.dataset.current;
|
|
|
+ if (this.currentTab == cur) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ this.currentTab = cur;
|
|
|
+ this.form.catId = item.id;
|
|
|
+ this.resetList();
|
|
|
+ this.getPlantList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeStatus(item) {
|
|
|
+ let status = item.status == 0 ? 1 : 0
|
|
|
+ changeStatusB({id: item.id,status: status}).then(res => {
|
|
|
+ if(res.code == 1){
|
|
|
+ this.$msg("修改成功")
|
|
|
+ item.status = status
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.app-content {
|
|
|
+ min-height: calc(100vh - 80upx);
|
|
|
+ background-color: #fff;
|
|
|
+}
|
|
|
+page {
|
|
|
+ background: #fff;
|
|
|
+}
|
|
|
+::-webkit-scrollbar {
|
|
|
+ width: 0;
|
|
|
+ height: 0;
|
|
|
+ color: transparent;
|
|
|
+}
|
|
|
+.tab-view {
|
|
|
+ height: 100vh;
|
|
|
+ width: 200upx;
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ z-index: 10;
|
|
|
+ background-color: #f0f2f6;
|
|
|
+ .tab-bar-item {
|
|
|
+ width: 200upx;
|
|
|
+ height: 110upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #444;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ position: relative;
|
|
|
+ color: $mainColor;
|
|
|
+ font-size: 26upx;
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+ .active::before {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ border-left: 8upx solid $mainColor;
|
|
|
+ height: 100%;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.right-box {
|
|
|
+ width: 100%;
|
|
|
+ height:100vh;
|
|
|
+ position:fixed;
|
|
|
+ padding-left:220upx;
|
|
|
+ padding-bottom:200upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ left: 0;
|
|
|
+ .page-view {
|
|
|
+ width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-bottom: env(safe-area-inset-bottom);
|
|
|
+ .goods-list {
|
|
|
+ margin: 40upx 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.app-footer {
|
|
|
+ justify-content: space-between;
|
|
|
+ .btn-list {
|
|
|
+ width: 100%;
|
|
|
+ &:first-child {
|
|
|
+ border-left: 0;
|
|
|
+ }
|
|
|
+ .admin-button-com {
|
|
|
+ width: 160upx;
|
|
|
+ padding-top: 16upx;
|
|
|
+ padding-bottom: 16upx;
|
|
|
+ float:right;
|
|
|
+ margin-right:30upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .other-btn {
|
|
|
+ color: $fontColor2;
|
|
|
+ .iconfont {
|
|
|
+ font-size: 24upx;
|
|
|
+ color: $fontColor3;
|
|
|
+ transform: scale(0.4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.input-wrap {
|
|
|
+ padding: 22upx 20upx 22upx 30upx;
|
|
|
+ .search-bar {
|
|
|
+ display:inline-block;
|
|
|
+ width:520upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+.select-cmd_bx {
|
|
|
+ & .kc {
|
|
|
+ color: #999999;
|
|
|
+ font-size: 28upx;
|
|
|
+ font-weight: 400;
|
|
|
+ margin-bottom: 40upx;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 30upx;
|
|
|
+ .unit_price{
|
|
|
+ padding-right:25upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ & .num_bx {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 40upx;
|
|
|
+ & > input {
|
|
|
+ width: 212upx;
|
|
|
+ height: 80upx;
|
|
|
+ border: 1upx solid #dddddd;
|
|
|
+ border-radius: 4upx;
|
|
|
+ text-align: center;
|
|
|
+ margin-right: 24upx;
|
|
|
+ font-size: 40upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|