123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <template>
- <view class="section about-product">
- <view class="section-title">
- <image :src="$static('images/crm_about/product.png')" class="icon" />
- <text class="title">
- 产品
- </text>
- </view>
- <view class="section-body">
- <template v-if="list.length > 0">
- <view class="list">
- <view
- v-for="(item, index) in list"
- :key="index"
- class="list-item"
- @click="handleTo(item.productId)">
- <view class="list-item-info">
- <view class="box">
- <text class="left name">
- {{ item.productName }}
- </text>
- <text class="right text">
- ¥{{ splitNumber(item.salesPrice) }}
- </text>
- </view>
- <view class="box">
- <text class="left text">
- 数量
- </text>
- <text class="right text">
- × {{ fixedNumber(item.num) }}
- </text>
- </view>
- <view class="box">
- <text class="left text">
- 折扣
- </text>
- <text class="right text">
- {{ item.discount || 0 }}%
- </text>
- </view>
- <view class="box">
- <text class="left text">
- 合计
- </text>
- <text class="right money">
- ¥{{ splitNumber(item.subtotal) }}
- </text>
- </view>
- </view>
- </view>
- </view>
- <view class="statistics">
- <view class="box">
- <text class="left text">
- 整单折扣
- </text>
- <text class="right text">
- {{ discountRate }}%
- </text>
- </view>
- <view class="box">
- <text class="left text">
- 总计
- </text>
- <text class="right money">
- ¥{{ splitNumber(total) }}
- </text>
- </view>
- </view>
- </template>
- <template v-else>
- <view class="no-data">
- 暂无数据
- </view>
- </template>
- </view>
- </view>
- </template>
- <script>
- import { splitNumber } from '@/utils/lib.js'
- export default {
- name: 'AboutProduct',
- props: {
- list: {
- type: Array,
- required: true
- },
- config: {
- type: Object,
- default: () => {}
- },
- discountRate: {
- type: [String, Number],
- default: ''
- },
- total: {
- type: [String, Number],
- default: ''
- }
- },
- data() {
- return {
- }
- },
- // #ifdef MP-WEIXIN
- options: {
- addGlobalClass: true
- },
- // #endif
- methods: {
- splitNumber(num) {
- if (isNaN(Number(num))) return ''
- return splitNumber(num)
- },
- fixedNumber(num, precision = 1) {
- if (!num) return 0
- return num.toFixed(precision)
- },
- handleTo(id) {
- const checkRes = this.$auth('crm.product.read')
- if (!checkRes) {
- this.$toast('权限不足!')
- return
- }
- this.$Router.navigateTo({
- url: '/pages_crm/product/detail',
- query: {
- id: id
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- @import './style.scss';
- .box {
- padding: 5rpx 0;
- @include left;
- .left {
- flex: 1;
- }
- .name {
- font-size: $wk-font-large;
- font-weight: 500;
- color: $dark;
- }
- .money {
- font-size: $wk-font-sm;
- font-weight: bold;
- color: $warning;
- }
- .text {
- font-size: $wk-font-sm;
- color: $light;
- }
- }
- .list {
- padding: 0 32rpx;
- &-item {
- border-bottom: 1rpx solid $border-color;
- @include left;
- &-info {
- flex: 1;
- padding: 12rpx 0;
- }
- }
- .list-item:last-child {
- .list-item-info {
- border-bottom: 0 none;
- }
- }
- }
- .statistics {
- padding: 15rpx 32rpx;
- }
- </style>
|