specialAgreementPage.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. let listId = value.detail.value;
  115. this.jq.map(ele => {
  116. if (listId.includes(ele.id)) {
  117. ele.checked = true;
  118. } else {
  119. ele.checked = false;
  120. }
  121. return ele;
  122. })
  123. },
  124. checkboxChangesy(value) {
  125. let listId = value.detail.value;
  126. this.sy.map(ele => {
  127. if (listId.includes(ele.id)) {
  128. ele.checked = true;
  129. } else {
  130. ele.checked = false;
  131. }
  132. return ele;
  133. })
  134. },
  135. //取消
  136. cancel() {
  137. uni.navigateBack(-1)
  138. },
  139. //确定
  140. submit() {
  141. let pages = getCurrentPages(); //获取所有页面栈实例列表
  142. let nowPage = pages[pages.length - 1]; //当前页页面实例
  143. let prevPage = pages[pages.length - 2]; //上一页页面实例
  144. prevPage.$vm.specialInfoVo = this.ListData.filter(val => val.checked == true); //替换特约
  145. uni.navigateBack(-1)
  146. },
  147. tabsClick(e) {
  148. this.current = e.index;
  149. },
  150. async specialTermsList(id) {
  151. let res = await this.$http.post('/manager/clause/getClausePage', {
  152. clauseName: this.clauseName,
  153. companyId: id,
  154. pages: 1,
  155. riskCode: 'all',
  156. size: 100,
  157. });
  158. res.data.records.map(val => {
  159. val.checked = false;
  160. return val;
  161. })
  162. this.ListData = res.data.records;
  163. },
  164. back() {
  165. uni.navigateBack(-1)
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .page {
  172. background-color: #F8F8F8;
  173. height: 100%;
  174. }
  175. .header {
  176. padding: 96rpx 30rpx 16rpx;
  177. box-sizing: border-box;
  178. background-color: #FFFFFF;
  179. width: 100%;
  180. }
  181. /* 顶部提示 */
  182. .hint {
  183. width: 100%;
  184. padding: 10rpx 30rpx;
  185. box-sizing: border-box;
  186. background: #FFFBD7;
  187. font-size: 30rpx;
  188. color: #333;
  189. }
  190. .content {
  191. padding: 20rpx;
  192. box-sizing: border-box;
  193. /* 选项卡容器 */
  194. .contentTabs {
  195. flex: 1;
  196. display: flex;
  197. flex-direction: column;
  198. height: 100%;
  199. background: #FFFFFF;
  200. border-radius: 10rpx 10rpx 0rpx 0rpx;
  201. /* 滚动区域 */
  202. .scroll-content {
  203. height: calc(100vh - 520rpx);
  204. overflow-y: auto;
  205. padding: 0 20rpx;
  206. /* 增加底部留白 */
  207. box-sizing: border-box;
  208. /* 确保padding计入高度 */
  209. }
  210. }
  211. }
  212. // 特约内容样式
  213. .specialTermsList {
  214. padding: 30rpx 0;
  215. box-sizing: border-box;
  216. border-bottom: 1rpx solid #eee;
  217. .view {
  218. flex: 1;
  219. .name {
  220. font-size: 30rpx;
  221. color: #333;
  222. margin-bottom: 15rpx;
  223. }
  224. .Content {
  225. width: 100%;
  226. font-size: 28rpx;
  227. color: #666;
  228. flex: 1;
  229. }
  230. }
  231. }
  232. .footer {
  233. position: fixed;
  234. bottom: 0;
  235. left: 0;
  236. right: 0;
  237. padding: 25rpx 30rpx 55rpx;
  238. box-sizing: border-box;
  239. background: linear-gradient(0deg, #FFFFFF 0%, rgba(255, 254, 245, 0.7) 100%);
  240. border-radius: 0rpx 0rpx 0rpx 0rpx;
  241. backdrop-filter: blur(12rpx);
  242. .btn {
  243. width: 100%;
  244. background: #FDE935;
  245. padding: 25rpx 20rpx;
  246. box-sizing: border-box;
  247. border-radius: 58rpx 58rpx 58rpx 58rpx;
  248. font-size: 36rpx;
  249. color: #1F1F1F;
  250. margin: 0 10rpx;
  251. }
  252. //操作按钮特殊样式
  253. .btns {
  254. background: rgba(253, 233, 53, 0.2);
  255. border: 1rpx solid #FDE935;
  256. padding: 22rpx 20rpx;
  257. }
  258. }
  259. ::v-deep {
  260. uni-checkbox {
  261. height: 32rpx;
  262. }
  263. uni-checkbox .uni-checkbox-input {
  264. width: 30rpx;
  265. height: 30rpx;
  266. }
  267. uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
  268. transform: translate(-50%, -48%) scale(.60)
  269. }
  270. }
  271. </style>