index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div class="wrapper">
  3. <div class="title">新增商品</div>
  4. <el-form class="form" ref="form" :model="form" label-width="80px">
  5. <el-form-item class="single" label="商品名:" label-width="100px">
  6. <el-input class="pr-50" placeholder="请输入" v-model="form.title" maxlength="60" show-word-limit>
  7. </el-input>
  8. </el-form-item>
  9. <el-form-item label="类目:" label-width="100px">
  10. <el-select v-model="form.third_cat_audit" placeholder="请选择" clearable filterable>
  11. <el-option label="申请通过的类目" value="1"></el-option>
  12. <el-option label="无需审核类目" value="0"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="商品ID:" label-width="100px">
  16. <el-input placeholder="请输入" v-model="form.out_product_id" maxlength="25">
  17. </el-input>
  18. </el-form-item>
  19. <el-form-item label="品牌:" label-width="100px">
  20. <el-select v-model="form.has_brand" placeholder="请选择" clearable filterable>
  21. <el-option label="申请通过的品牌" value="1"></el-option>
  22. <el-option label="无品牌" value="0"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="商品库存:" label-width="100px">
  26. <el-input placeholder="请输入" type='number' maxlength="25" v-model="form.stock_num">
  27. </el-input>
  28. </el-form-item>
  29. <el-form-item label="售卖价格:" label-width="100px">
  30. <el-input placeholder="请输入" type='number' maxlength="25" v-model="form.sale_price">
  31. </el-input>
  32. </el-form-item>
  33. <el-form-item label="市场价格:" label-width="100px">
  34. <el-input placeholder="请输入" type='number' maxlength="25" v-model="form.market_price">
  35. </el-input>
  36. </el-form-item>
  37. <el-form-item class="single" label="小程序链接:" label-width="100px">
  38. <el-input class="pr-50" placeholder="请输入" v-model="form.path" maxlength="100">
  39. </el-input>
  40. </el-form-item>
  41. <el-form-item label="一级类目:" v-if="false" label-width="100px">
  42. <el-input placeholder="请输入" maxlength="25">
  43. </el-input>
  44. </el-form-item>
  45. <el-form-item label="二级类目:" v-if="false" label-width="100px">
  46. <el-input placeholder="请输入" maxlength="25">
  47. </el-input>
  48. </el-form-item>
  49. <el-form-item label="三级类目:" v-if="form.has_brand=='0'" label-width="100px">
  50. <el-input placeholder="请输入" maxlength="25" v-model="form.third_cat_id">
  51. </el-input>
  52. </el-form-item>
  53. <el-form-item class="single" label="商品图片:" label-width="100px">
  54. <el-upload :action="uploadUrl" list-type="picture-card" :on-preview="handlePictureCardPreview"
  55. :on-remove="handleRemove">
  56. <i class="el-icon-plus"></i>
  57. </el-upload>
  58. <el-dialog :visible.sync="dialogVisible">
  59. <img width="100%" :src="dialogImageUrl" alt="">
  60. </el-dialog>
  61. </el-form-item>
  62. <el-form-item class="single" label="商品资质图片:" label-width="100px">
  63. <el-upload :action="uploadUrl" list-type="picture-card" :on-preview="handlePictureCardPreview"
  64. :on-remove="handleRemove">
  65. <i class="el-icon-plus"></i>
  66. </el-upload>
  67. <el-dialog :visible.sync="dialogVisible">
  68. <img width="100%" :src="dialogImageUrl" alt="">
  69. </el-dialog>
  70. </el-form-item>
  71. <el-form-item class="commit">
  72. <el-button class="blackbtn" :loading="loading" @click.native.prevent="commit">提交
  73. </el-button>
  74. </el-form-item>
  75. </el-form>
  76. </div>
  77. </template>
  78. <script>
  79. import store from '@/store/index'
  80. export default {
  81. components: {},
  82. props: {},
  83. data() {
  84. return {
  85. uploadUrl: global_config.BASE_URL + 'file/img/upload',
  86. form: {
  87. title: '',
  88. third_cat_audit: '',
  89. out_product_id: '',
  90. has_brand: '',
  91. stock_num: '',
  92. sale_price: '',
  93. market_price: '',
  94. path: '',
  95. third_cat_id: '',
  96. },
  97. loading: false
  98. };
  99. },
  100. watch: {},
  101. computed: {},
  102. methods: {
  103. commit(){
  104. store.commit('REMOVETAB','新增商品')
  105. this.$router.go(-1)
  106. },
  107. handlePictureCardPreview(file) {
  108. this.dialogImageUrl = file.url;
  109. this.dialogVisible = true
  110. }
  111. },
  112. created() {},
  113. mounted() {}
  114. };
  115. </script>
  116. <style lang="less" scoped>
  117. .wrapper {
  118. display: flex;
  119. flex-direction: column;
  120. align-items: center;
  121. .title {
  122. font-weight: bold;
  123. width: 100%;
  124. text-align: left;
  125. margin-left: 100px;
  126. }
  127. .form {
  128. margin-top: 20px;
  129. width: 75%;
  130. display: flex;
  131. justify-content: space-between;
  132. flex-wrap: wrap;
  133. .el-form-item {
  134. color: #232323;
  135. font-weight: bold;
  136. }
  137. .el-select {
  138. width: 300px;
  139. }
  140. .el-input {
  141. width: 300px;
  142. }
  143. .single {
  144. width: 100%;
  145. .el-input {
  146. width: 875px;
  147. }
  148. .el-select {
  149. width: 875px;
  150. }
  151. }
  152. .commit{
  153. width: 100%;
  154. text-align: center;
  155. }
  156. }
  157. }
  158. </style>