aboutProduct.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="section about-product">
  3. <view class="section-title">
  4. <image :src="$static('images/crm_about/product.png')" class="icon" />
  5. <text class="title">
  6. 产品
  7. </text>
  8. </view>
  9. <view class="section-body">
  10. <template v-if="list.length > 0">
  11. <view class="list">
  12. <view
  13. v-for="(item, index) in list"
  14. :key="index"
  15. class="list-item"
  16. @click="handleTo(item.productId)">
  17. <view class="list-item-info">
  18. <view class="box">
  19. <text class="left name">
  20. {{ item.productName }}
  21. </text>
  22. <text class="right text">
  23. ¥{{ splitNumber(item.salesPrice) }}
  24. </text>
  25. </view>
  26. <view class="box">
  27. <text class="left text">
  28. 数量
  29. </text>
  30. <text class="right text">
  31. &times; {{ fixedNumber(item.num) }}
  32. </text>
  33. </view>
  34. <view class="box">
  35. <text class="left text">
  36. 折扣
  37. </text>
  38. <text class="right text">
  39. {{ item.discount || 0 }}%
  40. </text>
  41. </view>
  42. <view class="box">
  43. <text class="left text">
  44. 合计
  45. </text>
  46. <text class="right money">
  47. ¥{{ splitNumber(item.subtotal) }}
  48. </text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="statistics">
  54. <view class="box">
  55. <text class="left text">
  56. 整单折扣
  57. </text>
  58. <text class="right text">
  59. {{ discountRate }}%
  60. </text>
  61. </view>
  62. <view class="box">
  63. <text class="left text">
  64. 总计
  65. </text>
  66. <text class="right money">
  67. ¥{{ splitNumber(total) }}
  68. </text>
  69. </view>
  70. </view>
  71. </template>
  72. <template v-else>
  73. <view class="no-data">
  74. 暂无数据
  75. </view>
  76. </template>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import { splitNumber } from '@/utils/lib.js'
  82. export default {
  83. name: 'AboutProduct',
  84. props: {
  85. list: {
  86. type: Array,
  87. required: true
  88. },
  89. config: {
  90. type: Object,
  91. default: () => {}
  92. },
  93. discountRate: {
  94. type: [String, Number],
  95. default: ''
  96. },
  97. total: {
  98. type: [String, Number],
  99. default: ''
  100. }
  101. },
  102. data() {
  103. return {
  104. }
  105. },
  106. // #ifdef MP-WEIXIN
  107. options: {
  108. addGlobalClass: true
  109. },
  110. // #endif
  111. methods: {
  112. splitNumber(num) {
  113. if (isNaN(Number(num))) return ''
  114. return splitNumber(num)
  115. },
  116. fixedNumber(num, precision = 1) {
  117. if (!num) return 0
  118. return num.toFixed(precision)
  119. },
  120. handleTo(id) {
  121. const checkRes = this.$auth('crm.product.read')
  122. if (!checkRes) {
  123. this.$toast('权限不足!')
  124. return
  125. }
  126. this.$Router.navigateTo({
  127. url: '/pages_crm/product/detail',
  128. query: {
  129. id: id
  130. }
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped lang="scss">
  137. @import './style.scss';
  138. .box {
  139. padding: 5rpx 0;
  140. @include left;
  141. .left {
  142. flex: 1;
  143. }
  144. .name {
  145. font-size: $wk-font-large;
  146. font-weight: 500;
  147. color: $dark;
  148. }
  149. .money {
  150. font-size: $wk-font-sm;
  151. font-weight: bold;
  152. color: $warning;
  153. }
  154. .text {
  155. font-size: $wk-font-sm;
  156. color: $light;
  157. }
  158. }
  159. .list {
  160. padding: 0 32rpx;
  161. &-item {
  162. border-bottom: 1rpx solid $border-color;
  163. @include left;
  164. &-info {
  165. flex: 1;
  166. padding: 12rpx 0;
  167. }
  168. }
  169. .list-item:last-child {
  170. .list-item-info {
  171. border-bottom: 0 none;
  172. }
  173. }
  174. }
  175. .statistics {
  176. padding: 15rpx 32rpx;
  177. }
  178. </style>