index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.billno"
  6. formPath="QuotedPrice"
  7. :editData="mainData"
  8. :mainAreaData="mainAreaData"
  9. turnPageId="20221020165103"
  10. delApiId="20221020165503"
  11. idname="sa_quotedpriceid"
  12. ownertable="sa_quotedprice"
  13. :statusCheck="[{key:'status',value:'审核'},{key:'status',value:'提交'}]"
  14. :tags="[]"
  15. :tabs="['产品明细折扣','产品类别折扣','详细信息','其他费用','历史报价']"
  16. @pageChange="pageChange"
  17. @onEditSuccess="queryMainData($route.query.id)">
  18. <div slot="tags">
  19. <!-- 使用此插槽可不传[tags] -->
  20. <!-- :tabs="['经销商团队','代理区域','营销类别','账户余额']" -->
  21. </div>
  22. <div slot="customOperation">
  23. <!-- 此区域提供了自定义操作按钮 -->
  24. <submit_to class="inline-16" v-if="tool.checkAuth($route.name,'submit') && mainData.status === '新建'" :disabled="mainData.disabled" :sa_quotedpriceid="mainData.sa_quotedpriceid" @onSubmit="onSuccess"></submit_to>
  25. <revoke class="inline-16" v-if="tool.checkAuth($route.name,'revoke') && mainData.status === '提交'" :disabled="mainData.disabled" :sa_quotedpriceid="mainData.sa_quotedpriceid" @onRevoke="onSuccess"></revoke>
  26. <examine_to class="inline-16" v-if="tool.checkAuth($route.name,'toExamine') && mainData.status === '提交'" :disabled="mainData.disabled" :sa_quotedpriceid="mainData.sa_quotedpriceid" @onExamine="onSuccess"></examine_to>
  27. <deApprove class="inline-16" v-if="tool.checkAuth($route.name,'deApprove') && mainData.status === '审核'" :disabled="mainData.disabled" :data="mainData" @onDeApprove="onSuccess"></deApprove>
  28. <copyTo class="inline-16" v-if="tool.checkAuth($route.name,'copyTo') " :data="mainData.sa_quotedpriceid" :disabled="mainData.disabled"></copyTo>
  29. <toVoid class="inline-16" v-if="tool.checkAuth($route.name,'toVoid') && mainData.status === '新建'" :disabled="mainData.disabled" :data="mainData.sa_quotedpriceid" ></toVoid>
  30. </div>
  31. <div slot="slot2" class=" normal-panel">
  32. <detailed :data="mainData" :totalPrice="totalPrice" v-if="flag"></detailed>
  33. </div>
  34. <div slot="slot0" class=" normal-panel">
  35. <productInventory ref="productList" :data="mainData" v-if="flag" :disabled="mainData.disabled" @productSuccess="productSuccess"></productInventory>
  36. </div>
  37. <div slot="slot3" class=" normal-panel">
  38. <otherExpenses :status="mainData.status" :data="mainData" v-if="flag"></otherExpenses>
  39. </div>
  40. <div slot="slot4" class=" normal-panel">
  41. <historicalQuotation :data="mainData" v-if="flag"></historicalQuotation>
  42. </div>
  43. <div slot="slot1" class=" normal-panel">
  44. <itemClass :data="mainData" :disabled="mainData.disabled"></itemClass>
  45. </div>
  46. </basicDetails>
  47. </div>
  48. </template>
  49. <script>
  50. import detailed from './modules/detailed/index'
  51. import contacts from './modules/contacts/list'
  52. import address_manage from './modules/addressManage/list'
  53. import submit_to from './components/submitTo'
  54. import revoke from './components/revoke'
  55. import examine_to from './components/examineTo'
  56. import project_change from './modules/projectChange/index'
  57. import customer_assocalated from './modules/customerAssociated/index'
  58. import productInventory from './modules/productInventory/index'
  59. import toVoid from './components/toVoid'
  60. import historicalQuotation from './modules/historicalQuotation/index'
  61. import copyTo from "@/SDrpManagement/QuotedPrice/detail/components/copyTo";
  62. import deApprove from './components/deApprove'
  63. import otherExpenses from './modules/otherExpenses/index'
  64. import itemClass from './modules/itemClass/index'
  65. export default {
  66. name: "index",
  67. data(){
  68. return {
  69. mainData:{
  70. disabled:true,
  71. },
  72. mainAreaData:[],
  73. disabled:false,
  74. flag:false,
  75. totalPrice:0,
  76. userInfo:JSON.parse(window.sessionStorage.getItem('active_account'))
  77. }
  78. },
  79. components:{
  80. detailed,
  81. contacts,
  82. address_manage,
  83. submit_to,
  84. examine_to,
  85. project_change,
  86. customer_assocalated,
  87. productInventory,
  88. toVoid,
  89. historicalQuotation,
  90. copyTo,
  91. deApprove,
  92. revoke,
  93. otherExpenses,
  94. itemClass
  95. },
  96. watch:{
  97. async mainData(val) {
  98. const res = await this.$api.requested({
  99. "id": 20220930103501,
  100. "content": {
  101. "ownertable":"sa_quotedprice",
  102. "ownerid":this.$route.query.id
  103. }
  104. })
  105. if (this.mainData.leader.length !== 0){
  106. if (JSON.parse(window.sessionStorage.getItem('active_account')).userid === this.mainData.leader[0].userid){
  107. this.mainData.disabled = true
  108. }else {
  109. let flag = 0
  110. for (var i=0;i<res.data[0].team.length;i++){
  111. if (res.data[0].team[i].userid === JSON.parse(window.sessionStorage.getItem('active_account')).userid){
  112. if (res.data[0].team[i].editable === 1){
  113. this.mainData.disabled = true
  114. flag =1
  115. break
  116. }else {
  117. flag = 0
  118. break
  119. }
  120. }
  121. }
  122. /*不是负责人*/
  123. flag === 0?this.mainData.disabled = false:this.mainData.disabled = true
  124. }
  125. }
  126. console.log("权限结果",this.mainData.disabled)
  127. }
  128. },
  129. methods:{
  130. async queryMainData(id){
  131. this.$refs.details.$refs.group.queryGroup()
  132. const res = await this.$api.requested({
  133. "id": 20221020165203,
  134. "version":1,
  135. "content": {
  136. nocache:true,
  137. "sa_quotedpriceid":id
  138. }
  139. })
  140. /*this.mainData = res.data*/
  141. this.mainData = Object.assign({},this.mainData,res.data)
  142. this.productList()
  143. /*this.$refs.productList.productData()*/
  144. this.$nextTick(()=>{
  145. this.$refs.productList.productData()
  146. })
  147. /* this.changeDataStructure()*/
  148. /* this.$refs.detailed.detailedList(this.mainData)*/
  149. this.flag = true
  150. },
  151. // 监听切换数据,上一页,下一页
  152. pageChange (id,rowindex) {
  153. this.flag = false
  154. this.$router.replace({path:'/quotedPriceDetail',query:{id:id,rowindex:rowindex}})
  155. this.queryMainData(id)
  156. },
  157. changeDataStructure(){
  158. let that = this
  159. this.mainData.quotedpricetype === '项目报价'?
  160. this.mainAreaData = [
  161. {
  162. label:'报价类型',
  163. value:this.mainData.quotedpricetype
  164. },
  165. {
  166. label:'项目名称',
  167. value:this.mainData.projectname
  168. },
  169. {
  170. label:'项目编号',
  171. value:this.mainData.projectnum
  172. },
  173. {
  174. label:'报价日期',
  175. value:this.mainData.billdate
  176. },
  177. {
  178. label:'有效期',
  179. value:this.mainData.begdate?this.mainData.begdate + '至' + this.mainData.enddate:"--"
  180. },
  181. {
  182. label:'客户名称',
  183. value:this.mainData.enterprisename
  184. },
  185. {
  186. label:'联系人',
  187. value:this.mainData.contactsname
  188. },
  189. {
  190. label:'手机号',
  191. value:this.mainData.contactsphonenumber
  192. },
  193. {
  194. label:'折扣(%)',
  195. value:this.mainData.discountrate !== 0?Math.round((this.mainData.discountrate * 100)*100)/100:'--'
  196. },
  197. {
  198. label:'总金额(元)',
  199. value:this.totalPrice ? this.tool.formatAmount(this.totalPrice,2) : '--'
  200. },
  201. {
  202. label:'是否特价',
  203. value:this.mainData.specialoffer === 1?'是':'否'
  204. },
  205. {
  206. label:'状态',
  207. value:this.mainData.status,
  208. style:function () {
  209. let style = {}
  210. switch (that.mainData.status) {
  211. case '新建':
  212. style = {color:'#3874f6'}
  213. break;
  214. case '提交':
  215. style = {color:'#52c41a'}
  216. break;
  217. case '审核':
  218. style = {color:'#333333'}
  219. break;
  220. default:
  221. break;
  222. }
  223. return style
  224. }
  225. },
  226. /*{
  227. label:'邮箱',
  228. value:this.mainData.email
  229. }*/
  230. ]:this.mainAreaData = [
  231. {
  232. label:'报价类型',
  233. value:this.mainData.quotedpricetype
  234. },
  235. {
  236. label:'报价日期',
  237. value:this.mainData.billdate
  238. },
  239. {
  240. label:'有效期',
  241. value:this.mainData.begdate?this.mainData.begdate + '至' + this.mainData.enddate:"--"
  242. },
  243. {
  244. label:'客户名称',
  245. value:this.mainData.enterprisename
  246. },
  247. {
  248. label:'联系人',
  249. value:this.mainData.contactsname
  250. },
  251. {
  252. label:'手机号',
  253. value:this.mainData.contactsphonenumber
  254. },
  255. {
  256. label:'折扣(%)',
  257. value:this.mainData.discountrate !== 0?Math.round((this.mainData.discountrate * 100)*100)/100:'--'
  258. },
  259. {
  260. label:'总金额(元)',
  261. value:this.totalPrice ? this.tool.formatAmount(this.totalPrice,2) : '--'
  262. },
  263. {
  264. label:'是否特价',
  265. value:this.mainData.specialoffer === 1?'是':'否'
  266. },
  267. {
  268. label:'状态',
  269. value:this.mainData.status,
  270. style:function () {
  271. let style = {}
  272. switch (that.mainData.status) {
  273. case '新建':
  274. style = {color:'#3874f6'}
  275. break;
  276. case '提交':
  277. style = {color:'#52c41a'}
  278. break;
  279. case '审核':
  280. style = {color:'#333333'}
  281. break;
  282. default:
  283. break;
  284. }
  285. return style
  286. }
  287. },
  288. /*{
  289. label:'邮箱',
  290. value:this.mainData.email
  291. }*/
  292. ]
  293. },
  294. /*产品配置信息*/
  295. async productList(){
  296. const res = await this.$api.requested({
  297. "id": 20221021095503,
  298. "content": {
  299. "sa_quotedpriceid":this.$route.query.id //sat_notice_classid<=0时 为新增
  300. }
  301. })
  302. this.totalPrice = 0
  303. this.mainData.specialoffer = 0
  304. res.data.forEach((item)=> {
  305. if (item.discountDifferenceAmount < 0){
  306. this.mainData.specialoffer = 1
  307. }
  308. this.totalPrice = this.totalPrice + item.amount
  309. })
  310. /*this.queryMainData(this.$route.query.id)*/
  311. this.totalPrice = Math.round(this.totalPrice * 100) / 100
  312. this.changeDataStructure()
  313. },
  314. onSuccess(){
  315. this.queryMainData(this.$route.query.id)
  316. },
  317. productSuccess(){
  318. /*this.queryMainData(this.$route.query.id)*/
  319. this.productList()
  320. }
  321. },
  322. mounted() {
  323. this.queryMainData(this.$route.query.id)
  324. }
  325. }
  326. </script>
  327. <style scoped>
  328. </style>