Преглед изворни кода

Merge commit 'ccbd7f8215bfe11528573f5f52e6160777f746ff' into HEAD

gitadmin пре 8 месеци
родитељ
комит
6935ecb3cb

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1726294760337
+  "version": 1728723855804
 }

+ 5 - 11
src/api/shopPromo.js

@@ -11,18 +11,12 @@ export const shopPromoList = (params) => {
     method: 'post'
   })
 }
-// 促销活动 关闭
-export const closeActive = (params) => {
+// 促销活动 开启 关闭
+export const openOrCloseActive = (params) => {
   return axios({
-    url: `/promoActive/closeActive/${params.sn}`,
-    method: 'get'
-  })
-}
-// 促销活动 开启
-export const publishActive = (params) => {
-  return axios({
-    url: `/promoActive/publishActive/${params.sn}`,
-    method: 'get'
+    url: '/shopPromo/updateDealerOpenState',
+    data: params,
+    method: 'post'
   })
 }
 

+ 16 - 0
src/api/shopPromoProduct.js

@@ -0,0 +1,16 @@
+import { axios } from '@/utils/request'
+
+// 促销活动  有分页
+export const shopPromoProductList = (params) => {
+  const url = `/shopPromoProduct/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}

+ 10 - 0
src/components/Select/index.js

@@ -25,6 +25,12 @@ export default {
     isEnable: { // 是否只获取已启用的数据
       type: Boolean,
       default: true
+    },
+    notIn: {
+      type: Array,
+      default: function () {
+        return []
+      }
     }
   }),
   created () {
@@ -33,6 +39,10 @@ export default {
     const data = allLookup.find(item => item.code == _this.code)
     // 判断是否是省仓用户
     _this.dataList = _this.$store.state.user.dealerSupplierFlag == '1' ? data.itemList : data.itemList.filter(item => item.dispName != '省级批发价')
+    // 判断是否不显示指定选项
+    if (_this.notIn) {
+      _this.dataList = _this.dataList.filter(item => _this.notIn.indexOf(item.code) < 0)
+    }
     setTimeout(() => {
       _this.$emit('loadDataFinish', _this.dataList)
     }, 100)

+ 30 - 5
src/config/router.config.js

@@ -3352,7 +3352,7 @@ export const asyncRouterMap = [
               {
                 path: 'list',
                 name: 'promotionInfoList',
-                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/promotionInfo/list.vue'),
+                component: () => import(/* webpackChunkName: "promotionManagement" */ '@/views/promotionManagement/promotionInfo/list.vue'),
                 meta: {
                   title: '促销活动列表',
                   icon: 'contacts',
@@ -3363,7 +3363,7 @@ export const asyncRouterMap = [
               {
                 path: 'edit/:sn/:pageType',
                 name: 'promotionInfoEdit',
-                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/promotionInfo/edit.vue'),
+                component: () => import(/* webpackChunkName: "promotionManagement" */ '@/views/promotionManagement/promotionInfo/edit.vue'),
                 meta: {
                   title: '编辑促销',
                   icon: 'contacts',
@@ -3373,6 +3373,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/promotionManagement/promotionalProducts',
+            redirect: '/promotionManagement/promotionalProducts/list',
+            name: 'promotionalProducts',
+            component: BlankLayout,
+            meta: {
+              title: '促销产品',
+              icon: 'contacts',
+              permission: 'M_promotionalProduct'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'promotionalProductsList',
+                component: () => import(/* webpackChunkName: "promotionManagement" */ '@/views/promotionManagement/promotionalProducts/list.vue'),
+                meta: {
+                  title: '促销产品列表',
+                  icon: 'contacts',
+                  hidden: true,
+                  permission: 'M_promotionalProductList'
+                }
+              }
+            ]
+          },
           {
             path: '/promotionManagement/couponDetails',
             redirect: '/promotionManagement/couponDetails/list',
@@ -3388,7 +3413,7 @@ export const asyncRouterMap = [
               {
                 path: 'list',
                 name: 'couponDetailsList',
-                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/couponDetails/list.vue'),
+                component: () => import(/* webpackChunkName: "promotionManagement" */ '@/views/promotionManagement/couponDetails/list.vue'),
                 meta: {
                   title: '优惠券详情',
                   icon: 'contacts',
@@ -3426,7 +3451,7 @@ export const asyncRouterMap = [
               {
                 path: 'list',
                 name: 'storeManagementBindList',
-                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/storeManagement/bind/list.vue'),
+                component: () => import(/* webpackChunkName: "storeManagement" */ '@/views/storeManagement/bind/list.vue'),
                 meta: {
                   title: '中心店/配送店绑定列表',
                   icon: 'link',
@@ -3451,7 +3476,7 @@ export const asyncRouterMap = [
               {
                 path: 'list',
                 name: 'storeManagementUserAuthList',
-                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/storeManagement/userAuthorization/list.vue'),
+                component: () => import(/* webpackChunkName: "storeManagement" */ '@/views/storeManagement/userAuthorization/list.vue'),
                 meta: {
                   title: '中心店用户授权列表',
                   icon: 'link',

+ 12 - 11
src/views/promotionManagement/promotionInfo/list.vue

@@ -68,21 +68,21 @@
           <span v-else>--</span>
         </template>
         <!-- 操作 -->
-        <!-- state  PUBLISH 已开启 END 已结束 CLOSE 已关闭 UNPUBLISH 未开启 -->
+        <!-- state  HAVE_RELEASE 已开启 IS_OVER已结束 IS_CLOSE 已关闭 NOT_RELEASE 未开启 -->
         <template slot="action" slot-scope="text, record">
           <a-button
             size="small"
             type="link"
             class="button-primary"
-            @click="handleOpen(record)"
-            v-if="record.dealerEditFlag==='1'&&(record.dealerPublishState=='UNPUBLISH'||record.dealerPublishState=='CLOSE')&&$hasPermissions('B_publishActiveBtn')"
+            @click="handleOpenOrClose(record,'1')"
+            v-if="record.dealerOpenFlag==='1'&&record.dealerOpenState=='0'&&(record.promoState=='IS_CLOSE'||record.promoState=='NOT_RELEASE')&&$hasPermissions('B_publishActiveBtn')"
             id="productOnlineInfoList-detail-btn">开启</a-button>
           <a-button
             size="small"
             type="link"
             class="button-primary"
-            v-if="record.dealerEditFlag==='1'&&record.dealerPublishState=='PUBLISH'&&$hasPermissions('B_closeActiveBtn')"
-            @click="handleClose(record)"
+            v-if="record.dealerOpenFlag==='1'&&record.dealerOpenState=='1'&&record.promoState=='HAVE_RELEASE'&&$hasPermissions('B_closeActiveBtn')"
+            @click="handleOpenOrClose(record,'0')"
             id="productOnlineInfoList-detail-btn">关闭</a-button>
           <a-button
             size="small"
@@ -113,8 +113,8 @@ import rangeDate from '@/views/common/rangeDate.vue'
 import promotionDescModal from './promotionDescModal'
 import promotionShowModal from './promotionShowModal'
 import detailModal from './detailModal'
-import { shopPromoList } from '@/api/shopPromo'
-import { closeActive, publishActive } from '@/api/promoActive'
+import { shopPromoList, openOrCloseActive } from '@/api/shopPromo'
+import { closeActive } from '@/api/promoActive'
 
 export default {
   name: 'UrgentOffsetList',
@@ -135,6 +135,7 @@ export default {
         promoState: undefined// 促销状态
       },
       descInfo: '', // 促销描述
+      itemId: null, // 促销当前行sn
       disabled: false, //  查询、重置按钮是否可操作
       openDetailModal: false,
       columns: [
@@ -201,15 +202,15 @@ export default {
       })
     },
     // 开启
-    handleOpen (row) {
+    handleOpenOrClose (row, val) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '促销活动一旦开启,客户可参与活动。确认开启吗?',
+        content: '促销活动一旦' + (val == '1' ? '开启' : '关闭') + ',客户' + (val == '1' ? '' : '无法') + '参与活动。确认' + (val == '1' ? '开启' : '关闭') + '吗?',
         centered: true,
         onOk () {
           _this.spinning = true
-          publishActive({ sn: row.promoActiveSn }).then(res => {
+          openOrCloseActive({ promoSn: row.promoSn, dealerOpenState: val }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -226,7 +227,7 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '促销活动一旦关闭,客户无法参与活动。确认关闭吗?',
+        content: '促销活动一旦,客户无法参与活动。确认关闭吗?',
         centered: true,
         onOk () {
           _this.spinning = true

+ 312 - 0
src/views/promotionManagement/promotionalProducts/list.vue

@@ -0,0 +1,312 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="promoProducts-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" id="promoProducts-form" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品编码/原厂编码">
+                <a-input id="promoProducts-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码/原厂编码"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品名称">
+                <a-input id="promoProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="品牌">
+                <productBrand id="promoProducts-productBrandSn" v-model="queryParam.productBrandSn"></productBrand>
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品分类">
+                  <productType id="promoProducts-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></productType>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销名称">
+                  <a-input id="promoProducts-promoName" v-model.trim="queryParam.promoName" allowClear placeholder="请输入促销名称"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销类型">
+                  <v-select
+                    v-model="queryParam.promoType"
+                    ref="promotionType"
+                    id="promoProducts-promoType"
+                    code="SHOP_PROMO_PROMO_TYPE"
+                    placeholder="请选择促销类型"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销状态">
+                  <v-select
+                    v-model="queryParam.promoState"
+                    ref="promoState"
+                    :notIn="['IS_OVER']"
+                    id="promoProducts-promoState"
+                    code="SHOP_PROMO_PROMO_STATE"
+                    placeholder="请选择促销状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="商城类目">
+                  <a-cascader
+                    id="promoProducts-category"
+                    expandTrigger="hover"
+                    :changeOnSelect="true"
+                    :fieldNames="fieldNames"
+                    :options="categoryOptions"
+                    placeholder="请选择商城类目"
+                    @change="changeProductsCategory"
+                    allowClear
+                    v-model="category"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品商城状态">
+                  <v-select code="SHOP_PRODUCT_STATUS" id="promoProducts-status" v-model="queryParam.shopProductStatus" allowClear placeholder="请选择产品商城状态"></v-select>
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promoProducts-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promoProducts-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px" id="merchantInfoManagementList-advanced">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="20"
+          :scroll="{ y: tableHeight - 20 }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 产品编码 -->
+          <template slot="productCode" slot-scope="text, record">
+            {{ record.productCode }}
+          </template>
+          <!-- 产品分类 -->
+          <template slot="productType" slot-scope="text, record">
+            <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 促销时间 -->
+          <template slot="promoTime" slot-scope="text, record">
+            <span v-if="record.promoStartDate">{{ record.promoStartDate }} 至 {{ record.promoEndDate }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 活动规则 -->
+          <template slot="promoRules" slot-scope="text, record">
+            <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.conditionValue&&record.resultValue">买{{ record.conditionValue }}赠{{ record.resultValue }}</span>
+            <div v-else-if="record.promoType==='PROMO_PROD'&&(record.shopProductPrice||record.shopProductPrice ==0)&&(record.conditionValue||record.conditionValue==0)">
+              <span>优惠{{ (record.shopProductPrice - record.conditionValue).toFixed(2) }}元</span>
+            </div>
+            <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.resultValue">返{{ record.resultValue ? record.resultValue.toFixed(2):'--' }}元</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 促销售价 -->
+          <template slot="promoPrice" slot-scope="text, record">
+            <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.shopProductPrice">{{ record.shopProductPrice ?record.shopProductPrice.toFixed(2):'--' }}</span>
+            <span v-else-if="record.promoType==='PROMO_PROD'&&record.conditionValue">{{ record.conditionValue?record.conditionValue.toFixed(2):'--' }}</span>
+            <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.shopProductPrice">{{ record.shopProductPrice?record.shopProductPrice.toFixed(2):'--' }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 商城类目 -->
+          <template slot="categoryName" slot-scope="text, record">
+            <span v-if="record.indName || record.dirName">{{ record.indName }} {{ (record.indName&&record.dirName) ? '>' : '' }} {{ record.dirName }}</span>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </a-spin>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable, VSelect } from '@/components'
+import productType from '@/views/common/productType.js'
+import productBrand from '@/views/common/productBrand.js'
+// 接口
+import { shopPromoProductList } from '@/api/shopPromoProduct'
+import { queryExtList } from '@/api/shopProduct'
+export default {
+  name: 'PromoProductsList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, productType, productBrand },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      disabled: false, //  查询、重置按钮是否可操作
+      tableHeight: 0, // 表格高度
+      // form表单label布局
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      productType: [], // 产品分类
+      // 查询条件
+      queryParam: {
+        productName: '', // 产品名称
+        productCode: '', // 产品编码/原厂编码
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        promoName: '', // 促销名称
+        promoType: undefined, // 促销状态
+        promoState: undefined, // 促销状态
+        categorySn: undefined, // 商城类目
+        shopProductStatus: undefined, // 商城状态
+        shopProductDelFlag: 0, // 促销产品标志
+        promoStateList: ['NOT_RELEASE', 'HAVE_RELEASE', 'IS_CLOSE']// 促销列表只查询这两种状态
+      },
+      categoryOptions: [], // 产品类目列表
+      fieldNames: { label: 'categoryName', value: 'categorySn', children: 'shopCategoryList' },
+      category: [], // 类目val
+      columns: [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', scopedSlots: { customRender: 'productCode' } },
+        { title: '产品名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '产品分类', align: 'center', width: '15%', scopedSlots: { customRender: 'productType' } },
+        { title: '促销名称', dataIndex: 'promoName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '促销时间', dataIndex: 'promoStartDate', align: 'center', width: '17%', scopedSlots: { customRender: 'promoTime' } },
+        { title: '促销类型', dataIndex: 'promoTypeDictValue', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '活动规则', align: 'center', width: '10%', scopedSlots: { customRender: 'promoRules' } },
+        { title: '促销状态', dataIndex: 'promoStateDictValue', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
+        { title: '促销售价', width: '8%', align: 'right', scopedSlots: { customRender: 'promoPrice' } },
+        { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '13%', align: 'center' },
+        { title: '产品商城状态', dataIndex: 'shopProductStatusDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return shopPromoProductList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 获取产品类目列表
+    getCategoryList () {
+      const _this = this
+      _this.spinning = true
+      queryExtList({}).then(res => {
+        if (res.status == 200) {
+          this.categoryOptions = res.data || []
+        }
+        _this.spinning = false
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.promoName = ''
+      this.queryParam.promoType = undefined
+      this.queryParam.promoState = undefined
+      this.queryParam.shopProductStatus = undefined
+      this.queryParam.categorySn = undefined
+      this.queryParam.shopProductDelFlag = 0
+      this.queryParam.promoStateList = ['NOT_RELEASE', 'HAVE_RELEASE', 'IS_CLOSE']
+      this.productType = []
+      this.category = []
+      this.$refs.table.refresh()
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    // 商城类目
+    changeProductsCategory (val) {
+      this.queryParam.categorySn = (val[0] && val[1]) ? val[1] : (val[0] && !val[1]) ? val[0] : undefined
+    },
+    // 初始化
+    pageInit () {
+      const _this = this
+      _this.getCategoryList()
+      _this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    // 计算表格高度
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 205
+    }
+  },
+  watch: {
+    // 展开关闭  监听表格高度变化
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 138 - 112
src/views/purchasingManagement/purchaseReturnOutSync/edit.vue

@@ -15,94 +15,94 @@
       </a-page-header>
       <!-- 选择产品 -->
       <div class="purchaseReturnEdit-cont">
-          <a-collapse :activeKey="['1']">
-            <a-collapse-panel key="1" header="选择产品">
-              <!-- 筛选条件 -->
-              <div class="table-page-search-wrapper">
-                <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-                  <a-row :gutter="15">
-                    <a-col :md="6" :sm="24">
-                      <a-form-item label="产品编码" prop="productCode">
-                        <a-input id="bulkReturnGoodsEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
-                      </a-form-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24">
-                      <a-form-item label="产品名称" prop="productName">
-                        <a-input id="bulkReturnGoodsEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
-                      </a-form-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24">
-                      <a-form-model-item label="仓库">
-                        <a-select
-                          placeholder="请选择仓库"
-                          id="bulkReturnGoodsEdit-warehouseSn"
-                          allowClear
-                          v-model="queryParam.warehouseSn"
-                          :showSearch="true"
-                          option-filter-prop="children"
-                          :filter-option="filterOption">
-                          <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                      <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
-                      <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
-                    </a-col>
-                  </a-row>
-                </a-form>
-              </div>
-              <!-- 列表 -->
-              <s-table
-                class="sTable"
-                ref="table"
-                size="small"
-                :rowKey="(record) => record.stockDetailSn"
-                rowKeyName="stockDetailSn"
-                :columns="columns"
-                :data="loadData"
-                :pageSize="10"
-                :scroll="{ y: 149 }"
-                bordered>
-                <!-- 数量 -->
-                <template slot="returnQty" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    id="purchaseReturnEdit-returnQty"
-                    v-model="record.returnQty"
-                    :precision="0"
-                    :min="1"
-                    :max="record.refundableQty"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </template>
-                <!-- 单价 -->
-                <template slot="returnPrice" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    id="purchaseReturnEdit-returnPrice"
-                    v-model="record.returnPrice"
-                    :precision="2"
-                    :min="0"
-                    :max="999999"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </template>
-                <!-- 操作 -->
-                <template slot="action" slot-scope="text, record">
-                  <span v-if="record.refundableQty==0">--</span>
-                  <a-button
-                    v-else
-                    size="small"
-                    type="link"
-                    class="button-primary"
-                    @click="handleAdd(record)"
-                    id="purchaseReturnEdit-add-btn">添加</a-button>
-                </template>
-              </s-table>
-            </a-collapse-panel>
-          </a-collapse>
-        </div>
+        <a-collapse :activeKey="['1']">
+          <a-collapse-panel key="1" header="选择产品">
+            <!-- 筛选条件 -->
+            <div class="table-page-search-wrapper">
+              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+                <a-row :gutter="15">
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="产品编码" prop="productCode">
+                      <a-input id="bulkReturnGoodsEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="产品名称" prop="productName">
+                      <a-input id="bulkReturnGoodsEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24">
+                    <a-form-model-item label="仓库">
+                      <a-select
+                        placeholder="请选择仓库"
+                        id="bulkReturnGoodsEdit-warehouseSn"
+                        allowClear
+                        v-model="queryParam.warehouseSn"
+                        :showSearch="true"
+                        option-filter-prop="children"
+                        :filter-option="filterOption">
+                        <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+                      </a-select>
+                    </a-form-model-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                    <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
+                    <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
+                  </a-col>
+                </a-row>
+              </a-form>
+            </div>
+            <!-- 列表 -->
+            <s-table
+              class="sTable"
+              ref="table"
+              size="small"
+              :rowKey="(record) => record.stockDetailSn"
+              rowKeyName="stockDetailSn"
+              :columns="columns"
+              :data="loadData"
+              :pageSize="10"
+              :scroll="{ y: 149 }"
+              bordered>
+              <!-- 数量 -->
+              <template slot="returnQty" slot-scope="text, record">
+                <a-input-number
+                  size="small"
+                  id="purchaseReturnEdit-returnQty"
+                  v-model="record.returnQty"
+                  :precision="0"
+                  :min="1"
+                  :max="record.refundableQty"
+                  placeholder="请输入"
+                  style="width: 100%;" />
+              </template>
+              <!-- 单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
+                <a-input-number
+                  size="small"
+                  id="purchaseReturnEdit-returnPrice"
+                  v-model="record.returnPrice"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  placeholder="请输入"
+                  style="width: 100%;" />
+              </template>
+              <!-- 操作 -->
+              <template slot="action" slot-scope="text, record">
+                <span v-if="record.refundableQty==0">--</span>
+                <a-button
+                  v-else
+                  size="small"
+                  type="link"
+                  class="button-primary"
+                  @click="handleAddNew(record)"
+                  id="purchaseReturnEdit-add-btn">添加</a-button>
+              </template>
+            </s-table>
+          </a-collapse-panel>
+        </a-collapse>
+      </div>
       <!-- 已选产品 -->
       <div class="purchaseReturnEdit-cont">
         <a-collapse :activeKey="['1']">
@@ -341,17 +341,35 @@ export default {
       this.chooseQueryParam.productName = ''
       this.$refs.chooseTable.refresh(true)
     },
-    //  添加/编辑
-    handleAdd (row, isEdit) {
-      // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
-      if (!isEdit && !row.returnPrice) {
-        this.$message.warning('请输入退货价格')
+    // 添加
+    handleAddNew (record) {
+      const _this = this
+      if (record.returnQty === null || record.returnQty === undefined || Number(record.returnQty).toString().trim().length === 0) {
+        this.$message.warning('请输入退货数量')
         return
       }
-      if (!isEdit && !row.returnQty) {
-        this.$message.warning('请输入退货数量')
+      if (record.returnPrice === '' || record.returnPrice === null || record.returnPrice === undefined || Number(record.returnPrice).toString().trim().length === 0) {
+        this.$message.warning('请输入退货价格')
         return
       }
+      if (record.returnPrice === 0) {
+        this.$confirm({
+          title: '提示',
+          content: '退货单价为0,确定添加?',
+          centered: true,
+          onOk () {
+            _this.handleAdd(record)
+          },
+          onCancel () {
+            record.returnPrice = ''
+          }
+        })
+      } else {
+        _this.handleAdd(record)
+      }
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
       const params = {
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
@@ -371,17 +389,6 @@ export default {
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
       }
-      if (isEdit) { // 编辑
-        // 清空退货数量时,值应保持未清空前的值,因退货数量都不可为空
-        if (!row.qty) {
-          row.qty = row.qtyBackups
-          return
-        }
-        if (!row.cost) {
-          row.cost = row.costBackups
-          return
-        }
-      }
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
@@ -395,10 +402,6 @@ export default {
         }
       })
     },
-    // 双击快速添加
-    handleClickRow (record) {
-      this.handleAdd(record)
-    },
     // 导入明细
     handleImport () {},
     //  删除
@@ -460,6 +463,10 @@ export default {
     },
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
+      if (val === '') {
+        record.qty = record.qtyBackups
+        return
+      }
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.qtyBackups) {
         this.handleAdd(record, 'edit')
@@ -467,8 +474,27 @@ export default {
     },
     // 已选产品 退货单价  blur
     costBlur (val, record) {
-      if (val && (val != record.costBackups)) {
-        this.handleAdd(record, 'edit')
+      const _this = this
+      if (val === '') {
+        record.cost = record.costBackups
+        return
+      }
+      if (Number(val) !== record.costBackups) {
+        if (Number(val) === 0) {
+          this.$confirm({
+            title: '提示',
+            content: '确定将退货单价修改为0?',
+            centered: true,
+            onOk () {
+              _this.handleAdd(record, 'edit')
+            },
+            onCancel () {
+              record.cost = record.costBackups
+            }
+          })
+        } else {
+          _this.handleAdd(record, 'edit')
+        }
       }
     },
     // 仓库

+ 128 - 98
src/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue

@@ -15,84 +15,84 @@
       </a-page-header>
       <!-- 选择产品 -->
       <div class="purchaseReturnEdit-cont">
-          <a-collapse :activeKey="['1']">
-            <a-collapse-panel key="1" header="选择产品">
-              <!-- 筛选条件 -->
-              <div class="table-page-search-wrapper">
-                <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-                  <a-row :gutter="15">
-                    <a-col :md="6" :sm="24">
-                      <a-form-item label="采购单号" prop="purchaseBillNo">
-                        <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
-                      </a-form-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24">
-                      <a-form-item label="产品编码" prop="productCode">
-                        <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
-                      </a-form-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24">
-                      <a-form-item label="产品名称" prop="productName">
-                        <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
-                      </a-form-item>
-                    </a-col>
-                    <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                      <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseReturnList-refresh">查询</a-button>
-                      <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseReturnList-reset">重置</a-button>
-                    </a-col>
-                  </a-row>
-                </a-form>
-              </div>
-              <!-- 列表 -->
-              <s-table
-                class="sTable"
-                ref="table"
-                size="small"
-                :rowKey="(record) => record.id"
-                :columns="columns"
-                :data="loadData"
-                :pageSize="10"
-                :scroll="{ y: 149 }"
-                bordered>
-                <!-- 数量 -->
-                <template slot="returnQty" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    id="purchaseReturnEdit-returnQty"
-                    v-model="record.returnQty"
-                    :precision="0"
-                    :min="1"
-                    :max="record.refundableQty"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </template>
-                <!-- 单价 -->
-                <template slot="returnPrice" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    id="purchaseReturnEdit-returnPrice"
-                    v-model="record.returnPrice"
-                    :precision="2"
-                    :min="0"
-                    :max="999999"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </template>
-                <!-- 操作 -->
-                <template slot="action" slot-scope="text, record">
-                  <span v-if="record.refundableQty==0">--</span>
-                  <a-button
-                    v-else
-                    size="small"
-                    type="link"
-                    class="button-primary"
-                    @click="handleAdd(record)"
-                    id="purchaseReturnEdit-add-btn">添加</a-button>
-                </template>
-              </s-table>
-            </a-collapse-panel>
-          </a-collapse>
-        </div>
+        <a-collapse :activeKey="['1']">
+          <a-collapse-panel key="1" header="选择产品">
+            <!-- 筛选条件 -->
+            <div class="table-page-search-wrapper">
+              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+                <a-row :gutter="15">
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="采购单号" prop="purchaseBillNo">
+                      <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="产品编码" prop="productCode">
+                      <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24">
+                    <a-form-item label="产品名称" prop="productName">
+                      <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                    <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseReturnList-refresh">查询</a-button>
+                    <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseReturnList-reset">重置</a-button>
+                  </a-col>
+                </a-row>
+              </a-form>
+            </div>
+            <!-- 列表 -->
+            <s-table
+              class="sTable"
+              ref="table"
+              size="small"
+              :rowKey="(record) => record.id"
+              :columns="columns"
+              :data="loadData"
+              :pageSize="10"
+              :scroll="{ y: 149 }"
+              bordered>
+              <!-- 数量 -->
+              <template slot="returnQty" slot-scope="text, record">
+                <a-input-number
+                  size="small"
+                  id="purchaseReturnEdit-returnQty"
+                  v-model="record.returnQty"
+                  :precision="0"
+                  :min="1"
+                  :max="record.refundableQty"
+                  placeholder="请输入"
+                  style="width: 100%;" />
+              </template>
+              <!-- 单价 -->
+              <template slot="returnPrice" slot-scope="text, record">
+                <a-input-number
+                  size="small"
+                  id="purchaseReturnEdit-returnPrice"
+                  v-model="record.returnPrice"
+                  :precision="2"
+                  :min="0"
+                  :max="999999"
+                  placeholder="请输入"
+                  style="width: 100%;" />
+              </template>
+              <!-- 操作 -->
+              <template slot="action" slot-scope="text, record">
+                <span v-if="record.refundableQty==0">--</span>
+                <a-button
+                  v-else
+                  size="small"
+                  type="link"
+                  class="button-primary"
+                  @click="handleAddNew(record)"
+                  id="purchaseReturnEdit-add-btn">添加</a-button>
+              </template>
+            </s-table>
+          </a-collapse-panel>
+        </a-collapse>
+      </div>
       <!-- 已选产品 -->
       <div class="purchaseReturnEdit-cont">
         <a-collapse :activeKey="['1']">
@@ -343,17 +343,35 @@ export default {
       this.chooseQueryParam.productName = ''
       this.$refs.chooseTable.refresh(true)
     },
-    //  添加/编辑
-    handleAdd (row, isEdit) {
-      // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
-      if (!isEdit && !row.returnPrice) {
-        this.$message.warning('请输入退货价格')
+    // 添加
+    handleAddNew (record) {
+      const _this = this
+      if (record.returnQty === null || record.returnQty === undefined || Number(record.returnQty).toString().trim().length === 0) {
+        this.$message.warning('请输入退货数量')
         return
       }
-      if (!isEdit && !row.returnQty) {
-        this.$message.warning('请输入退货数量')
+      if (record.returnPrice === '' || record.returnPrice === null || record.returnPrice === undefined || Number(record.returnPrice).toString().trim().length === 0) {
+        this.$message.warning('请输入退货价格')
         return
       }
+      if (record.returnPrice === 0) {
+        this.$confirm({
+          title: '提示',
+          content: '退货单价为0,确定添加?',
+          centered: true,
+          onOk () {
+            _this.handleAdd(record)
+          },
+          onCancel () {
+            record.returnPrice = ''
+          }
+        })
+      } else {
+        _this.handleAdd(record)
+      }
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
       const params = {
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
@@ -366,17 +384,6 @@ export default {
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
       }
-      if (isEdit) { // 编辑
-        // 清空退货数量时,值应保持未清空前的值,因退货数量都不可为空
-        if (!row.qty) {
-          row.qty = row.qtyBackups
-          return
-        }
-        if (!row.cost) {
-          row.cost = row.costBackups
-          return
-        }
-      }
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
@@ -451,6 +458,10 @@ export default {
     },
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
+      if (val === '') {
+        record.qty = record.qtyBackups
+        return
+      }
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.qtyBackups) {
         this.handleAdd(record, 'edit')
@@ -458,8 +469,27 @@ export default {
     },
     // 已选产品 退货单价  blur
     costBlur (val, record) {
-      if (val && (val != record.costBackups)) {
-        this.handleAdd(record, 'edit')
+      const _this = this
+      if (val === '') {
+        record.cost = record.costBackups
+        return
+      }
+      if (Number(val) !== record.costBackups) {
+        if (Number(val) === 0) {
+          this.$confirm({
+            title: '提示',
+            content: '确定将退货单价修改为0?',
+            centered: true,
+            onOk () {
+              _this.handleAdd(record, 'edit')
+            },
+            onCancel () {
+              record.cost = record.costBackups
+            }
+          })
+        } else {
+          _this.handleAdd(record, 'edit')
+        }
       }
     },
     // 获取详情

+ 3 - 11
src/views/salesManagement/salesQueryNew/chooseProductModal.vue

@@ -181,19 +181,17 @@
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
-          <span style="color:#999;" v-if="hasChecked(record)">已添加</span>
           <a-button
-            v-else
             size="small"
             type="link"
             class="button-primary"
-            @click="handleAdd(record)"
+            @click.stop="handleAdd(record)"
             id="productInfoList-edit-btn">添加</a-button>
           <a-button
             size="small"
             type="link"
             class="button-primary"
-            @click="handleDetail(record)"
+            @click.stop="handleDetail(record)"
             id="productInfoList-detail-btn"
             style="margin-left: 5px;">销售记录</a-button>
         </template>
@@ -412,9 +410,6 @@ export default {
     }
   },
   methods: {
-    hasChecked (item) {
-      return this.checkedList.includes(item.productSn)
-    },
     // 查询
     searchForm () {
       if (this.hasVaild) {
@@ -474,9 +469,7 @@ export default {
     },
     // 双击列表
     handleClickRow (record) {
-      if (!this.hasChecked(record)) {
-        this.$emit('add', record)
-      }
+      this.handleAdd(record)
     },
     //  重置
     resetSearchForm (flag) {
@@ -523,7 +516,6 @@ export default {
     // 选择配件
     handleAdd (row) {
       const _this = this
-      console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
       if (row.lastSalePrice && (row.price < row.salePrice)) {
         _this.$confirm({
           title: '提示',

+ 2 - 2
vue.config.js

@@ -209,8 +209,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.113:8550/qpls-md',
-        target: 'https://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.2.100:88/qpls-md',
+        // target: 'https://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,