123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
- <seller-base :show="false">
- <view class="div distributor-goods_class-list">
- <view class="div common-header-wrap">
- <view :style="'height:'+navHeight+'px'"></view>
- <view class="common-header-holder"></view>
- <view class="common-header-fixed">
- <title-header />
- <uni-nav-bar title="分类列表" class="common-header" left-icon="back" @clickLeft="goBack">
- </uni-nav-bar>
- </view>
- </view>
- <view class="div pb-30" v-if="goods_class_list.length>0">
- <view class="div" v-for="item in goods_class_list" :key="item.storegc_id">
- <view class="div container mb-5">
- <view class="div bottom-wrapper">
- <view class='storegc_name'>
- <label class="subtitle" :class="{'pl-5':item.deep==2}">
- {{ item.storegc_name }}
- </label>
- </view>
- <view class='button-wrapper'>
- <view class="div edit-wrapper" @click="onEdit(item.storegc_id)">
- <view class="div common-btn btn-2 mr-5">编辑</view>
- </view>
- <view class="div edit-wrapper delete-wrapper" @click="onDelete(item.storegc_id)">
- <view class="div common-btn btn-1">删除</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="div" v-else>
- <empty-record></empty-record>
- </view>
- <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">新增</view></view>
- </view>
- <uni-popup background-color="#fff" ref="confirm" type="dialog">
- <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
- </uni-popup>
- </seller-base>
- </template>
- <script>
- import {getFontSize} from '@/util/common'
- import TitleHeader from '../../TitleHeader'
- import { urlencode } from '@/util/common'
- import SellerBase from '../SellerBase'
- import EmptyRecord from '../../EmptyRecord'
- import { getGoodsClassList, delGoodsClass } from '../../../api/sellerGoodsClass'
- export default {
- components:{
- TitleHeader,
- SellerBase,
- EmptyRecord
- },
- name: 'SellerGoodsClass',
- computed:{
- fontSize(){
- return getFontSize()
- },
- },
- data(){
- return {
- navHeight: 0,
- dialog:{},
- goods_class_list: []
- }
- },
- onShow: function () {
- this.getGoodsClassList()
- },
- mounted(){
- // #ifdef MP-WEIXIN
- this.navHeight = uni.getMenuButtonBoundingClientRect().height
- // #endif
- },
- methods:{
- closeDialog(){
- },
- confirmDialog(value){
- uni.showLoading({ title: '加载中' })
- delGoodsClass(this.dialog.data).then(
- (response) => {
- this.getGoodsClassList()
- uni.hideLoading()
- }, (error) => {
- uni.hideLoading()
- uni.showToast({icon:'none',title: error.message})
- })
- },
- goBack () {
- uni.navigateBack({delta:1})
- },
- goAdd () {
- uni.navigateTo({url:'/pages/seller/goodsclass/GoodsClassForm'+'?'+urlencode({ action: 'add' })})
- },
- onEdit (storegc_id) {
- uni.navigateTo({url:'/pages/seller/goodsclass/GoodsClassForm'+'?'+urlencode({ storegc_id: storegc_id })})
- },
- onDelete (storegc_id) {
- this.dialog={content:'确定要删除该分类吗?',data:storegc_id}
- this.$refs.confirm.open()
- },
- getGoodsClassList () {
- getGoodsClassList().then(res => {
- this.goods_class_list = res.result.goods_class
- }).catch(function (error) {
- uni.showToast({icon:'none',title: error.message})
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .distributor-goods_class-list {
- .common-header{
- .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
- }
- .btn-1{border:1px solid $primaryColor;color:$primaryColor;min-width: 2rem}
- .btn-2{border:1px solid #333;color:#333;min-width: 2rem}
- .container {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: stretch;
- background-color: #fff;
- }
- .top-wrapper {
- position: relative;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: stretch;
- }
- .title-wrapper {
- height: 1rem;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- margin-top: 0.5rem;
- margin-left: 0.5rem;
- }
- .title {
- font-size:$h2;
- color: #333;
- margin-left: 0.5rem;
- }
- .default {
- width: 1.4rem;
- margin-left: 0.5rem;
- margin-right: 0.5rem;
- border: 1px solid $primaryColor;
- color: $primaryColor;
- font-size:$h6;
- text-align: center;
- border-radius: 0.1rem;
- }
- .desc {
- color: #7c7f88;
- font-size:$subFontSize;
- }
- .goods_class-text {
- margin-top: 0.5rem;
- margin-bottom: 0.5rem;
- margin-left: 1rem;
- margin-right: 0.5rem;
- }
- .bottom-line {
- position: absolute;
- height: 1px;
- left: 0.5rem;
- bottom:0;
- right: 0.5rem;
- background-color: #e8eaed;
- }
- .bottom-wrapper {
- padding: .5rem 1rem 1.5rem;
- box-sizing: border-box;
- }
- .storegc_name{
- margin-bottom: 1rem;
- }
- .button-wrapper{
- display: flex;
- justify-content: flex-end;
- }
- .edit-wrapper {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- .delete-wrapper {
- margin-right: 0.5rem;
- }
- .indicator {
- width: 0.95rem;
- height: 0.95rem;
- margin-left: 0.75rem;
- margin-right: 0.5rem;
- }
- .icon {
- width: 0.9rem;
- height: 0.9rem;
- margin-left: 0.5rem;
- }
- .subtitle {
- font-size:.8rem;
- color: #333;
- }
- .subtitle .i{font-size:$h2;margin-right:.5rem;}
- }
- </style>
|