detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.promnum"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. :turnPageId="20221230144803"
  9. :delApiId="20221230144903"
  10. idname="sa_promotionid"
  11. ownertable="sa_promotion"
  12. tags=""
  13. :tabs="['促销商品','授权范围','详细信息']"
  14. :statusCheck="[{key:'status',value:'审核'},{key:'status',value:'发布'}]"
  15. @pageChange="pageChange"
  16. @onEditSuccess="queryMainData($route.query.id)">
  17. <div slot="customOperation">
  18. <Edit class="inline-16" :data="mainData" v-if="tool.checkAuth($route.name,'update') && mainData.status == '新建'" @onSuccess="queryMainData"></Edit>
  19. <Check
  20. :data="mainData"
  21. class="inline-16"
  22. @onSuccess="queryMainData"
  23. v-if="mainData.status != '发布'"
  24. />
  25. <Send :data="mainData" class="inline-16" @onSuccess="queryMainData" v-if="mainData.status != '关闭' || mainData.status != '新建'"/>
  26. <Close :data="mainData" class="inline-16" @onSuccess="queryMainData"/>
  27. </div>
  28. <div slot="slot0" >
  29. <productDetail :data="mainData" ref="productDetail">
  30. <template v-slot:promotionPrice="scope">
  31. <promotion-price :data="scope.data" ref="promotionPrice">
  32. <template v-slot:editPrice="scope2">
  33. <el-button type="text" size="mini" @click="$refs.promotionPrice.currentProduct = scope2.data">编 辑</el-button>
  34. </template>
  35. </promotion-price>
  36. </template>
  37. <template v-slot:addProduct="scope">
  38. <add-product :data="mainData" @onSuccess="$refs.productDetail.listData(scope.data.data.sa_promotion_itemgroupid)"></add-product>
  39. <calcPrice
  40. class="inline-16"
  41. :data="scope.data.selectRow"
  42. @onSuccess="$refs.productDetail.$refs.selectTable.$refs.tables.clearSelection();$refs.productDetail.$refs.selectTable.allArr=[];$refs.productDetail.selectRow=[]"
  43. ></calcPrice>
  44. <importFile
  45. ref="importFile"
  46. class="inline-16"
  47. :bindData="{ownertable:'sa_promotionid',ownerid:$route.query.id,usetype:'default'}"
  48. :errorUrl="errorUrl"
  49. @clearUrl="errorUrl = null"
  50. @onSuccess="bindImportOrder"
  51. ></importFile>
  52. </template>
  53. <template v-slot:delProduct="scope">
  54. <el-button :disabled="!isEdit" type="text" size="mini" @click="productDel(scope.data)">删 除</el-button>
  55. </template>
  56. </productDetail>
  57. </div>
  58. <div slot="slot1">
  59. <prowerArea ref="prowerArea" :data="mainData">
  60. <template v-slot:editArea="scope">
  61. <el-button v-if="tool.checkAuth($route.name,'prowerArea')" class="inline-16" size="mini" type="text" @click="$refs.prowerArea.currentArea=scope.data">编 辑</el-button>
  62. </template>
  63. <template v-slot:delArea="scope">
  64. <delete-btn
  65. v-if="tool.checkAuth($route.name,'prowerArea')"
  66. message="确定删除当前授权吗?"
  67. class="inline-16"
  68. :id="scope.data.sa_promotion_authid"
  69. nameId="20230102103003"
  70. nameKey="sa_promotion_authids"
  71. @deleteSuccess="$refs.prowerArea.listData()"></delete-btn>
  72. </template>
  73. <add-prower-area v-if="tool.checkAuth($route.name,'prowerArea')" @onSuccess="$refs.prowerArea.listData()" slot="addProwerArea"></add-prower-area>
  74. </prowerArea>
  75. </div>
  76. <div slot="slot2" >
  77. <base-info v-if="detailInfo" :data="detailInfo"></base-info>
  78. </div>
  79. </basicDetails>
  80. </div>
  81. </template>
  82. <script>
  83. import Edit from '@/Form/promotion/edit'
  84. import BaseInfo from '@/components/detailInfo/index.vue'
  85. import Check from '../components/check'
  86. import Send from '../components/send'
  87. import Close from '../components/close.vue'
  88. import promotionModel from './productModel/index.vue'
  89. import addModel from './productModel/add.vue'
  90. import productDetail from './productModel/productDetail.vue'
  91. import promotionPrice from './productModel/promotionPrice'
  92. import calcPrice from './productModel/calcPrice'
  93. import addProduct from './productModel/addProduct.vue'
  94. import prowerArea from './prowerArea/index.vue'
  95. import addProwerArea from './prowerArea/addPowerArea'
  96. import importFile from './productModel/importFile.vue'
  97. export default {
  98. name: "index",
  99. components:{Edit,BaseInfo,Check,Send,Close,promotionModel,addModel,productDetail,promotionPrice,calcPrice,addProduct,prowerArea,addProwerArea,importFile},
  100. data(){
  101. return {
  102. mainData:'',
  103. mainAreaData:[],
  104. detailInfo:'',
  105. isEdit:false,
  106. errorUrl:''
  107. }
  108. },
  109. provide () {
  110. return {
  111. isEdit: () => this.isEdit
  112. }
  113. },
  114. methods:{
  115. async queryMainData(id){
  116. const res = await this.$api.requested({
  117. "id": "20221230144703",
  118. "version":1,
  119. "content": {
  120. "sa_promotionid":this.$route.query.id
  121. }
  122. })
  123. this.mainData = res.data
  124. console.log(this.mainData);
  125. this.isEdit = this.mainData.status == '新建' ? true : false
  126. this.changeDataStructure()
  127. },
  128. changeDataStructure() {
  129. let that = this
  130. this.mainAreaData = [
  131. {
  132. label:'方案编号',
  133. value:this.mainData.promnum
  134. },
  135. {
  136. label:'方案名称',
  137. value:this.mainData.promname
  138. },
  139. {
  140. label:'促销类型',
  141. value:this.mainData.type
  142. },
  143. {
  144. label:'订货账号',
  145. value:this.mainData.accountname
  146. },
  147. {
  148. label:'活动开始时间',
  149. value:this.mainData.begdate
  150. },
  151. {
  152. label:'活动结束时间',
  153. value:this.mainData.enddate
  154. },
  155. {
  156. label:'品牌',
  157. value:this.mainData.brandname
  158. },
  159. {
  160. label:'领域',
  161. value:this.mainData.tradefield.join(',')
  162. },
  163. {
  164. label:'起订数量',
  165. value:this.mainData.orderminqty
  166. },
  167. {
  168. label:'起订金额',
  169. value:this.mainData.orderminamount
  170. },
  171. {
  172. label:'订单增量',
  173. value:this.mainData.orderaddqty
  174. },
  175. {
  176. label:'备注',
  177. value:this.mainData.remarks
  178. },
  179. {
  180. label:'状态',
  181. value:this.mainData.status,
  182. style:function () {
  183. let style = {}
  184. switch (that.mainData.status) {
  185. case '新建':
  186. style = {color:'#000000'}
  187. break;
  188. case '审核':
  189. style = {color:'#52C41A'}
  190. break;
  191. case '发布':
  192. style = {color:'#d90a0a'}
  193. break;
  194. case '关闭':
  195. style = {color:'#b2c0ea'}
  196. break;
  197. }
  198. return style
  199. }
  200. },
  201. ]
  202. this.detailInfo = {
  203. baseInfo: [
  204. {
  205. label:'方案编号',
  206. value:this.mainData.promnum
  207. },
  208. {
  209. label:'方案名称',
  210. value:this.mainData.promname
  211. },
  212. {
  213. label:'促销类型',
  214. value:this.mainData.type
  215. },
  216. {
  217. label:'订货账号',
  218. value:this.mainData.accountname
  219. },
  220. {
  221. label:'活动开始时间',
  222. value:this.mainData.begdate
  223. },
  224. {
  225. label:'活动结束时间',
  226. value:this.mainData.enddate
  227. },
  228. {
  229. label:'品牌',
  230. value:this.mainData.brandname
  231. },
  232. {
  233. label:'领域',
  234. value:this.mainData.tradefields
  235. },
  236. {
  237. label:'起订数量',
  238. value:this.mainData.orderminqty
  239. },
  240. {
  241. label:'起订金额',
  242. value:this.tool.formatAmount(this.mainData.orderminamount,2)
  243. },
  244. {
  245. label:'订单增量',
  246. value:this.mainData.orderaddqty
  247. },
  248. {
  249. label:'备注',
  250. value:this.mainData.remarks
  251. },
  252. {
  253. label:'状态',
  254. value:this.mainData.status,
  255. style:function () {
  256. let style = {}
  257. switch (that.mainData.status) {
  258. case '新建':
  259. style = {color:'#000000'}
  260. break;
  261. case '审核':
  262. style = {color:'#52C41A'}
  263. break;
  264. case '发布':
  265. style = {color:'#d90a0a'}
  266. break;
  267. case '关闭':
  268. style = {color:'#b2c0ea'}
  269. break;
  270. }
  271. return style
  272. }
  273. },
  274. ],
  275. systemInfo: [
  276. {label:'录入人',value:this.mainData.createby},
  277. {label:'录入时间',value:this.mainData.createdate},
  278. {label:'审核人',value:this.mainData.checkby},
  279. {label:'审核时间',value:this.mainData.checkdate},
  280. {label:'发布人',value:this.mainData.sendby},
  281. {label:'发布时间',value:this.mainData.senddate},
  282. ]
  283. }
  284. },
  285. async productDel (data) {
  286. let res = await this.$api.requested({
  287. "id":20230102142603,
  288. "content": {
  289. "sa_promotion_itemsids":[data.sa_promotion_itemsid]
  290. }
  291. })
  292. this.tool.showMessage(res,() => {
  293. this.$refs.productDetail.listData(data.sa_promotion_itemgroupid)
  294. })
  295. },
  296. async bindImportOrder (id) {
  297. const res = await this.$api.requested({
  298. "id": 20230510153504,
  299. "content": {
  300. "attachmentid":id,
  301. "sa_promotionid":this.$route.query.id
  302. }
  303. })
  304. if (res.data !== '成功') {
  305. this.errorUrl = res.data
  306. }
  307. this.tool.showMessage(res,() => {
  308. this.$refs.productDetail.listData()
  309. })
  310. },
  311. // 监听切换数据,上一页,下一页
  312. pageChange (id,rowindex) {
  313. this.flag = false
  314. this.$router.replace({path:'/promotionDetail',query:{id:id,rowindex:rowindex}})
  315. this.queryMainData(id)
  316. },
  317. onSuccess(){
  318. this.queryMainData(this.$route.query.id)
  319. }
  320. },
  321. created() {
  322. this.queryMainData(this.$route.query.id)
  323. }
  324. }
  325. </script>
  326. <style scoped>
  327. </style>