Yahoo 4 éve
szülő
commit
0839bedea9

+ 13 - 1
src/api/goods/index.js

@@ -7,6 +7,7 @@ const api = {
   list: '/goods/list',
   listByIds: '/goods/listByIds',
   detail: '/goods/detail',
+  basic: '/goods/basic',
   add: '/goods/add',
   edit: '/goods/edit',
   delete: '/goods/delete',
@@ -36,7 +37,7 @@ export function listByIds (goodsIds, params) {
 }
 
 /**
- * 详情信息
+ * 商品详情(详细信息)
  */
 export function detail (params) {
   return axios({
@@ -46,6 +47,17 @@ export function detail (params) {
   })
 }
 
+/**
+ * 商品详情(基础信息)
+ */
+export function basic (goodsId, params) {
+  return axios({
+    url: api.basic,
+    method: 'get',
+    params: { goodsId, ...params }
+  })
+}
+
 /**
  * 更新状态
  * @param {*} data

+ 1 - 3
src/common/enum/order/OrderSource.js

@@ -5,7 +5,5 @@ import Enum from '../enum'
  * OrderSourceEnum
  */
 export default new Enum([
-  { key: 'MASTER', name: '普通订单', value: 10 },
-  { key: 'BARGAIN', name: '砍价订单', value: 20 },
-  { key: 'SHARP', name: '秒杀订单', value: 30 }
+  { key: 'MASTER', name: '普通订单', value: 10 }
 ])

+ 0 - 10
src/common/enum/setting/sms/Printer.js

@@ -1,10 +0,0 @@
-import Enum from '../../enum'
-
-/**
- * 枚举类:文件上传来源
- * SettingSmsSceneEnum
- */
-export default new Enum([
-  { key: 'CAPTCHA', name: '短信验证码', value: 'captcha' },
-  { key: 'ORDER_PAY', name: '新付款订单', value: 'order_pay' }
-])

+ 1 - 6
src/components/Modal/GoodsModal/GoodsModal.vue

@@ -56,11 +56,6 @@
       <span slot="status" slot-scope="text">
         <a-tag :color="text == 10 ? 'green' : 'red'">{{ text == 10 ? '上架' : '下架' }}</a-tag>
       </span>
-      <!-- 操作 -->
-      <span slot="action" slot-scope="text, item">
-        <a v-action:edit style="margin-right: 8px;" @click="handleEdit(item)">编辑</a>
-        <a v-action:delete @click="handleDelete(item)">删除</a>
-      </span>
     </s-table>
   </a-modal>
 </template>
@@ -164,7 +159,7 @@ export default {
       this.visible = true
       this.$nextTick(() => {
         // 刷新列表数据
-        this.handleRefresh(true)
+        // this.handleRefresh(true)
         // 设置默认数据
         this.setDefaultValue()
       })

+ 1 - 0
src/components/Modal/LinkModal/LinkModal.vue

@@ -196,6 +196,7 @@ export default {
 </script>
 
 <style lang="less" scoped>
+@import '~ant-design-vue/es/style/themes/default.less';
 .ant-modal-root {
   background: #ccc;
   /deep/.ant-modal-body {

+ 17 - 5
src/components/SelectGoods/SelectGoods.vue

@@ -28,6 +28,7 @@
     </a-table>
     <GoodsModal
       ref="GoodsModal"
+      :multiple="multiple"
       :maxNum="maxNum"
       :defaultList="selectedItems"
       @handleSubmit="handleSelectGoodsSubmit"
@@ -62,7 +63,7 @@ const columns = [
   }
 ]
 
-// 图片选择器组件
+// 商品选择器组件
 export default {
   name: 'SelectGoods',
   components: {
@@ -74,6 +75,8 @@ export default {
     event: 'change'
   },
   props: {
+    // 多选模式, 如果false为单选
+    multiple: PropTypes.bool.def(true),
     // 最大选择的数量限制, multiple模式下有效
     maxNum: PropTypes.integer.def(100),
     // 默认选中的商品
@@ -107,8 +110,16 @@ export default {
 
     // 更新数据
     onUpdate (selectedItems) {
-      this.selectedItems = selectedItems
-      this.selectedGoodsIds = selectedItems.map(item => item.goods_id)
+      if (this.multiple || !selectedItems.length) {
+        // 多选模式
+        this.selectedItems = selectedItems
+        this.selectedGoodsIds = selectedItems.map(item => item.goods_id)
+      } else {
+        // 单选模式
+        const single = selectedItems[selectedItems.length - 1]
+        this.selectedItems = [single]
+        this.selectedGoodsIds = [single.goods_id]
+      }
       this.onChange()
     },
 
@@ -132,8 +143,9 @@ export default {
 
     // 触发change事件
     onChange () {
-      const { selectedItems, selectedGoodsIds } = this
-      return this.$emit('change', selectedGoodsIds, selectedItems)
+      const { multiple, selectedGoodsIds } = this
+      const sGoodsIds = multiple ? selectedGoodsIds : (selectedGoodsIds.length ? selectedGoodsIds[0] : undefined)
+      return this.$emit('change', sGoodsIds)
     }
 
   }

+ 4 - 0
src/components/Table/STable.js

@@ -105,6 +105,10 @@ export default {
       Object.assign(this.localPagination, {
         showSizeChanger: val
       })
+    },
+    // 同步正在加载中的状态
+    loading (val) {
+      this.localLoading = val
     }
   },
   created () {

+ 11 - 5
src/core/lazy_use.js

@@ -50,16 +50,18 @@ import {
   Empty,
   Cascader,
   Collapse,
-  Slider
+  Slider,
+  FormModel
 } from 'ant-design-vue'
 import Viser from 'viser-vue'
 
 import Tree from '@/components/tree'
 
 // ext library
-import VueCropper from 'vue-cropper'
+import VueClipboard from 'vue-clipboard2'
 import Dialog from '@/components/Dialog'
-import MultiTab from '@/components/MultiTab'
+// import VueCropper from 'vue-cropper'
+// import MultiTab from '@/components/MultiTab'
 import PageLoading from '@/components/PageLoading'
 import PermissionHelper from '@/utils/helper/permission'
 import './directives/action'
@@ -108,6 +110,7 @@ Vue.use(Descriptions)
 Vue.use(TreeSelect)
 Vue.use(Collapse)
 Vue.use(Slider)
+Vue.use(FormModel)
 
 Vue.prototype.$confirm = Modal.confirm
 Vue.prototype.$message = message
@@ -117,12 +120,15 @@ Vue.prototype.$success = Modal.success
 Vue.prototype.$error = Modal.error
 Vue.prototype.$warning = Modal.warning
 
+VueClipboard.config.autoSetContainer = true
+
 Vue.use(Viser)
 Vue.use(Dialog) // this.$dialog func
-Vue.use(MultiTab)
+// Vue.use(MultiTab)
+// Vue.use(VueCropper)
 Vue.use(PageLoading)
 Vue.use(PermissionHelper)
-Vue.use(VueCropper)
+Vue.use(VueClipboard)
 
 Vue.use(Pagination)
 Vue.use(Empty)

+ 2 - 0
src/layouts/BasicLayout.less

@@ -8,6 +8,8 @@
 
 .ant-pro-global-header-index-right {
   margin-right: 10px;
+  display: flex;
+  justify-content: center;
 
   &.ant-pro-global-header-index-dark {
     .ant-pro-global-header-index-action {

+ 22 - 0
src/layouts/ProLayout/components/RouteMenu/index.less

@@ -1,7 +1,29 @@
+// 菜单栏的背景色
+.ant-menu-dark,
+.ant-menu-dark .ant-menu-sub {
+  background-color: #1F2025;
+}
+
+// 菜单项
+// .ant-menu-dark .ant-menu-item {}
+
+// 菜单文字
+.ant-menu-dark .ant-menu-item>a {
+  color: #F9E4B6 !important;
+  font-size: @font-size-base;
+}
+
+// 菜单图标
 .ant-menu-dark .ant-menu-item .anticon {
   font-size: 16px;
 }
 
+// 选中时的菜单项
+.ant-menu-dark .ant-menu-item-selected {
+  background-color: #101117 !important;
+}
+
+// 选中时的菜单图标
 .ant-menu-dark .ant-menu-item-selected .anticon {
   color: #fff !important;
 }

+ 21 - 5
src/layouts/ProLayout/components/SecondMenu/SecondMenu.jsx

@@ -65,7 +65,7 @@ export default {
           activePath: item.activePath,
           hidden: item.hidden,
           isHasChildren,
-          isHideChildren: false,
+          isHideChildren: item.isHideChildren || false,
           children
         })
       })
@@ -102,14 +102,20 @@ export default {
       if (menuItem.hidden) {
         return null
       }
-      // 激活子菜单的class
+      // 当前菜单的calss
       const itemClass = ['menu-item_title']
-      if (menuItem.isHasChildren && !menuItem.isHideChildren) {
-        itemClass.push('show-children')
+      // 当前页面path
+      const curPath = this.$route.path
+      // 判断是否展开子菜单
+      if (menuItem.isHasChildren) {
+        // 当前path存在children中, 默认展开菜单
+        this.inChildrenPath(curPath, menuItem.children) && (menuItem.isHideChildren = false)
+        // 展开子菜单
+        !menuItem.isHideChildren && itemClass.push('show-children')
       }
       // 其他页面path激活当前项
       if (menuItem.activePath && menuItem.activePath.length) {
-        inArray(this.$route.path, menuItem.activePath) && itemClass.push('router-link-active')
+        inArray(curPath, menuItem.activePath) && itemClass.push('router-link-active')
       }
       const renderTitle = () => {
         return <span>{menuItem.title}</span>
@@ -130,6 +136,16 @@ export default {
       )
     },
 
+    /**
+     * 判断当前path是否存在子菜单path中
+     * @param {string} path 当前页面path
+     * @param {array} children 子菜单数据
+     */
+    inChildrenPath (path, children) {
+      const pathArr = children.map(item => item.path)
+      return inArray(path, pathArr)
+    },
+
     /**
      * 渲染子菜单
      * @param {*} menuItem

+ 6 - 1
src/layouts/ProLayout/components/SiderMenu/index.less

@@ -4,6 +4,9 @@
 
 @nav-header-height: @layout-header-height;
 
+// 把默认的背景色改掉
+@layout-sider-background: #1F2025;
+
 .@{sider-menu-prefix-cls} {
 
   &-logo {
@@ -27,7 +30,8 @@
     }
 
     h1 {
-      color      : @white;
+      // color      : @white;
+      color: #F9E4B6 !important;
       font-size  : 15px;
       font-weight: normal;
       margin     : 0;
@@ -44,6 +48,7 @@
     z-index   : 8;
     min-height: 100vh;
     box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
+    background: @layout-sider-background;
 
     &.fix-sider-bar {
       position  : fixed;

+ 36 - 1
src/utils/util.js

@@ -179,4 +179,39 @@ export function assignment (obj, assignment) {
   Object.keys(assignment).forEach(key => {
     obj[key] = assignment[key]
   })
-}
+}
+
+/**
+ * 对象转URL
+ * @param {object} obj
+ */
+export const urlEncode = (obj = {}) => {
+  const result = []
+  for (const key in obj) {
+    const item = obj[key]
+    if (!item) {
+      continue
+    }
+    if (isArray(item)) {
+      item.forEach(val => {
+        result.push(key + '=' + val)
+      })
+    } else {
+      result.push(key + '=' + item)
+    }
+  }
+  return result.join('&')
+}
+
+/**
+ * 生成url (带参数)
+ * @param {string} path 链接
+ * @param {object} params query参数
+ */
+export function buildUrL (path, params) {
+  const queryStr = urlEncode(params)
+  if (!isEmpty(queryStr)) {
+    return path + '?' + queryStr
+  }
+  return path
+}

+ 27 - 1
src/utils/utils.less

@@ -1,3 +1,4 @@
+
 .textOverflow() {
   overflow: hidden;
   white-space: nowrap;
@@ -209,6 +210,10 @@
   margin-bottom: 20px !important;
 }
 
+.mb-30 {
+  margin-bottom: 30px !important;
+}
+
 .ml-5 {
   margin-left: 5px;
 }
@@ -217,6 +222,10 @@
   margin-left: 10px;
 }
 
+.ml-15 {
+  margin-left: 15px;
+}
+
 .mr-5 {
   margin-right: 5px;
 }
@@ -225,6 +234,10 @@
   margin-right: 10px;
 }
 
+.mr-15 {
+  margin-right: 15px;
+}
+
 .mr-20 {
   margin-right: 20px;
 }
@@ -253,6 +266,10 @@
   color: #7b7b7b !important;
 }
 
+.c-muted-9 {
+  color: #999999 !important;
+}
+
 .c-red {
   color: #f00 !important;
 }
@@ -266,6 +283,10 @@
   font-size: 13px;
 }
 
+.f-14 {
+  font-size: 14px;
+}
+
 .f-w-b {
   font-weight: bold;
 }
@@ -273,4 +294,9 @@
 // 删除线
 .f-through {
   text-decoration: line-through;
-}
+}
+
+// .ant-btn-primary {
+//   background-color: #d6893b;
+//   border-color: transparent;
+// }

+ 13 - 7
src/views/goods/modules/MultiSpec.vue

@@ -10,10 +10,12 @@
           <a-input
             class="group-item-input"
             v-model="item.spec_name"
+            :readOnly="isSpecLocked"
             placeholder="请输入规格名称"
             @change="onChangeSpecGroupIpt"
           />
           <a
+            v-if="!isSpecLocked"
             class="group-item-delete"
             href="javascript:;"
             @click="handleDeleteSpecGroup(index)"
@@ -24,17 +26,19 @@
             <a-input
               class="value-item-input"
               v-model="itm.spec_value"
+              :readOnly="isSpecLocked"
               placeholder="请输入规格值"
               @change="onChangeSpecValueIpt"
             />
             <a-icon
+              v-if="!isSpecLocked"
               class="icon-close"
               theme="filled"
               type="close-circle"
               @click="handleDeleteSpecValue(index, idx)"
             />
           </div>
-          <div class="spec-value-add">
+          <div v-if="!isSpecLocked" class="spec-value-add">
             <a
               class="group-item-delete"
               href="javascript:;"
@@ -45,7 +49,7 @@
       </div>
       <!-- 添加规格按钮 -->
       <a-button
-        v-if="multiSpecData.specList.length < 3"
+        v-if="!isSpecLocked && multiSpecData.specList.length < 3"
         class="spec-group-add-btn"
         icon="plus"
         @click="handleAddSpecGroup"
@@ -142,7 +146,9 @@ export default {
     // 默认的规格列表
     defaultSpecList: PropTypes.array.def([]),
     // 默认的SKU列表
-    defaultSkuList: PropTypes.array.def([])
+    defaultSkuList: PropTypes.array.def([]),
+    // 商品规格是否锁定(锁定状态下不允许编辑规格)
+    isSpecLocked: PropTypes.bool.def(false)
   },
   data () {
     return {
@@ -280,11 +286,11 @@ export default {
   .ant-input {
     height: 28px;
     padding: 4px 11px;
-    font-size: 13px;
+    font-size: @font-size-base;
     line-height: 1.5;
 
     &::placeholder {
-      font-size: 13px;
+      font-size: @font-size-base;
     }
   }
 
@@ -357,7 +363,7 @@ export default {
 
 // 添加规格按钮
 .spec-group-add-btn {
-  font-size: 13px;
+  font-size: @font-size-base;
 }
 
 // 批量设置sku
@@ -367,7 +373,7 @@ export default {
   .title {
     line-height: 28px;
     margin-right: 15px;
-    font-size: 14px;
+    font-size: @font-size-base;
   }
   /deep/.ant-input,
   /deep/.ant-input-number {

+ 5 - 6
src/views/index/Index.vue

@@ -379,7 +379,7 @@ export default {
 </script>
 <style lang="less" scoped>
 .card-title {
-  font-size: 15px;
+  font-size: 14px;
   font-weight: bold;
   margin-bottom: 15px;
 }
@@ -438,7 +438,7 @@ export default {
   .name {
     font-weight: bold;
     margin-bottom: 10px;
-    font-size: 15px;
+    font-size: 13.6px;
   }
 
   .value {
@@ -450,7 +450,6 @@ export default {
 
 // 常用功能
 .functions {
-
   .item {
     display: block;
     padding: 13px 20px;
@@ -461,7 +460,7 @@ export default {
   }
 
   .name {
-    font-size: 14px;
+    font-size: @font-size-base;
     margin-left: 10px;
   }
 
@@ -470,7 +469,7 @@ export default {
     height: 28px;
     // background   : #139dff !important;
     color: #fff;
-    font-size: 14px;
+    font-size: @font-size-base;
     border-radius: 5px;
   }
 }
@@ -504,7 +503,7 @@ export default {
 
   .col-right {
     .name {
-      font-size: 14px;
+      font-size: @font-size-base;
       color: #666;
     }
 

+ 1 - 3
src/views/market/coupon/Create.vue

@@ -177,9 +177,7 @@ export default {
       })
     },
 
-    /**
-    * 提交到后端api
-    */
+    // 提交到后端api
     onFormSubmit (values) {
       this.isLoading = true
       this.isBtnLoading = true

+ 1 - 0
src/views/order/Detail.vue

@@ -399,6 +399,7 @@ export default {
 }
 </script>
 <style lang="less" scoped>
+@import '~ant-design-vue/es/style/themes/default.less';
 // 订单详情页
 .order-content {
   margin-bottom: 70px;

+ 1 - 0
src/views/page/modules/editor/modules/SGoods.vue

@@ -126,6 +126,7 @@ export default {
 </script>
 
 <style lang="less" scoped>
+@import '~ant-design-vue/es/style/themes/default.less';
 // 商品信息
 .data-preview {
   .data-item {

+ 2 - 6
src/views/page/modules/editor/modules/SGoodsCate.vue

@@ -55,12 +55,8 @@ export default {
     getCategoryList () {
       this.isLoading = true
       CategoryModel.getListFromScreen()
-        .then(selectList => {
-          this.categoryListTree = selectList
-        })
-        .finally(result => {
-          this.isLoading = false
-        })
+        .then(selectList => this.categoryListTree = selectList)
+        .finally(result => this.isLoading = false)
     },
 
     // 触发change事件

+ 3 - 2
src/views/page/modules/editor/modules/SImage.vue

@@ -141,8 +141,9 @@ export default {
 
     img {
       width: 100%;
-      height: 100%;
-      object-fit: cover;
+      height: auto;
+      // height: 100%;
+      // object-fit: cover;
       border-radius: 4px;
     }
   }

+ 8 - 30
src/views/page/modules/editor/style.less

@@ -1,3 +1,5 @@
+@import "~ant-design-vue/es/style/themes/default.less";
+
 // 编辑器
 .editor {
   min-width: 370px;
@@ -8,7 +10,7 @@
 
   // 标题
   &-title {
-    font-size: @font-size-base;
+    font-size: 14px;
     font-weight: 600;
     color: #595961;
     margin-top: 5px;
@@ -23,7 +25,7 @@
   // 副标题
   .sub-title {
     text-align: center;
-    font-size: @font-size-base;
+    font-size: 14px;
     color: #9797a1;
     margin-bottom: 15px;
     line-height: 20px;
@@ -53,20 +55,16 @@
 
   .tips-wrap {
     flex: 1;
-    color: #a7a7b1;
+    color: #9797a1;
   }
 
   // 区块
   .block-box {
     border-radius: 4px;
-    padding: 12px 11px;
+    padding: 10px 10px 10px 10px;
     background: #f0f2f5;
     margin: 0 auto 10px;
 
-    &:last-child {
-      margin-bottom: 0;
-    }
-
     &.drag {
       .block-title {
         cursor: move;
@@ -76,14 +74,11 @@
     .block-title {
       line-height: 30px;
       font-weight: 700;
-      font-size: @font-size-base;
+      font-size: 14px;
       margin-bottom: 10px;
       display: flex;
       justify-content: space-between;
 
-      &:last-child {
-        margin-bottom: 0;
-      }
 
       .link,
       .tips {
@@ -105,11 +100,6 @@
       justify-content: space-between;
       margin-bottom: 15px;
 
-      &:last-child {
-        margin-bottom: 0;
-      }
-
-
       .tips {
         margin-top: 5px;
         font-size: 12px;
@@ -139,6 +129,7 @@
 }
 
 // 颜色选择器
+
 .item-colorPicker {
   display: flex;
 
@@ -176,8 +167,6 @@
 
 // 多选框
 .item-checkbox {
-  margin-right: -10px;
-
   .ant-checkbox-wrapper {
     margin: 0 10px 0 0;
     line-height: 28px;
@@ -229,17 +218,6 @@
   }
 }
 
-// 文字描述
-.text-describe {
-  padding: 5px;
-  font-size: @font-size-base;
-  line-height: 25px;
-
-  .empty {
-    height: 10px;
-  }
-}
-
 // 覆盖默认样式
 a {
   user-select: none;