<!--packageI/cps/conponent/cpslist.wxml-->
<wxs module="util">
  var getRatio = function (discount_price, tk_rate, ratio) { if(discount_price && tk_rate && ratio) { return (discount_price * (tk_rate/100) * 0.78 * 0.97 * (ratio/100)).toFixed(2) } else { return ""} };
  module.exports.getRatio = getRatio;
</wxs>
<view class="cpslist" wx:for="{{datas}}" wx:key="index" wx:for-item="good" catchtap="toGood" data-item="{{good}}">
  <view class="left">
    <image src="{{good.cover_image}}"></image>
  </view>
  <view class="right">
    <view class="top_rol">
      <view class="top_rol_name">{{good.shop_name}}</view>
      <view class="top_rol_sale">月销 {{good.month_sales}}</view>
    </view>
    <view class="top_rol_title">
      <view class="top_rol_platform">{{good.platform_id == 2 ? '拼多多' : '京东'}}</view>
      <span>{{good.title}}</span>
    </view>
    <view class="top_rol_price">
      <view class="currentPrice">
        <span class="sym">￥</span><span>{{good.discount_price}}</span>
        <span class="originalPrice" wx:if="{{good.price > good.discount_price}}">原价￥{{good.price}}</span>
      </view>
    </view>
    <view class="discounts">
      <view class="couponBox" wx:if="{{good.coupon_money > 0}}">
        <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/cps/5y.png"></image>
        {{good.coupon_money}}元券
      </view>
      <view class="earnings" wx:if="{{good.discount_price > 0 && good.tk_rate && ratio_data.ratio}}">预估{{util.getRatio(good.discount_price , good.tk_rate, ratio_data.ratio)}}{{ratio_data.ratio_name}}</view>
    </view>
  </view>
</view>
