detailModal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <a-modal
  3. centered
  4. class="promotion-basicInfo-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="70%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <div class="detailModal-con">
  13. <a-form-model
  14. id="promotion-basicInfo-form"
  15. ref="ruleForm"
  16. :model="form"
  17. :label-col="formItemLayout.labelCol"
  18. :wrapper-col="formItemLayout.wrapperCol" >
  19. <a-row>
  20. <a-col :xs="12" :sm="12">
  21. <a-form-model-item label="促销名称" prop="promoName" required :label-col="{span:8}" :wrapper-col="{span:14}">
  22. {{ form.promoName }}
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :xs="12" :sm="12">
  26. <a-form-model-item label="促销时间" prop="promoName" required :label-col="{span:8}" :wrapper-col="{span:14}">
  27. {{ form.promoStartDate }}~{{ form.promoEndDate }}
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :xs="12" :sm="12">
  31. <a-form-model-item label="排序" prop="sort" :label-col="{span:8}" :wrapper-col="{span:14}">
  32. {{ form.sort||form.sort==0?form.sort:'--' }}
  33. </a-form-model-item>
  34. </a-col>
  35. <a-col :xs="12" :sm="12">
  36. <a-form-model-item label="参与经销商" required prop="allDealerFlag" :label-col="{span:8}" :wrapper-col="{span:14}">
  37. {{ form.allDealerFlag=='1'?'全部经销商':'部分经销商' }}
  38. </a-form-model-item>
  39. </a-col>
  40. <a-col :xs="24" :sm="24">
  41. <a-form-model-item label="封面图片" required prop="imageUrl">
  42. <img
  43. :src="form.imageUrl"
  44. alt="图片走丢了"
  45. width="750px"
  46. height="300px"
  47. style="margin-right:10px;object-fit: cover;"/>
  48. <div class="upload-desc">说明:单张大小小于10Mb;建议尺寸:宽(750px)*高(300px)</div>
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :xs="24" :sm="24">
  52. <a-form-model-item label="促销描述" prop="description" required>
  53. {{ form.description||'--' }}
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :xs="24" :sm="24">
  57. <a-form-model-item label="加盟商开关权限:" prop="dealerOpenFlag" required>
  58. {{ form.dealerOpenFlag?form.dealerOpenFlag==='1'?'是':'否':'--' }}
  59. </a-form-model-item>
  60. </a-col>
  61. <div v-if="form.promoType==='BUY_PROD_GIVE_VALID'">
  62. <a-col :xs="12" :sm="12">
  63. <a-form-model-item label="券名称" prop="validName" required :label-col="{span:8}" :wrapper-col="{span:14}">
  64. {{ form.validName }}
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :xs="12" :sm="12">
  68. <a-form-model-item label="券副标题" :label-col="{span:8}" :wrapper-col="{span:14}">
  69. {{ form.validTitle ||'--' }}
  70. </a-form-model-item>
  71. </a-col>
  72. <!-- <a-col :xs="24" :sm="24">
  73. <a-form-model-item label="生成方式" prop="validBaseType">
  74. {{ form.validBaseTypeDictValue||'--' }}
  75. </a-form-model-item>
  76. </a-col> -->
  77. <a-col :xs="24" :sm="24">
  78. <a-form-model-item label="券有效期" prop="validType" required>
  79. <span>{{ form.validType==='FIXED'?'固定日期':'领取后,立即生效' }}</span>
  80. <span style="margin-left:10px;" v-if="form.validType==='FIXED'">{{ form.validStartDate }}~{{ form.validEndDate }}</span>
  81. <span style="margin-left:10px;" v-else>有效期{{ form.validDays }}天</span>
  82. </a-form-model-item>
  83. </a-col>
  84. <a-col :xs="24" :sm="24">
  85. <a-form-model-item label="券适用范围" prop="validScope" required>
  86. {{ form.validScope=='1'?'全部产品':'--' }}
  87. </a-form-model-item>
  88. </a-col>
  89. <a-col :xs="24" :sm="24">
  90. <a-form-model-item label="使用说明">
  91. {{ form.validInfo||'--' }}
  92. </a-form-model-item>
  93. </a-col>
  94. </div>
  95. <a-col :xs="24" :sm="24">
  96. <a-form-model-item required :label="form.promoType==='BUY_PROD_GIVE_PROD'?'满赠规则': form.promoType==='PROMO_PROD'?'优惠方式':'返券产品'" prop="promoName" >
  97. <div class="productTable">
  98. <s-table
  99. class="sTable"
  100. ref="table"
  101. size="small"
  102. :rowKey="(record) => record.id"
  103. :columns="columns"
  104. :data="loadData"
  105. :defaultLoadData="false"
  106. :style="{ maxHeight: 300+'px' }"
  107. :scroll="{ y:230 }"
  108. bordered>
  109. </s-table>
  110. </div>
  111. </a-form-model-item>
  112. </a-col>
  113. </a-row>
  114. </a-form-model>
  115. <div class="btn-cont">
  116. <a-button id="promotion-basicInfo-modal-close" @click="isShow = false">关闭</a-button>
  117. </div>
  118. </div>
  119. </a-spin>
  120. </a-modal>
  121. </template>
  122. <script>
  123. import { commonMixin } from '@/utils/mixin'
  124. // 组件
  125. import { STable } from '@/components'
  126. // 接口
  127. import { shopPromoDetail, chooseProductList } from '@/api/shopPromo'
  128. export default {
  129. name: 'DetailModal',
  130. mixins: [commonMixin],
  131. components: { STable },
  132. props: {
  133. openModal: { // 弹框显示状态
  134. type: Boolean,
  135. default: false
  136. },
  137. itemSn: {// 活动sn
  138. type: String,
  139. default: ''
  140. }
  141. },
  142. data () {
  143. return {
  144. isShow: this.openModal, // 是否打开弹框
  145. spinning: false,
  146. // form表单label布局
  147. formItemLayout: {
  148. labelCol: { span: 4 },
  149. wrapperCol: { span: 18 }
  150. },
  151. productTypeList: [], // 产品范围数据
  152. productRangeList: [], // 已选产品范围
  153. form: {
  154. promoType: undefined, // 促销类型
  155. promoName: '', // '促销名称'
  156. time: [], // 促销时间
  157. promoStartDate: undefined, // 促销时间-开始
  158. promoEndDate: undefined, // 促销时间-结束
  159. sort: undefined, // 排序
  160. allDealerFlag: '1', // 全部经销商 1 部分经销商0'
  161. imageUrl: undefined, // 促销封面图
  162. description: '', // '促销描述'
  163. dealerEditFlag: '0', // 加盟商编辑 0否 1是
  164. dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
  165. rangeList: [], // 选择产品列表
  166. discountType: 'STRAIGHT_DOWN', // 特价产品 - 优惠方式'
  167. validName: '', // 券名称
  168. validTitle: '', // 券副标题
  169. validBaseType: undefined, // 券生成方式
  170. validType: undefined, // 券有效期类型
  171. validStartDate: undefined, // 券生效时间
  172. validEndDate: undefined, // 券失效时间
  173. validDays: undefined, // 券有效期天数
  174. validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
  175. validInfo: '' // 使用说明
  176. },
  177. // 加载数据方法 必须为 Promise 对象
  178. loadData: parameter => {
  179. this.disabled = true
  180. this.spinning = true
  181. const params = Object.assign(parameter, this.queryParam)
  182. params.promoSn = this.itemSn
  183. // 获取详情 已选参与活动产品数据
  184. return chooseProductList(params).then(res => {
  185. let data
  186. if (res.status == 200) {
  187. data = res.data
  188. // 计算表格序号
  189. const no = (data.pageNo - 1) * data.pageSize
  190. for (var i = 0; i < data.list.length; i++) {
  191. data.list[i].no = no + i + 1
  192. }
  193. this.disabled = false
  194. }
  195. this.spinning = false
  196. return data
  197. })
  198. }
  199. }
  200. },
  201. computed: {
  202. columns () {
  203. const _this = this
  204. const arr = [
  205. { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  206. { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '产品名称', dataIndex: 'productName', width: '28%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  208. { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  209. { title: '商城售价', dataIndex: 'shopProductPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  210. ]
  211. if (_this.form.promoType === 'BUY_PROD_GIVE_PROD') {
  212. arr.splice(4, 0, { title: '买', dataIndex: 'conditionValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
  213. arr.splice(5, 0, { title: '赠', dataIndex: 'resultValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
  214. } else if (_this.form.promoType === 'PROMO_PROD') {
  215. arr.splice(5, 0, { title: '特价价格', dataIndex: 'conditionValue', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  216. } else {
  217. arr.splice(5, 0, { title: '返券金额', dataIndex: 'resultValue', width: '10%', align: 'center', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  218. }
  219. return arr
  220. }
  221. },
  222. methods: {
  223. // 重置
  224. resetSearchForm () {
  225. this.form = {
  226. promoType: undefined, // 促销类型
  227. promoName: '', // '促销名称'
  228. time: [], // 促销时间
  229. promoStartDate: undefined, // 促销时间-开始
  230. promoEndDate: undefined, // 促销时间-结束
  231. sort: undefined, // 排序
  232. allDealerFlag: '1', // 全部经销商 1 部分经销商0'
  233. imageUrl: undefined, // 促销封面图
  234. description: '', // '促销描述'
  235. dealerEditFlag: '0', // 加盟商编辑 0否 1是
  236. dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
  237. rangeList: [], // 选择产品列表
  238. discountType: 'STRAIGHT_DOWN', // 特价产品 - 优惠方式'
  239. validName: '', // 券名称
  240. validTitle: '', // 券副标题
  241. validBaseType: undefined, // 券生成方式
  242. validType: undefined, // 券有效期类型
  243. validStartDate: undefined, // 券生效时间
  244. validEndDate: undefined, // 券失效时间
  245. validDays: undefined, // 券有效期天数
  246. validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
  247. validInfo: '' // 使用说明
  248. }
  249. },
  250. // 获取列表详情
  251. getDetail () {
  252. shopPromoDetail({ sn: this.itemSn }).then(res => {
  253. if (res.status == 200) {
  254. this.form = res.data
  255. this.$nextTick(() => {
  256. this.$refs.table.refresh(true)
  257. })
  258. }
  259. })
  260. }
  261. },
  262. watch: {
  263. // 父页面传过来的弹框状态
  264. openModal (newValue, oldValue) {
  265. this.isShow = newValue
  266. },
  267. // 重定义的弹框状态
  268. isShow (newValue, oldValue) {
  269. if (!newValue) {
  270. this.$emit('close')
  271. this.resetSearchForm()
  272. } else {
  273. this.getDetail()
  274. }
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="less" scoped>
  280. .promotion-basicInfo-modal{
  281. .detailModal-con{
  282. max-height: 600px;
  283. overflow-y: scroll;
  284. }
  285. .timeBox{
  286. color:#ed1c24;
  287. opacity: .7;
  288. }
  289. .ant-modal-body {
  290. padding: 40px 40px 24px;
  291. }
  292. .promotion-basicInfo-con{
  293. margin-top:10px;
  294. }
  295. .ant-form-item{
  296. margin-bottom:0 !important;
  297. }
  298. .buyerBox{
  299. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  300. }
  301. .btn-cont {
  302. text-align: center;
  303. margin: 35px 0 10px;
  304. }
  305. //处理滚动条不显示
  306. .tabBox{
  307. max-height:100px;
  308. overflow-y:scroll;
  309. }
  310. .tabBox::-webkit-scrollbar {
  311. width: 0px;
  312. }
  313. .tabBox::-webkit-scrollbar-track {
  314. background: transparent;
  315. }
  316. .tabBox::-webkit-scrollbar-thumb {
  317. background: transparent;
  318. }
  319. .tabBox::-webkit-scrollbar-button {
  320. display: none;
  321. }
  322. // 设置input 禁用颜色
  323. .ant-form-item-control .ant-input[disabled]{
  324. color:#333333;
  325. background:#ffffff;
  326. }
  327. .ant-radio-button-wrapper-disabled{
  328. color:#333333;
  329. padding:0 16px;
  330. }
  331. .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked{
  332. background-color: #ed1c24 !important;
  333. color:#ffffff;
  334. padding:0 16px;
  335. }
  336. /deep/.ant-select-disabled .ant-select-selection, .ant-cascader-picker-disabled{
  337. color:#333 !important;
  338. background:#fff;
  339. }
  340. .productTable{
  341. width:100%;
  342. }
  343. /deep/.ant-select-disabled .ant-select-selection--multiple .ant-select-selection__choice{
  344. color:#333;
  345. }
  346. }
  347. </style>