customerInterest.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="cuetomerInterest">
  3. <view class="shopKeeper mt-2">
  4. <view class="item dis a-c j-s">
  5. <view class="dis a-c ">
  6. <text>优惠金额</text>
  7. </view>
  8. <view>{{ `¥${ discounts.toFixed(2) }` }}</view>
  9. </view>
  10. <view class="item dis a-c j-s" @click="handleSelectPeople()">
  11. <view class="dis a-c">
  12. <text>接收客户</text>
  13. </view>
  14. <view class="dis a-c j-s">
  15. <text>{{ acceptCustomer?`${acceptCustomer.name}-${acceptCustomer.mobile}`:'' }}</text>
  16. <image src="/static/image/my/right-jiantou.png" mode="" style="width: 15px;height: 15px;"></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="interest">
  21. <view class="dis a-c j-s">
  22. <view>客户权益</view>
  23. <view class="select" @click="handleSelectInterest()">去选择</view>
  24. </view>
  25. <view class="tips">您可使用本次订单优惠金额为客户选择价值{{ interestItem.totalPackagePrice }}元的客户权益</view>
  26. </view>
  27. <view class="giveUp dis a-c j-s">
  28. <view>{{ interestItem?interestItem.equityPackageName:'' }}权益包</view>
  29. <view v-if="interestItem.localEquityPackageAssociationList" @click="handleGiveUp()" style="color: #343EEF;">放弃客户权益</view>
  30. </view>
  31. <view class="interestList">
  32. <view class="interestItem" v-for="(item, index) in interestItem.localEquityPackageAssociationList">
  33. <view class="dis a-c j-s">
  34. <view class="name">{{ item.rightsName }}</view>
  35. <view class="count">{{ item.number }}张</view>
  36. </view>
  37. <view class="canUse">使用1家门店</view>
  38. <view class="dis a-c j-f" style="flex-direction: row;">
  39. <view class="dis a-c j-s" style="width: calc(100% - 244rpx); background-color: #FFF3F3; height: 50rpx;">
  40. <view class="money">权益价:{{ item.settlePrice }}元</view>
  41. <view class="special">市场价{{ item.marketPrice }}元</view>
  42. <image class="myIcon" src="/static/image/interest/icon.png"></image>
  43. </view>
  44. <view class="omit">每单立省{{ item.marketPrice - item.settlePrice }}元</view>
  45. </view>
  46. </view>
  47. </view>
  48. <uni-popup ref='popup' type="bottom">
  49. <view class="popup">
  50. <view class="dis a-c j-c title">
  51. <view>选择接收客户</view>
  52. <view class="close" @click="closePopup()">
  53. <uni-icons type='closeempty' size='16'></uni-icons>
  54. </view>
  55. </view>
  56. <view class="list">
  57. <view class="dis a-c j-s radio" v-for="(item, index) in paramsObj.option" @click='handleAcceptCustomer(item, index)'>
  58. <view>
  59. <view>{{ item.type }}</view>
  60. <view>{{ `${item.name}-${item.mobile}` }}</view>
  61. </view>
  62. <radio :value="item.identifyNumber" :checked="acceptIndex === index" />
  63. </view>
  64. </view>
  65. </view>
  66. </uni-popup>
  67. </view>
  68. </template>
  69. <script>
  70. import uniIcons from '../../components/uni-icons/components/uni-icons/uni-icons.vue'
  71. export default {
  72. components: {
  73. uniIcons
  74. },
  75. data() {
  76. return {
  77. paramsObj: null,
  78. acceptCustomer: null,
  79. acceptIndex: '',
  80. discounts: 0,
  81. interestItem: {
  82. localEquityPackageAssociationList: []
  83. }
  84. }
  85. },
  86. async onLoad(params) {
  87. this.paramsObj = JSON.parse(params.params)
  88. if(params.params) {
  89. let res = await this.$http.post('/equity/equityInfo', {
  90. pageNum: 1,
  91. pageSize: 10,
  92. companyId: this.paramsObj.companyId
  93. })
  94. if(res.code == 200) {
  95. let obj = res.data.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  96. this.discounts = obj.totalAmount
  97. if(res.data.equityInfoVo) {
  98. this.interestItem = res.data.equityInfoVo
  99. } else {
  100. this.interestItem = res.data.pageResult.content.reduce((max, obj) => Math.max(max, obj.totalPackagePrice), -Infinity)
  101. }
  102. if(res.data.equity) {
  103. if(res.data.equity.receiveName && res.data.equity.receivePhone) {
  104. this.acceptCustomer = {
  105. name: res.data.equity.receiveName,
  106. mobile: res.data.equity.receivePhone,
  107. identifyNumber: res.data.equity.receiveIdentify
  108. }
  109. } else {
  110. this.acceptCustomer = null
  111. }
  112. }
  113. } else {
  114. uni.showToast({
  115. title: res.msg,
  116. icon: "error",
  117. duration: 3000
  118. });
  119. }
  120. }
  121. },
  122. methods: {
  123. handleSelectInterest() {
  124. if(this.acceptCustomer) {
  125. let params = JSON.stringify({
  126. ...this.paramsObj,
  127. accept: { ...this.acceptCustomer }
  128. })
  129. uni.navigateTo({
  130. url: `/pages/carInsure/interest?params=${params}`
  131. })
  132. } else {
  133. uni.showToast({
  134. title: '请选择接收人',
  135. duration: 2000,
  136. icon: 'error'
  137. })
  138. }
  139. },
  140. handleGiveUp() {
  141. this.$http.post(`/equity/delEquity?companyId=${this.paramsObj.companyId}`).then(res => {
  142. if(res.code === 200) {
  143. let obj = res.data.feeOrderNewVo.exportFee.find(a => a.insuranceType === '合计')
  144. this.discounts = obj.totalAmount
  145. if(res.data.equityInfoVo) {
  146. this.interestItem = res.data.equityInfoVo
  147. } else {
  148. this.interestItem = res.data.pageResult.content.reduce((max, obj) => Math.max(max, obj.totalPackagePrice), -Infinity)
  149. }
  150. } else {
  151. uni.showToast({
  152. title: res.msg,
  153. icon: "none",
  154. duration: 3000
  155. });
  156. }
  157. })
  158. this.interestItem.localEquityPackageAssociationList = []
  159. },
  160. handleSelectPeople() {
  161. this.$refs.popup.open()
  162. },
  163. closePopup() {
  164. this.$refs.popup.close()
  165. },
  166. handleAcceptCustomer(item, index) {
  167. this.acceptIndex = index
  168. this.acceptCustomer = item
  169. }
  170. },
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. @import '@/style/mixin.scss';
  175. .cuetomerInterest{
  176. width: 100%;
  177. height: calc(100vh - 88rpx);
  178. background-color: #F8FAFE;
  179. overflow-y: auto;
  180. .shopKeeper {
  181. background-color: #ffffff;
  182. .item {
  183. padding: 25rpx 30rpx;
  184. color: #333;
  185. font-size: 28rpx;
  186. border-top: 1px solid #EEEEEE;
  187. image {
  188. width: 40rpx;
  189. height: 40rpx;
  190. }
  191. }
  192. }
  193. .interest{
  194. padding: 20rpx 30rpx;
  195. margin: 20rpx 0;
  196. background-color: #ffffff;
  197. color: #333333;
  198. font-size: 33rpx;
  199. .tips{
  200. text-align: left;
  201. color: #666666;
  202. font-size: 29rpx;
  203. }
  204. .select{
  205. background-color: #0052FF;
  206. color: #ffffff;
  207. padding: 4rpx 18rpx;
  208. border-radius: 4rpx;
  209. font-size: 29rpx;
  210. }
  211. }
  212. .giveUp{
  213. padding: 0 30rpx;
  214. }
  215. .interestList{
  216. padding: 20rpx 30rpx;
  217. margin-top: 20rpx;
  218. background-color: #ffffff;
  219. .interestItem{
  220. box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(0,0,0,0.1);
  221. border-radius: 10rpx 10rpx 10rpx 10rpx;
  222. padding: 30rpx 20rpx;
  223. font-size: 31rpx;
  224. color: #333333;
  225. .count{
  226. font-size: 29rpx;
  227. color: #FF4141 ;
  228. }
  229. .canUse{
  230. font-size: 24rpx;
  231. color: #999999;
  232. margin: 10rpx 0;
  233. }
  234. .money{
  235. color: #FF4141;
  236. margin-right: 26rpx;
  237. padding-left: 10rpx;
  238. }
  239. .special{
  240. color: #FF4141;
  241. font-size: 24rpx;
  242. }
  243. .myIcon{
  244. width: 38rpx;
  245. height: 50rpx;
  246. }
  247. .omit{
  248. background-color: #FF4141;
  249. color: #ffffff;
  250. width: 244rpx;
  251. text-align: center;
  252. }
  253. }
  254. }
  255. .peoplePopup{
  256. height: 300rpx;
  257. background-color: #ffffff;
  258. }
  259. .popup{
  260. width: 100%;
  261. height: 600rpx;
  262. background-color: #ffffff;
  263. .title{
  264. padding: 27rpx 0;
  265. color: #333333;
  266. font-size: 34rpx;
  267. position: relative;
  268. .close{
  269. position: absolute;
  270. top: 20rpx;
  271. right: 20rpx;
  272. }
  273. }
  274. .list{
  275. height: calc(100% - 100rpx);
  276. overflow-y: auto;
  277. .radio{
  278. padding: 28rpx 20px;
  279. border-top: 1px solid #eeeeee;
  280. }
  281. }
  282. }
  283. }
  284. </style>