interest.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="interest">
  3. <view class="giftList dis a-c j-f">
  4. <view :class="{ 'active':giftIndex === index, 'giftItem':giftIndex!=index }"
  5. v-for="(item, index) in giftList" :key="item.id" @click="handleSelectGift(item, index)">
  6. <view class="dis a-c j-c" style="font-size: 21rpx; color: #FF4141;">
  7. <view class="special">{{ item.totalPackagePrice }}</view>元
  8. </view>
  9. <view class="triangle">
  10. <view class="border"></view>
  11. <view class="text">{{ item.equityPackageName }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="dis a-c j-s tips">
  16. <view>
  17. <view>掌柜生活积分</view>
  18. <view>积分可兑换金豆,金豆可做下单时抵现消费。</view>
  19. </view>
  20. <view>{{ integral.toFixed(2) }}</view>
  21. </view>
  22. <view class="interestList">
  23. <view class="interestItem" v-for="(item, index) in localEquityPackageAssociationList">
  24. <view class="dis a-c j-s">
  25. <view class="name">{{ item.rightsName }}</view>
  26. <view class="count">{{ item.number }}张</view>
  27. </view>
  28. <view class="canUse">使用1家门店</view>
  29. <view class="dis a-c j-f" style="flex-direction: row;">
  30. <view class="dis a-c j-s"
  31. style="width: calc(100% - 244rpx); background-color: #FFF3F3; height: 50rpx;">
  32. <view class="money">权益价:{{ item.settlePrice }}元</view>
  33. <view class="special">市场价{{ item.marketPrice }}元</view>
  34. <image class="myIcon" src="/static/image/interest/icon.png"></image>
  35. </view>
  36. <view class="omit">每单立省{{ item.marketPrice - item.settlePrice }}元</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="footer dis a-c j-s" v-if="showBtn">
  41. <view>已选{{ giftList.length>0?giftList[giftIndex].totalPackagePrice:0 }}元权益包</view>
  42. <view class="submit" @click="handleConfirm()">确认选择</view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. giftList: [],
  51. giftIndex: 0,
  52. paramsObj: null,
  53. integral: 0,
  54. interestObj: null,
  55. localEquityPackageAssociationList: [],
  56. showBtn: true
  57. }
  58. },
  59. async onLoad(params) {
  60. if (params.params) {
  61. this.paramsObj = JSON.parse(params.params)
  62. console.log(11111111, this.paramsObj)
  63. let res = await this.$http.post('/equity/equityInfo', {
  64. pageNum: 1,
  65. pageSize: 99999,
  66. companyId: this.paramsObj.companyId
  67. })
  68. if (res.code == 200) {
  69. this.interestObj = res.data
  70. this.giftList = res.data.pageResult.content
  71. let obj = res.data.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  72. this.integral = (obj.totalAmount - this.giftList[this.giftIndex].threeSettlementPrice) * res.data.pointProportion
  73. this.localEquityPackageAssociationList = this.giftList[this.giftIndex]
  74. .localEquityPackageAssociationList
  75. if (res.data.equityInfoVo) {
  76. if (res.data.pageResult.content && res.data.pageResult.content.length > 0) {
  77. res.data.pageResult.content.forEach((item, index) => {
  78. if (res.data.equityInfoVo.id == item.id) {
  79. this.giftIndex = index
  80. }
  81. })
  82. }
  83. }
  84. } else {
  85. uni.showToast({
  86. title: res.msg,
  87. icon: "none",
  88. duration: 3000
  89. });
  90. }
  91. }
  92. if (params.id) {
  93. this.showBtn = false
  94. let res = await this.$http.post('/equity/equityInfo', {
  95. pageNum: 1,
  96. pageSize: 99999,
  97. companyId: params.id
  98. })
  99. if (res.code == 200) {
  100. this.interestObj = res.data
  101. this.giftList = res.data.pageResult.content
  102. let obj = res.data.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  103. this.integral = (obj.totalAmount - this.giftList[this.giftIndex].threeSettlementPrice) * res.data.pointProportion
  104. this.localEquityPackageAssociationList = this.giftList[this.giftIndex]
  105. .localEquityPackageAssociationList
  106. if (res.data.equityInfoVo) {
  107. if (res.data.pageResult.content && res.data.pageResult.content.length > 0) {
  108. res.data.pageResult.content.forEach((item, index) => {
  109. if (res.data.equityInfoVo.id == item.id) {
  110. this.giftIndex = index
  111. }
  112. })
  113. }
  114. }
  115. } else {
  116. uni.showToast({
  117. title: res.msg,
  118. icon: "none",
  119. duration: 3000
  120. });
  121. }
  122. } else {
  123. this.showBtn = true
  124. }
  125. },
  126. methods: {
  127. handleSelectGift(item, index) {
  128. if (this.showBtn) {
  129. this.giftIndex = index
  130. let obj = this.interestObj.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  131. this.integral = (obj.totalAmount - this.giftList[this.giftIndex].threeSettlementPrice) * this.interestObj.pointProportion
  132. this.localEquityPackageAssociationList = this.giftList[this.giftIndex]
  133. .localEquityPackageAssociationList
  134. }
  135. },
  136. handleConfirm() {
  137. let params = JSON.stringify(this.paramsObj)
  138. let item = JSON.stringify(this.giftList[this.giftIndex])
  139. let obj = this.interestObj.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  140. this.$http.post('/equity/saveEquity', {
  141. companyId: this.paramsObj.companyId,
  142. receiveType: this.paramsObj.accept.type === '车主' ? 2 : this.paramsObj.accept.type === '投保人' ?
  143. 0 : 1,
  144. receiveName: this.paramsObj.accept.name,
  145. receivePhone: this.paramsObj.accept.mobile,
  146. receiveIdentify: this.paramsObj.accept.identifyNumber,
  147. orderMoney: obj.totalAmount,
  148. point: this.integral.toFixed(2),
  149. equityInfo: this.giftList[this.giftIndex]
  150. }).then(res => {
  151. if (res.code === 200) {
  152. uni.navigateTo({
  153. url: `/pages/carInsure/premiumCalc?orderno=${this.paramsObj.orderno}`
  154. })
  155. } else {
  156. uni.showToast({
  157. title: res.msg,
  158. icon: "none",
  159. duration: 3000
  160. });
  161. }
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. @import '@/style/mixin.scss';
  169. .interest {
  170. width: 100%;
  171. height: calc(100vh - 88rpx);
  172. background-color: #F8FAFE;
  173. overflow-y: auto;
  174. .giftList {
  175. padding: 20rpx 30rpx;
  176. width: 100%;
  177. overflow-x: auto;
  178. flex-wrap: nowrap;
  179. .giftItem {
  180. width: 158rpx;
  181. border-radius: 10rpx;
  182. margin-right: 20rpx;
  183. background-color: #FFF3EA;
  184. flex: 0 0 auto;
  185. text-align: center;
  186. opacity: .8;
  187. .special {
  188. font-size: 42rpx;
  189. color: #FF4141;
  190. }
  191. .triangle {
  192. background-color: #FF4141;
  193. height: 60rpx;
  194. color: #ffffff;
  195. border-radius: 0 0 10rpx 10rpx;
  196. .border {
  197. width: 0;
  198. height: 0;
  199. border-top: 10rpx solid #FFF3EA;
  200. border-bottom: 0 solid transparent;
  201. border-left: 79rpx solid transparent;
  202. border-right: 79rpx solid transparent;
  203. }
  204. .text {
  205. font-size: 24rpx;
  206. line-height: 50rpx;
  207. }
  208. }
  209. }
  210. .active {
  211. width: 154rpx;
  212. border-radius: 10rpx;
  213. border: 4rpx solid #FF4141;
  214. margin-right: 20rpx;
  215. background-color: #FFF3EA;
  216. flex: 0 0 auto;
  217. text-align: center;
  218. .special {
  219. font-size: 42rpx;
  220. color: #FF4141;
  221. }
  222. .triangle {
  223. background-color: #FF4141;
  224. height: 56rpx;
  225. color: #ffffff;
  226. .border {
  227. width: 0;
  228. height: 0;
  229. border-top: 10rpx solid #FFF3EA;
  230. border-bottom: 0 solid transparent;
  231. border-left: 74rpx solid transparent;
  232. border-right: 74rpx solid transparent;
  233. }
  234. .text {
  235. font-size: 24rpx;
  236. line-height: 48rpx;
  237. }
  238. }
  239. }
  240. }
  241. .tips {
  242. padding: 20rpx 30rpx;
  243. margin-top: 20rpx;
  244. background-color: #ffffff;
  245. }
  246. .interestList {
  247. padding: 20rpx 30rpx;
  248. margin-top: 20rpx;
  249. background-color: #ffffff;
  250. .interestItem {
  251. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0, 0, 0, 0.1);
  252. border-radius: 10rpx 10rpx 10rpx 10rpx;
  253. padding: 30rpx 20rpx;
  254. font-size: 31rpx;
  255. color: #333333;
  256. .count {
  257. font-size: 29rpx;
  258. color: #FF4141;
  259. }
  260. .canUse {
  261. font-size: 24rpx;
  262. color: #999999;
  263. margin: 10rpx 0;
  264. }
  265. .money {
  266. color: #FF4141;
  267. margin-right: 26rpx;
  268. padding-left: 10rpx;
  269. }
  270. .special {
  271. color: #FF4141;
  272. font-size: 24rpx;
  273. }
  274. .myIcon {
  275. width: 38rpx;
  276. height: 50rpx;
  277. }
  278. .omit {
  279. background-color: #FF4141;
  280. color: #ffffff;
  281. width: 244rpx;
  282. text-align: center;
  283. }
  284. }
  285. }
  286. .footer {
  287. width: 100%;
  288. padding: 20rpx 30rpx;
  289. margin-top: 20rpx;
  290. background-color: #ffffff;
  291. position: fixed;
  292. bottom: 0;
  293. left: 0;
  294. border-top: 1rpx solid #eeeeee;
  295. .submit {
  296. background-color: #0052FF;
  297. color: #ffffff;
  298. padding: 4rpx 18rpx;
  299. border-radius: 4rpx;
  300. font-size: 29rpx;
  301. }
  302. }
  303. }
  304. </style>