specialOfferModal.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <a-modal
  3. centered
  4. class="promotionList-basicInfo-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="规则设置"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="80%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-form-model
  13. id="promotionList-basicInfo-form"
  14. ref="ruleForm"
  15. :model="form"
  16. :rules="rules"
  17. :label-col="formItemLayout.labelCol"
  18. :wrapper-col="formItemLayout.wrapperCol" >
  19. <a-form-model-item label="规则门槛" prop="supplierSn">
  20. <a-radio-group v-model="form.supplierSn" button-style="solid" size="small">
  21. <a-radio-button value="a">
  22. </a-radio-button>
  23. <a-radio-button value="b">
  24. </a-radio-button>
  25. </a-radio-group>
  26. <div class="ruleDescList">
  27. 购买满
  28. <a-input-number v-model="form.starAmount" :min="0" :precision="2" size="small"/>
  29. 元门槛产品,可使用
  30. <a-input-number v-model="form.endAmount" :min="0" :precision="2" size="small"/>
  31. 元配额,采购规则中的特价商品(配额算销售额)
  32. </div>
  33. </a-form-model-item>
  34. <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
  35. <span slot="label">
  36. <a-tooltip title="What do you want others to call you?">
  37. <a-icon type="info-circle" />
  38. </a-tooltip>
  39. 订单起订金额
  40. </span>
  41. <a-select default-value="b" style="width: 160px" size="small">
  42. <a-select-option value="a">
  43. 不限
  44. </a-select-option>
  45. <a-select-option value="b">
  46. 限制
  47. </a-select-option>
  48. </a-select>
  49. <a-input-number
  50. size="small"
  51. style="margin-left:10px;width:300px;"
  52. v-model="form.endAmount"
  53. :min="0"
  54. :step="1"
  55. :precision="2"
  56. placeholder="请输入金额"/>
  57. </a-form-model-item>
  58. <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
  59. <span slot="label">
  60. <a-tooltip title="What do you want others to call you?">
  61. <a-icon type="info-circle" />
  62. </a-tooltip>
  63. 活动经费上限
  64. </span>
  65. <a-select default-value="b" style="width: 160px" size="small">
  66. <a-select-option value="a">
  67. 不限
  68. </a-select-option>
  69. <a-select-option value="b">
  70. 限制
  71. </a-select-option>
  72. </a-select>
  73. <a-input-number
  74. size="small"
  75. style="margin-left:10px;width:300px;"
  76. v-model="form.endAmount"
  77. :min="0"
  78. :step="1"
  79. :precision="2"
  80. placeholder="请输入金额"/>
  81. </a-form-model-item>
  82. </a-form-model>
  83. <a-card size="small" :bordered="false" class="pages-wrap">
  84. <div class="flex">
  85. <a-radio-group v-model="chooseVal" button-style="solid" size="small">
  86. <a-radio-button value="a">
  87. 门槛产品
  88. </a-radio-button>
  89. <a-radio-button value="c">
  90. 促销产品
  91. </a-radio-button>
  92. </a-radio-group>
  93. <div>
  94. <a-button
  95. size="small"
  96. type="link"
  97. class="button-info"
  98. id="promotionList-edit-btn">+导入产品</a-button>
  99. <a-button
  100. style="margin-left:10px;"
  101. size="small"
  102. type="link"
  103. class="button-error"
  104. id="promotionList-edit-btn">+新增产品</a-button>
  105. </div>
  106. </div>
  107. <tableType3></tableType3>
  108. </a-card>
  109. <div class="btn-cont">
  110. <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
  111. <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
  112. </div>
  113. </a-spin>
  114. </a-modal>
  115. </template>
  116. <script>
  117. import { commonMixin } from '@/utils/mixin'
  118. import { VSelect } from '@/components'
  119. import tableType3 from './tableType3.vue'
  120. import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
  121. export default {
  122. name: 'PromotionListBasicInfoModal',
  123. mixins: [commonMixin],
  124. components: { VSelect, tableType3 },
  125. props: {
  126. openModal: { // 弹框显示状态
  127. type: Boolean,
  128. default: false
  129. },
  130. itemSn: {
  131. type: [Number, String],
  132. default: ''
  133. }
  134. },
  135. data () {
  136. return {
  137. isShow: this.openModal, // 是否打开弹框
  138. spinning: false,
  139. formItemLayout: {
  140. labelCol: { span: 4 },
  141. wrapperCol: { span: 17 }
  142. },
  143. form: {
  144. promotionName: '',
  145. activeDate: undefined,
  146. supplierSn: 'b', // 供应商
  147. returnReason: '', // 退货原因
  148. explainInfo: '', // 补充说明
  149. warehouseSn: undefined,
  150. attachmentList: ''
  151. },
  152. openDealerModal: false,
  153. chooseDealerList: [],
  154. attachList: [], // 附件
  155. dateFormat: 'YYYY-MM-DD',
  156. rules: {
  157. supplierSn: [
  158. { required: true, message: '请选择供应商名称', trigger: 'change' }
  159. ],
  160. returnReason: [
  161. { required: true, message: '请选择退货原因', trigger: 'change' }
  162. ],
  163. warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }]
  164. },
  165. chooseVal: 'a',
  166. attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
  167. }
  168. },
  169. methods: {
  170. // 附件上传
  171. changeAttach (file) {
  172. this.attachList = JSON.parse(file)
  173. this.attachList.map(item => {
  174. item.fileType = item.extName
  175. })
  176. },
  177. // 选择参与客户
  178. handleDealerModal () {
  179. this.openDealerModal = true
  180. const _this = this
  181. if (_this.chooseDealerList.length == 0) {
  182. _this.form.promoBuyerList = []
  183. }
  184. const arr = _this.chooseDealerList.map(item => {
  185. return item.buyerSn
  186. })
  187. // 选择经销商回显
  188. _this.$nextTick(() => {
  189. _this.$refs.dealerChoose.pageInit(arr)
  190. })
  191. },
  192. // 添加经销商
  193. handleAddDealer (list) {
  194. this.chooseDealerList = list.map(con => {
  195. return {
  196. buyerSn: con.dealerSn,
  197. buyerName: con.dealerName
  198. }
  199. })
  200. this.openDealerModal = false
  201. // 移除表单必填项
  202. this.$refs.ruleForm.clearValidate('promoBuyerList')
  203. },
  204. // 保存
  205. handleSave () {
  206. const _this = this
  207. this.$refs.ruleForm.validate(valid => {
  208. if (valid) {
  209. const form = JSON.parse(JSON.stringify(_this.form))
  210. form.attachmentList = _this.attachList
  211. _this.spinning = true
  212. sparePartsReturnSave(form).then(res => {
  213. if (res.status == 200) {
  214. _this.$message.success(res.message)
  215. setTimeout(() => {
  216. _this.isShow = false
  217. _this.$emit('ok', res.data)
  218. _this.spinning = false
  219. }, 1000)
  220. } else {
  221. _this.spinning = false
  222. }
  223. })
  224. } else {
  225. return false
  226. }
  227. })
  228. },
  229. // 获取编辑详情
  230. getDetail () {
  231. sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
  232. if (res.status == 200) {
  233. const resultObj = res.data
  234. this.attachList = resultObj.attachmentList
  235. const obj = {
  236. supplierSn: resultObj.supplierSn,
  237. returnReason: resultObj.returnReason, // 退货原因
  238. explainInfo: resultObj.explainInfo, // 补充说明
  239. warehouseSn: resultObj.warehouseSn,
  240. sparePartsReturnSn: this.itemSn
  241. }
  242. this.$nextTick(() => {
  243. this.$refs.attachList.setFileList(this.attachList)
  244. })
  245. this.form = { ...this.form, ...obj }
  246. } else {
  247. this.detailsData = null
  248. }
  249. })
  250. },
  251. // 不可选日期
  252. disabledDate (date, dateStrings) {
  253. return date && date.valueOf('day') < moment().subtract(1, 'day') // 今天以后,包含今天
  254. }
  255. },
  256. watch: {
  257. // 父页面传过来的弹框状态
  258. openModal (newValue, oldValue) {
  259. this.isShow = newValue
  260. },
  261. // 重定义的弹框状态
  262. isShow (newValue, oldValue) {
  263. if (!newValue) {
  264. this.$emit('close')
  265. this.attachList = []
  266. this.supplierName = null
  267. this.$nextTick(() => {
  268. this.$refs.attachList.setFileList('')
  269. this.$refs.ruleForm.resetFields()
  270. })
  271. } else {
  272. if (this.itemSn) {
  273. this.getDetail()
  274. } else {
  275. // 默认仓库
  276. this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
  277. }
  278. }
  279. }
  280. }
  281. }
  282. </script>
  283. <style lang="less" scoped>
  284. .promotionList-basicInfo-modal{
  285. /deep/.ant-modal-body {
  286. padding: 40px 40px 24px;
  287. max-height: 745px !important;
  288. overflow-y: scroll !important;
  289. }
  290. .ant-radio-button-wrapper{
  291. width:80px;
  292. text-align: center;
  293. }
  294. .ant-form-item{
  295. margin-bottom:5px;
  296. }
  297. .buyerBox{
  298. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  299. }
  300. .btn-cont {
  301. text-align: center;
  302. margin: 35px 0 10px;
  303. }
  304. .flex{
  305. display:flex;
  306. align-items:center;
  307. justify-content:space-between;
  308. }
  309. }
  310. </style>