lookCououn.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="card-title">优惠券信息</div>
  4. <a-spin :spinning="isLoading">
  5. <div class="tabs-content">
  6. <div class="tab-pane">
  7. <!-- 优惠券名称 -->
  8. <a-form-item label="优惠券名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
  9. <p class="itemText">{{ detail.name }}</p>
  10. </a-form-item>
  11. <!-- 副标题 -->
  12. <a-form-item label="副标题" :labelCol="labelCol" :wrapperCol="wrapperCol">
  13. <p class="itemText">{{ detail.subtitle }}</p>
  14. </a-form-item>
  15. <!-- 优惠券说明 -->
  16. <a-form-item label="优惠券说明" :labelCol="labelCol" :wrapperCol="wrapperCol">
  17. <p class="itemText">{{ detail.describe }}</p>
  18. </a-form-item>
  19. <!-- 优惠券类型 -->
  20. <a-form-item label="优惠券类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  21. <a-radio-group
  22. v-model="couponType"
  23. v-decorator="['couponType', { initialValue: couponType, rules: [{ required: true }] }]"
  24. >
  25. <a-radio style="display: block" :value="20" v-if="couponType == 20" :disabled="true">
  26. <span class="radioTitle">满减券</span>
  27. <span class="itemTextPr">{{ detail.min_price }}</span>
  28. <span>元,可减</span>
  29. <span class="itemTextPr">{{ detail.reduce_price }}</span>
  30. <span>元</span>
  31. </a-radio>
  32. </a-radio-group>
  33. </a-form-item>
  34. <!-- 关联活动 -->
  35. <a-form-item label="关联活动" :labelCol="labelCol" :wrapperCol="wrapperCol">
  36. <p v-if="detail.activity_type == 1">裂变优惠券礼包活动</p>
  37. <p v-else-if="detail.activity_type == 2">拼团裂变活动</p>
  38. <p v-else>暂无关联活动</p>
  39. </a-form-item>
  40. <!-- 有效期 -->
  41. <a-form-item label="使用有效期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  42. <a-radio-group
  43. v-model="validTimeType"
  44. v-decorator="['validTimeType', { initialValue: validTimeType, rules: [{ required: true }] }]"
  45. >
  46. <a-radio
  47. style="display: block; margin-top: 10px"
  48. :value="20"
  49. v-if="validTimeType == 20"
  50. :disabled="true"
  51. >
  52. <span class="radioTitle">指定日期</span>
  53. <span class="itemTextPr">{{ detail.expire_time }}</span>
  54. </a-radio>
  55. <a-radio
  56. style="display: block; margin-top: 10px"
  57. :value="10"
  58. v-if="validTimeType == 10"
  59. :disabled="true"
  60. >
  61. <span class="radioTitle">顺延日期</span>
  62. <span>领取后</span>
  63. <span class="itemTextPr">{{ detail.expire_day }}</span>
  64. <span>天有效</span>
  65. </a-radio>
  66. </a-radio-group>
  67. </a-form-item>
  68. <!-- 发券数量限制 -->
  69. <a-form-item label="发券数量限制" :labelCol="labelCol" :wrapperCol="wrapperCol">
  70. <a-radio-group
  71. v-model="couponNumberType"
  72. v-decorator="['couponNumberType', { initialValue: couponNumberType, rules: [{ required: true }] }]"
  73. >
  74. <a-radio
  75. style="display: block"
  76. :value="20"
  77. v-if="detail.limit_total_type == 20"
  78. :disabled="true"
  79. >
  80. <span class="radioTitle">不限数量</span>
  81. </a-radio>
  82. <a-radio
  83. style="display: block"
  84. :value="10"
  85. v-if="detail.limit_total_type == 10"
  86. :disabled="true"
  87. >
  88. <span class="radioTitle">总量</span>
  89. <span class="itemTextPr">{{ detail.total_num }}</span>
  90. <span>张</span>
  91. </a-radio>
  92. </a-radio-group>
  93. </a-form-item>
  94. <!-- 是否允许叠加其他优惠 -->
  95. <a-form-item label="是否允许叠加其他优惠" :labelCol="labelCol" :wrapperCol="wrapperCol">
  96. <p v-if="detail.overlay_discount && detail.overlay_discount.length > 0">分销员商品折扣</p>
  97. <p v-else>无</p>
  98. </a-form-item>
  99. <!-- 商品范围 -->
  100. <a-form-item label="商品范围" :labelCol="labelCol" :wrapperCol="wrapperCol">
  101. <div class="setGoods">
  102. <p>以下商品不可使用该优惠券</p>
  103. </div>
  104. <div class="goodsBox">
  105. <a-table
  106. rowKey="goods_id"
  107. :columns="goodsColumns"
  108. :dataSource="goodsData"
  109. :pagination="false"
  110. bordered
  111. >
  112. <span slot="goods_price" slot-scope="text">
  113. <p>¥{{ text }}</p>
  114. </span>
  115. </a-table>
  116. </div>
  117. </a-form-item>
  118. <div class="card-title">优惠券推广信息</div>
  119. <!-- 券领取方式 -->
  120. <a-form-item label="券领取方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
  121. <a-radio-group v-model="receive_type">
  122. <a-radio :value="10" :disabled="true" v-if="receive_type === 10">线上发券</a-radio>
  123. <a-radio :value="20" :disabled="true" v-else>使用兑换码领取</a-radio>
  124. </a-radio-group>
  125. </a-form-item>
  126. <!-- 领取数量限制 -->
  127. <a-form-item label="领取数量限制" :labelCol="labelCol" :wrapperCol="wrapperCol">
  128. <a-radio-group
  129. v-model="receiveNumberType"
  130. v-decorator="['receiveNumberType', { initialValue: receiveNumberType, rules: [{ required: true }] }]"
  131. >
  132. <a-radio
  133. style="display: block"
  134. :value="10"
  135. v-if="receiveNumberType == 10"
  136. :disabled="true"
  137. >
  138. <span class="radioTitle">每人限领</span>
  139. <span class="itemTextPr">{{ detail.limit_receive_cnt }}</span>
  140. <span>张</span>
  141. <span class="radioBotTool">(注:指用户总共可领取指定数量,领完指定数量后,不可再领取)</span>
  142. </a-radio>
  143. <a-radio
  144. style="display: block"
  145. :value="20"
  146. v-if="receiveNumberType == 20"
  147. :disabled="true"
  148. >
  149. <span class="radioTitle">每人每天限领</span>
  150. <span class="itemTextPr">{{ detail.limit_receive_cnt }}</span>
  151. <span>张</span>
  152. <span class="radioBotTool">(注:每人每天可领取指定数量,隔天可再次领取)</span>
  153. </a-radio>
  154. </a-radio-group>
  155. </a-form-item>
  156. <a-form-item label="券领取时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
  157. <p class="itemTextPr">{{ detail.start_time }} 至 {{ detail.end_time }}</p>
  158. </a-form-item>
  159. <a-form-item label="领取时间段" :labelCol="labelCol" :wrapperCol="wrapperCol">
  160. <p
  161. class="itemTextPr"
  162. v-if="detail.start_hour || detail.end_hour"
  163. >{{ detail.start_hour }}点 至 {{ detail.end_hour }}点</p>
  164. <p class="itemTextPr" v-else>不限时间段</p>
  165. </a-form-item>
  166. <!-- 券发放对象 -->
  167. <a-form-item label="券发放对象" :labelCol="labelCol" :wrapperCol="wrapperCol">
  168. <a-radio-group
  169. v-model="send_type"
  170. v-decorator="['send_type', { initialValue: send_type, rules: [{ required: true }] }]"
  171. >
  172. <a-radio style="display: block" :value="10" v-if="send_type == 10" :disabled="true">
  173. <span class="radioTitle">所有用户</span>
  174. </a-radio>
  175. <a-radio style="display: block" :value="20" v-if="send_type == 20" :disabled="true">
  176. <span class="radioTitle">新用户</span>
  177. <span class="radioBotTool">(指未在公明腊肠小程序下过单的用户)</span>
  178. </a-radio>
  179. </a-radio-group>
  180. </a-form-item>
  181. <!-- 是否公开发券 -->
  182. <a-form-item label="是否公开发券" :labelCol="labelCol" :wrapperCol="wrapperCol">
  183. <a-radio-group v-model="is_show_position" :disabled="true">
  184. <a-radio :value="1">默认公开发券</a-radio>
  185. <a-radio :value="2">仅在领券中心显示</a-radio>
  186. <a-radio :value="3">仅在商品详情页显示</a-radio>
  187. <a-radio :value="4">完全不公开(定向发放,券发放对象必须为所有用户)</a-radio>
  188. </a-radio-group>
  189. </a-form-item>
  190. <a-form-item
  191. label="审核不通过的原因"
  192. :labelCol="labelCol"
  193. :wrapperCol="wrapperCol"
  194. v-if="source == 1 && (isSuper == 1 || role == 'coupon-zg-audit') && detail.audit_status == 0"
  195. >
  196. <a-textarea
  197. class="remark_textarea"
  198. v-model="textarea"
  199. placeholder="如审核不通过,需填写不通过的原因"
  200. :maxLength="200"
  201. />
  202. </a-form-item>
  203. <a-form-item
  204. class="mt-20"
  205. :wrapper-col="{ span: wrapperCol.span, offset: labelCol.span }"
  206. v-if="source == 1 && (isSuper == 1 || role == 'coupon-zg-audit') && detail.audit_status == 0"
  207. >
  208. <a-button
  209. type="primary"
  210. class="close"
  211. @click="auditAxios(10)"
  212. :loading="isBtnLoading"
  213. >审核通过</a-button>
  214. <a-button
  215. type="danger"
  216. class="close"
  217. @click="auditAxios(20)"
  218. :loading="isBtnLoading"
  219. >审核不通过</a-button>
  220. </a-form-item>
  221. <a-form-item
  222. class="mt-20"
  223. v-else
  224. :wrapper-col="{ span: wrapperCol.span, offset: labelCol.span }"
  225. >
  226. <a-button type="primary" class="close" @click="close" :loading="isBtnLoading">关闭</a-button>
  227. </a-form-item>
  228. </div>
  229. </div>
  230. </a-spin>
  231. </a-card>
  232. </template>
  233. <script>
  234. import * as Api from '@/api/marketingCenter/lookCououn'
  235. const goodsColumns = [
  236. {
  237. title: '商品ID',
  238. width: '80px',
  239. dataIndex: 'goods_id'
  240. },
  241. {
  242. title: '商品编码',
  243. width: '150px',
  244. dataIndex: 'goods_no'
  245. },
  246. {
  247. title: '商品名称',
  248. width: '300px',
  249. ellipsis: true,
  250. dataIndex: 'goods_name'
  251. },
  252. {
  253. title: '售价',
  254. width: '150px',
  255. dataIndex: 'goods_price',
  256. scopedSlots: { customRender: 'goods_price' }
  257. }
  258. ]
  259. export default {
  260. data () {
  261. return {
  262. role: '',
  263. isSuper: 1,
  264. couponType: 20, // 优惠卷类型 ->10 立减券 20 满减券 30 首单券 40 新人券
  265. validTimeType: 20, // 有效期类型 -> 10顺延日期 20指定日期
  266. couponNumberType: 10, // 发券数量限制类型 -> 10总量 20不限数量
  267. receiveNumberType: 10, // 领取数量限制 ->10每人限领 20每人每天
  268. receive_type: 10, // 券领取方式 =>10 线上发券 20 使用兑换码领取
  269. is_show_position: 1, // 公开发券
  270. send_type: 10, // 券发放对象 => 10所有用户 20新用户 (指未在公明腊肠小程序下过单的用户)
  271. goodsData: [], // 除外商品列表
  272. textarea: '', // 审核不通过的原因
  273. detail: {}, // 卷详情
  274. goodsColumns,
  275. // 标签布局属性
  276. labelCol: { span: 3 },
  277. // 输入框布局属性
  278. wrapperCol: { span: 15 },
  279. // loading状态
  280. isLoading: false,
  281. isBtnLoading: false,
  282. source: null
  283. }
  284. },
  285. // 初始化数据
  286. created () {
  287. if (this.$store.getters.roles) {
  288. this.isSuper = this.$store.getters.roles.isSuper
  289. const permissions = this.$store.getters.roles.permissions
  290. permissions.forEach(item => {
  291. if (item.permissionId == '/marketingCenter/manage' && item.actionEntitySet && item.actionEntitySet.length > 0) {
  292. this.role = item.actionEntitySet[0].action
  293. }
  294. })
  295. }
  296. this.couponId = this.$route.query.id || ''
  297. this.getCouponDetail()
  298. // source? 1:审核 0/null:查看
  299. const source = this.$route.query.source || null
  300. if (source && source == 1) {
  301. this.source = source
  302. this.$route.meta.title = '审核满减券'
  303. }
  304. },
  305. methods: {
  306. // 获取优惠卷详情
  307. getCouponDetail () {
  308. this.isLoading = true
  309. Api.detail({ coupon_id: this.couponId })
  310. .then(result => {
  311. const { detail } = result.data || {}
  312. this.detail = detail
  313. this.textarea = detail.refuse_desc
  314. this.goodsData = detail.goodsExcept || []
  315. this.couponType = detail.coupon_type || 10
  316. this.validTimeType = detail.expire_type || 10
  317. this.receive_type = detail.receive_type || 10
  318. this.is_show_position = detail.is_show_position || 1 // 公开券发,
  319. this.send_type = detail.send_type || 10
  320. this.couponNumberType = detail.limit_total_type || 10
  321. this.receiveNumberType = detail.limit_receive_type || 10
  322. })
  323. .finally(() => {
  324. this.isLoading = false
  325. })
  326. },
  327. // 提交审核、拒绝
  328. auditAxios (type) {
  329. if (this.role != 'coupon-zg-audit' && this.isSuper != 1) {
  330. this.$message.error('暂无权限', 1.5)
  331. return
  332. }
  333. const form = {
  334. audit_status: type // 10 同意 20拒绝
  335. }
  336. if (type == 20) {
  337. if (!this.textarea) {
  338. this.$message.error('请填写审核不通过的原因', 1.5)
  339. return
  340. }
  341. form.refuse_desc = this.textarea
  342. }
  343. this.isLoading = true
  344. this.isBtnLoading = true
  345. Api.audit({ form, coupon_id: this.couponId })
  346. .then(result => {
  347. // 显示提示信息
  348. this.$message.success(result.message, 1.5)
  349. // 跳转到列表页
  350. setTimeout(() => {
  351. this.$router.push('./manage')
  352. }, 1500)
  353. })
  354. .catch(() => {
  355. this.isBtnLoading = false
  356. })
  357. .finally(() => {
  358. this.isLoading = false
  359. })
  360. },
  361. // 关闭
  362. close () {
  363. // this.$router.push('./manage')
  364. this.$router.go(-1)
  365. }
  366. }
  367. }
  368. </script>
  369. <style lang="less" scoped>
  370. .formItem {
  371. display: block;
  372. }
  373. .radioTitle {
  374. margin-right: 10px;
  375. }
  376. .radioBotTool {
  377. font-size: 13px;
  378. color: #666666;
  379. margin-left: 20px;
  380. }
  381. .assignClass {
  382. /deep/ .ant-checkbox-wrapper {
  383. margin-right: 15px;
  384. margin-bottom: 15px;
  385. }
  386. }
  387. .close {
  388. margin-left: 100px;
  389. }
  390. .itemTextPr {
  391. margin: 0 20px;
  392. color: #000 !important;
  393. }
  394. .itemText {
  395. color: #000 !important;
  396. }
  397. /deep/ .ant-radio-disabled + span {
  398. color: #000 !important;
  399. }
  400. .card-title {
  401. font-size: 14px;
  402. position: relative;
  403. width: 100%;
  404. padding: 12px 20px;
  405. border-bottom: 1px solid #eef1f5;
  406. margin-bottom: 20px;
  407. }
  408. .card-title::before {
  409. content: '';
  410. position: absolute;
  411. width: 4px;
  412. height: 14px;
  413. background: #00aeff;
  414. top: 16px;
  415. left: 5px;
  416. }
  417. </style>