specialAgreementPage.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="page">
  3. <!-- 头部吸顶内容 -->
  4. <u-sticky zIndex="999" customNavHeight="0">
  5. <view class="header dis a-c j-s">
  6. <u-icon name="arrow-left" color="#333" size="18" :bold="true" style="margin-right: 20rpx;"
  7. @click="back"></u-icon>
  8. <u-search placeholder="输入特别约定名称搜索" v-model="clauseName" bgColor="#f7f7f7"
  9. :actionStyle="{position: 'absolute',right:'20px',background:'#FDE935',padding:'8rpx 24rpx',boxSiting:'border-box',borderRadius:'100rpx'}"
  10. actionText="搜索" @search="search" @custom="custom" @clear="clear"></u-search>
  11. </view>
  12. <!-- 横版提示文字 -->
  13. <view class="hint dis a-c j-c">
  14. 特别约定内容中,含有*号的内容,选中后可以编辑
  15. </view>
  16. </u-sticky>
  17. <!-- 特约内容 -->
  18. <view class="content">
  19. <view class="contentTabs">
  20. <!-- 交强商业切换选项 -->
  21. <u-tabs :list="contentTabslist" @click="tabsClick" :activeStyle="{color:'#333',fontWeight:'bold'}"
  22. :inactiveStyle="{color:'#999'}" :current="current" :scrollable="false" lineColor="#FDE935"
  23. lineWidth="60rpx" style="box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.04);"></u-tabs>
  24. <view class="scroll-content">
  25. <template v-if="current==0 && ['0330','0330034002','0330034001'].includes(productId)">
  26. <checkbox-group @change="checkboxChangejq">
  27. <view class="specialTermsList dis " v-for="(item,index) in jq" :key="index">
  28. <!-- 特约选择框 -->
  29. <checkbox :value="item.id" :checked="item.checked" activeBackgroundColor="#FDE935"
  30. iconColor="#333" activeBorderColor="#FDE935" />
  31. <!-- 特约内容 -->
  32. <view class="dis f-c view ml-1">
  33. <text class="name">特约名称:{{item.clauseName}}</text>
  34. <view class="Content">
  35. <u--textarea v-if=" item.isEdit==1 && item.checked" v-model="item.clauseContent"
  36. placeholder="请输入内容"></u--textarea>
  37. <text v-else>特约内容:{{item.clauseContent}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </checkbox-group>
  42. </template>
  43. <template v-if="current==1 && ['034001','0330034002','0330034001'].includes(productId)">
  44. <checkbox-group @change="checkboxChangesy">
  45. <view class="specialTermsList dis " v-for="(item,index) in sy" :key="index">
  46. <!-- 特约选择框 -->
  47. <checkbox :value="item.id" :checked="item.checked" activeBackgroundColor="#FDE935"
  48. iconColor="#333" activeBorderColor="#FDE935" />
  49. <!-- 特约内容 -->
  50. <view class="dis f-c view ml-1">
  51. <text class="name">特约名称:{{item.clauseName}}</text>
  52. <view class="Content">
  53. <u--textarea v-if="item.isEdit==1 && item.checked" v-model="item.clauseContent"
  54. placeholder="请输入内容"></u--textarea>
  55. <text v-else>特约内容:{{item.clauseContent}}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </checkbox-group>
  60. </template>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="footer dis a-c j-s">
  65. <view class="btn btns dis a-c j-c" @click="cancel">
  66. 取消
  67. </view>
  68. <view class="btn dis a-c j-c " @click="submit">
  69. 确定
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. clauseName: "",
  79. current: 0,
  80. contentTabslist: [{
  81. name: '交强险特别约定'
  82. }, {
  83. name: '商业险特别约定'
  84. }],
  85. ListData: [], //列表
  86. productId: "",
  87. }
  88. },
  89. onShow() {
  90. },
  91. computed: {
  92. jq() {
  93. return this.ListData.filter(item => item.riskCode === "0507");
  94. },
  95. sy() {
  96. return this.ListData.filter(item => item.riskCode === "0510");
  97. },
  98. },
  99. async onLoad(options) {
  100. if (options) {
  101. await this.specialTermsList(options.companyId);
  102. this.productId = options.productId;
  103. let list = JSON.parse(options.specialInfoVo).map(val => val.id);
  104. this.ListData.map(val => {
  105. if (list.includes(val.id)) {
  106. val.checked = true;
  107. }
  108. return val;
  109. })
  110. }
  111. },
  112. methods: {
  113. checkboxChangejq(value) {
  114. console.log(value.detail.value);
  115. let listId = value.detail.value;
  116. this.jq.map(ele => {
  117. if (listId.includes(ele.id)) {
  118. ele.checked = true;
  119. } else {
  120. ele.checked = false;
  121. }
  122. return ele;
  123. })
  124. },
  125. checkboxChangesy(value) {
  126. console.log(value.detail.value);
  127. let listId = value.detail.value;
  128. this.sy.map(ele => {
  129. if (listId.includes(ele.id)) {
  130. ele.checked = true;
  131. } else {
  132. ele.checked = false;
  133. }
  134. return ele;
  135. })
  136. },
  137. //取消
  138. cancel() {
  139. uni.navigateBack(-1)
  140. },
  141. //确定
  142. submit() {
  143. let pages = getCurrentPages(); //获取所有页面栈实例列表
  144. let nowPage = pages[pages.length - 1]; //当前页页面实例
  145. let prevPage = pages[pages.length - 2]; //上一页页面实例
  146. prevPage.$vm.specialInfoVo = this.ListData.filter(val => val.checked == true); //替换特约
  147. uni.navigateBack(-1)
  148. },
  149. tabsClick(e) {
  150. this.current = e.index;
  151. },
  152. async specialTermsList(id) {
  153. let res = await this.$http.post('/manager/clause/getClausePage', {
  154. clauseName: this.clauseName,
  155. companyId: id,
  156. pages: 1,
  157. riskCode: 'all',
  158. size: 100,
  159. });
  160. res.data.records.map(val => {
  161. val.checked = false;
  162. return val;
  163. })
  164. this.ListData = res.data.records;
  165. },
  166. back() {
  167. uni.navigateBack(-1)
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .page {
  174. background-color: #F8F8F8;
  175. height: 100%;
  176. }
  177. .header {
  178. padding: 96rpx 30rpx 16rpx;
  179. box-sizing: border-box;
  180. background-color: #FFFFFF;
  181. width: 100%;
  182. }
  183. /* 顶部提示 */
  184. .hint {
  185. width: 100%;
  186. padding: 10rpx 30rpx;
  187. box-sizing: border-box;
  188. background: #FFFBD7;
  189. font-size: 30rpx;
  190. color: #333;
  191. }
  192. .content {
  193. padding: 20rpx;
  194. box-sizing: border-box;
  195. /* 选项卡容器 */
  196. .contentTabs {
  197. flex: 1;
  198. display: flex;
  199. flex-direction: column;
  200. height: 100%;
  201. background: #FFFFFF;
  202. border-radius: 10rpx 10rpx 0rpx 0rpx;
  203. /* 滚动区域 */
  204. .scroll-content {
  205. height: calc(100vh - 520rpx);
  206. overflow-y: auto;
  207. padding: 0 20rpx;
  208. /* 增加底部留白 */
  209. box-sizing: border-box;
  210. /* 确保padding计入高度 */
  211. }
  212. }
  213. }
  214. // 特约内容样式
  215. .specialTermsList {
  216. padding: 30rpx 0;
  217. box-sizing: border-box;
  218. border-bottom: 1rpx solid #eee;
  219. .view {
  220. flex: 1;
  221. .name {
  222. font-size: 30rpx;
  223. color: #333;
  224. margin-bottom: 15rpx;
  225. }
  226. .Content {
  227. width: 100%;
  228. font-size: 28rpx;
  229. color: #666;
  230. flex: 1;
  231. }
  232. }
  233. }
  234. .footer {
  235. position: fixed;
  236. bottom: 0;
  237. left: 0;
  238. right: 0;
  239. padding: 25rpx 30rpx 55rpx;
  240. box-sizing: border-box;
  241. background: linear-gradient(0deg, #FFFFFF 0%, rgba(255, 254, 245, 0.7) 100%);
  242. border-radius: 0rpx 0rpx 0rpx 0rpx;
  243. backdrop-filter: blur(12rpx);
  244. .btn {
  245. width: 100%;
  246. background: #FDE935;
  247. padding: 25rpx 20rpx;
  248. box-sizing: border-box;
  249. border-radius: 58rpx 58rpx 58rpx 58rpx;
  250. font-size: 36rpx;
  251. color: #1F1F1F;
  252. margin: 0 10rpx;
  253. }
  254. //操作按钮特殊样式
  255. .btns {
  256. background: rgba(253, 233, 53, 0.2);
  257. border: 1rpx solid #FDE935;
  258. padding: 22rpx 20rpx;
  259. }
  260. }
  261. ::v-deep {
  262. uni-checkbox {
  263. height: 32rpx;
  264. }
  265. uni-checkbox .uni-checkbox-input {
  266. width: 30rpx;
  267. height: 30rpx;
  268. }
  269. uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
  270. transform: translate(-50%, -48%) scale(.60)
  271. }
  272. }
  273. </style>