setData.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content">
  3. <view class="tit">应收对账单</view>
  4. <view class="con">
  5. <u-cell-group :border="false">
  6. <u-cell-item :title="item.paramName" v-for="(item, i) in systemList" :key="item.id" @click="openModal(item,i)">
  7. <u-input
  8. v-show="item.remarks != 'FLAG'"
  9. slot="right-icon"
  10. v-model="item.value"
  11. disabled
  12. @click="openModal(item,i)"
  13. placeholder="请选择"
  14. placeholder-style="text-align:right"
  15. :custom-style="inputStyle"
  16. />
  17. <u-switch
  18. v-show="item.remarks == 'FLAG'"
  19. :size="40"
  20. :active-color="activeColor"
  21. slot="right-icon"
  22. :value="item.paramValue == 1"
  23. @change="
  24. status => {
  25. changeSwitch(status, i);
  26. }
  27. "
  28. ></u-switch>
  29. </u-cell-item>
  30. </u-cell-group>
  31. </view>
  32. <!-- 类似于picker单选 -->
  33. <redioPicker :showModal="showModal0" @chooseItem="chooseCycle" @close="showModal0 = false" :val="val0" code="sales_bill_period"></redioPicker>
  34. <!-- 类似于picker多选 -->
  35. <checkBoxPicker :showModal="showModal1" @chooseCon="chooseStatus" @close="showModal1 = false" :val="val1" :filtrate="true" code="SALES_BILL_STATUS"></checkBoxPicker>
  36. <checkBoxPicker :showModal="showModal2" @chooseCon="chooseStatus" @close="showModal2 = false" :val="val2" code="SALES_SOURCE"></checkBoxPicker>
  37. <redioPicker :showModal="showModal3" @chooseItem="chooseCycle" @close="showModal3 = false" :val="val3" code="verify_default_customer"></redioPicker>
  38. </view>
  39. </template>
  40. <script>
  41. import redioPicker from '@/components/customPicker/redioPicker.vue';
  42. import checkBoxPicker from '@/components/customPicker/checkBoxPicker.vue';
  43. import { queryVerifySalesParams, updateParam } from '@/api/dealerBizParam.js';
  44. export default {
  45. components: {
  46. redioPicker,
  47. checkBoxPicker
  48. },
  49. data() {
  50. return {
  51. systemList: null,
  52. showModal0: false,
  53. showModal1: false,
  54. showModal2: false,
  55. showModal3: false,
  56. siteNum:null,
  57. val0:undefined,
  58. val1:undefined,
  59. val2:undefined,
  60. val3:undefined,
  61. inputStyle: {
  62. 'text-align': 'right'
  63. },
  64. activeColor: this.$config('primaryColor')
  65. };
  66. },
  67. onLoad() {
  68. this.getData();
  69. },
  70. methods: {
  71. getData() {
  72. queryVerifySalesParams({}).then(res => {
  73. res.data.forEach(item=>{
  74. if(item.valueShow && item.valueShow.indexOf(",")!=-1){
  75. let arr = item.valueShow.split(',');
  76. item.value = '已选' + arr.length + '项'
  77. }else{
  78. item.value = item.valueShow
  79. }
  80. })
  81. this.systemList = res.data;
  82. });
  83. },
  84. openModal(code,index) {
  85. const newArr = ['sales_bill_period','SALES_BILL_STATUS','SALES_SOURCE','verify_default_customer']
  86. newArr.forEach((con,i)=>{
  87. if(code.remarks==con){
  88. this['showModal' + i] = true;
  89. this['val' + i] = code.paramValue;
  90. }
  91. })
  92. //打开弹窗
  93. this.siteNum=index;
  94. },
  95. changeSwitch(status, i) {
  96. //是否参与对账单 0否 1是
  97. this.systemList[i].paramValue = status ? 0 : 1;
  98. let ajaxObj = {
  99. id: this.systemList[i].id,
  100. paramValue: this.systemList[i].paramValue
  101. };
  102. this.updateList(ajaxObj);
  103. },
  104. chooseCycle(con) {
  105. this.systemList[this.siteNum].value=con.dispName;
  106. let ajaxObj = {
  107. id: this.systemList[this.siteNum].id,
  108. paramValue: con.code
  109. };
  110. this.updateList(ajaxObj);
  111. },
  112. chooseStatus(arr) {
  113. this.systemList[this.siteNum].value='已选' + arr.length + '项';
  114. let newArr =arr.map(item=>{
  115. return item.code
  116. })
  117. let ajaxObj = {
  118. id: this.systemList[this.siteNum].id,
  119. paramValue: newArr.toString()
  120. };
  121. this.updateList(ajaxObj);
  122. },
  123. updateList(ajaxdata) {//修改系统参数
  124. updateParam(ajaxdata).then(res => {
  125. if (res.status == 200) {
  126. uni.showToast({
  127. title: res.message,
  128. icon: 'success'
  129. });
  130. this.getData();
  131. } else {
  132. uni.showToast({
  133. title: res.message,
  134. icon: 'none'
  135. });
  136. }
  137. });
  138. }
  139. }
  140. };
  141. </script>
  142. <style lang="scss" scoped>
  143. .content {
  144. width: 100%;
  145. height: 100vh;
  146. .tit {
  147. padding: 30rpx 20rpx 16rpx;
  148. }
  149. .con {
  150. box-sizing: border-box;
  151. width: calc(100% - 40rpx);
  152. margin: 0 auto;
  153. border-radius: 30rpx;
  154. overflow: hidden;
  155. .u-cell {
  156. padding: 14rpx 26rpx;
  157. color: #333;
  158. /deep/.u-cell_right {
  159. max-width: 40% !important;
  160. }
  161. }
  162. }
  163. }
  164. </style>