tyb vor 2 Monaten
Ursprung
Commit
f32310641a
2 geänderte Dateien mit 23 neuen und 2 gelöschten Zeilen
  1. 3 2
      pages/ucenter/couponList/couponList.wxml
  2. 20 0
      utils/tools.wxs

+ 3 - 2
pages/ucenter/couponList/couponList.wxml

@@ -1,3 +1,4 @@
+<wxs src="../../../utils/tools.wxs" module="tools" />
 <view class="container">
 
   <!-- <view class="h">
@@ -144,11 +145,11 @@
 
 <view class="pup-up-coupon"  bindtap="closePupCoupon" wx:if='{{showTc}}'>
 		<view class="tc" catchtap="drawDown">
-		<view class="pkName">{{couponPackage.pkName}}</view>
+		<view class="pkName">{{couponPackage.pkName.length>8?tools.subStr(couponPackage.pkName,0,8):couponPackage.pkName}}</view>
 		<view class="num">{{couponPackage.pkNumber}}</view>
 		<view class="box">
 		<!-- <view class="money">7.9<span>折</span></view> -->
-			<view class="{{coupon.voucherType==3?'couponName':'money'}}">{{coupon.voucherType==3?coupon.name:coupon.discount}}
+			<view class="{{coupon.voucherType==3?'couponName':'money'}}">{{coupon.voucherType==3?(coupon.name.length>6?tools.subStr(coupon.name,0,6):coupon.name):coupon.discount}}
 			<span wx:if="{{coupon.voucherType!=3}}">{{coupon.voucherType==1?'元':'折'}}</span>
 			</view>
 			<view class="couponNameDesc">{{coupon.voucherType==3?'无门槛立即兑换':'满'+coupon.min+'元可用'}}</view> 

+ 20 - 0
utils/tools.wxs

@@ -0,0 +1,20 @@
+var subStr = function (val, start, stop) {
+  if (val) {
+    return val.substring(start, stop)
+  } else {
+    return ''
+  }
+}
+
+var subDate = function (val) {
+  if (val) {
+    return val.substring(0, 10)
+  } else {
+    return ''
+  }
+}
+
+module.exports = {
+  subStr: subStr,
+  subDate: subDate
+};