GoodsClassList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false">
  3. <view class="div distributor-goods_class-list">
  4. <view class="div common-header-wrap">
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="分类列表" class="common-header" left-icon="back" @clickLeft="goBack">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="div pb-30" v-if="goods_class_list.length>0">
  14. <view class="div" v-for="item in goods_class_list" :key="item.storegc_id">
  15. <view class="div container mb-5">
  16. <view class="div bottom-wrapper">
  17. <view class='storegc_name'>
  18. <label class="subtitle" :class="{'pl-5':item.deep==2}">
  19. {{ item.storegc_name }}
  20. </label>
  21. </view>
  22. <view class='button-wrapper'>
  23. <view class="div edit-wrapper" @click="onEdit(item.storegc_id)">
  24. <view class="div common-btn btn-2 mr-5">编辑</view>
  25. </view>
  26. <view class="div edit-wrapper delete-wrapper" @click="onDelete(item.storegc_id)">
  27. <view class="div common-btn btn-1">删除</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="div" v-else>
  35. <empty-record></empty-record>
  36. </view>
  37. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">新增</view></view>
  38. </view>
  39. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  40. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  41. </uni-popup>
  42. </seller-base>
  43. </template>
  44. <script>
  45. import {getFontSize} from '@/util/common'
  46. import TitleHeader from '../../TitleHeader'
  47. import { urlencode } from '@/util/common'
  48. import SellerBase from '../SellerBase'
  49. import EmptyRecord from '../../EmptyRecord'
  50. import { getGoodsClassList, delGoodsClass } from '../../../api/sellerGoodsClass'
  51. export default {
  52. components:{
  53. TitleHeader,
  54. SellerBase,
  55. EmptyRecord
  56. },
  57. name: 'SellerGoodsClass',
  58. computed:{
  59. fontSize(){
  60. return getFontSize()
  61. },
  62. },
  63. data(){
  64. return {
  65. navHeight: 0,
  66. dialog:{},
  67. goods_class_list: []
  68. }
  69. },
  70. onShow: function () {
  71. this.getGoodsClassList()
  72. },
  73. mounted(){
  74. // #ifdef MP-WEIXIN
  75. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  76. // #endif
  77. },
  78. methods:{
  79. closeDialog(){
  80. },
  81. confirmDialog(value){
  82. uni.showLoading({ title: '加载中' })
  83. delGoodsClass(this.dialog.data).then(
  84. (response) => {
  85. this.getGoodsClassList()
  86. uni.hideLoading()
  87. }, (error) => {
  88. uni.hideLoading()
  89. uni.showToast({icon:'none',title: error.message})
  90. })
  91. },
  92. goBack () {
  93. uni.navigateBack({delta:1})
  94. },
  95. goAdd () {
  96. uni.navigateTo({url:'/pages/seller/goodsclass/GoodsClassForm'+'?'+urlencode({ action: 'add' })})
  97. },
  98. onEdit (storegc_id) {
  99. uni.navigateTo({url:'/pages/seller/goodsclass/GoodsClassForm'+'?'+urlencode({ storegc_id: storegc_id })})
  100. },
  101. onDelete (storegc_id) {
  102. this.dialog={content:'确定要删除该分类吗?',data:storegc_id}
  103. this.$refs.confirm.open()
  104. },
  105. getGoodsClassList () {
  106. getGoodsClassList().then(res => {
  107. this.goods_class_list = res.result.goods_class
  108. }).catch(function (error) {
  109. uni.showToast({icon:'none',title: error.message})
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .distributor-goods_class-list {
  117. .common-header{
  118. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  119. }
  120. .btn-1{border:1px solid $primaryColor;color:$primaryColor;min-width: 2rem}
  121. .btn-2{border:1px solid #333;color:#333;min-width: 2rem}
  122. .container {
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: flex-start;
  126. align-items: stretch;
  127. background-color: #fff;
  128. }
  129. .top-wrapper {
  130. position: relative;
  131. flex: 1;
  132. display: flex;
  133. flex-direction: column;
  134. justify-content: flex-start;
  135. align-items: stretch;
  136. }
  137. .title-wrapper {
  138. height: 1rem;
  139. display: flex;
  140. flex-direction: row;
  141. justify-content: flex-start;
  142. align-items: center;
  143. margin-top: 0.5rem;
  144. margin-left: 0.5rem;
  145. }
  146. .title {
  147. font-size:$h2;
  148. color: #333;
  149. margin-left: 0.5rem;
  150. }
  151. .default {
  152. width: 1.4rem;
  153. margin-left: 0.5rem;
  154. margin-right: 0.5rem;
  155. border: 1px solid $primaryColor;
  156. color: $primaryColor;
  157. font-size:$h6;
  158. text-align: center;
  159. border-radius: 0.1rem;
  160. }
  161. .desc {
  162. color: #7c7f88;
  163. font-size:$subFontSize;
  164. }
  165. .goods_class-text {
  166. margin-top: 0.5rem;
  167. margin-bottom: 0.5rem;
  168. margin-left: 1rem;
  169. margin-right: 0.5rem;
  170. }
  171. .bottom-line {
  172. position: absolute;
  173. height: 1px;
  174. left: 0.5rem;
  175. bottom:0;
  176. right: 0.5rem;
  177. background-color: #e8eaed;
  178. }
  179. .bottom-wrapper {
  180. padding: .5rem 1rem 1.5rem;
  181. box-sizing: border-box;
  182. }
  183. .storegc_name{
  184. margin-bottom: 1rem;
  185. }
  186. .button-wrapper{
  187. display: flex;
  188. justify-content: flex-end;
  189. }
  190. .edit-wrapper {
  191. display: flex;
  192. flex-direction: row;
  193. justify-content: flex-start;
  194. align-items: center;
  195. }
  196. .delete-wrapper {
  197. margin-right: 0.5rem;
  198. }
  199. .indicator {
  200. width: 0.95rem;
  201. height: 0.95rem;
  202. margin-left: 0.75rem;
  203. margin-right: 0.5rem;
  204. }
  205. .icon {
  206. width: 0.9rem;
  207. height: 0.9rem;
  208. margin-left: 0.5rem;
  209. }
  210. .subtitle {
  211. font-size:.8rem;
  212. color: #333;
  213. }
  214. .subtitle .i{font-size:$h2;margin-right:.5rem;}
  215. }
  216. </style>