shish 1 час назад
Родитель
Сommit
d2547b9a45

+ 1 - 1
ghsApp/src/admin/billing/affirmForward.vue

@@ -116,7 +116,7 @@
               <!-- 售后转冲销单时,原单已支付,退款方式锁定为原单支付渠道,只读展示 -->
               <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-if="lockPayWay">
                 <view class="tui-title">退款方式</view>
-                <view class="tui-input" style="color: #3385ff; font-weight: bold">{{ lockPayWayName }}(原单支付方式,不可修改)</view>
+                <view class="tui-input" style="color: #3385ff; font-weight: bold">{{ lockPayWayName }}</view>
               </tui-list-cell>
               <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-else>
                 <view class="tui-title">退款方式</view>

+ 23 - 8
ghsApp/src/admin/billing/forwardResult.vue

@@ -8,8 +8,11 @@
     <button class="admin-button-com big" style="background-color: green;border-color: green;color:white;" @click="gotoOrderDetail">订单详情</button>
     <button class="admin-button-com big" @click="goBackHome">返回首页</button>
 
-    <!-- 离屏画布,用于绘制退款凭证海报,绘制完成后导出为图片再展示 -->
-    <canvas canvas-id="forwardPosterCanvas" style="width: 360px; height: 560px; position: fixed; left: -9999px; top: -9999px; z-index: -1;"></canvas>
+    <!-- 离屏画布:宽高与 drawPoster 一致;导出时也必须按此尺寸,否则整图会被纵向压扁 -->
+    <canvas
+      canvas-id="forwardPosterCanvas"
+      :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', position: 'fixed', left: '-9999px', top: '-9999px', zIndex: -1 }"
+    ></canvas>
     <item-poster-popup ref="itemPosterPopup" :poster-url="posterUrl" @close="closePoster" @save="savePosterImg" />
   </appResult>
 </template>
@@ -42,7 +45,10 @@ export default {
       customId: 0,
       customName: '',
       customBalance: 0,
-      posterUrl: ''
+      posterUrl: '',
+      //画布逻辑宽高(与绘制坐标一致),导出时也必须用这对尺寸,避免压扁
+      canvasWidth: 360,
+      canvasHeight: 640
     };
   },
   onLoad(option) {
@@ -97,9 +103,12 @@ export default {
     drawPoster(qrPath) {
       let that = this;
       const ctx = uni.createCanvasContext('forwardPosterCanvas', this);
-      const width = 360;
-      const height = 560;
+      const width = this.canvasWidth;
+      //画布高度需覆盖小程序码下方提示文案,560时底部会被裁切只露出半行字
+      const height = this.canvasHeight;
       const radius = 20;
+      //导出按设备像素比放大,避免模糊;宽高必须与绘制一致,否则整图会被纵向压扁
+      const pixelRatio = Math.max((uni.getSystemInfoSync() && uni.getSystemInfoSync().pixelRatio) || 2, 2);
 
       ctx.save();
       ctx.beginPath();
@@ -174,16 +183,16 @@ export default {
       ctx.setFillStyle('#666666');
       ctx.fillText(dayjs().format('YYYY-MM-DD HH:mm'), width - 30, 368);
 
-      //二维码
+      //小程序码:底部留足空间画「长按识别」提示,避免贴底被圆角裁切
       const qrSize = 150;
       const qrX = (width - qrSize) / 2;
-      const qrY = 390;
+      const qrY = 400;
       ctx.drawImage(qrPath, qrX, qrY, qrSize, qrSize);
 
       ctx.setFontSize(20);
       ctx.setFillStyle('#666666');
       ctx.setTextAlign('center');
-      ctx.fillText('长按识别,查看余额明细', width / 2, qrY + qrSize + 30);
+      ctx.fillText('长按识别,查看余额明细', width / 2, qrY + qrSize + 36);
 
       ctx.restore();
 
@@ -193,6 +202,12 @@ export default {
           uni.canvasToTempFilePath(
             {
               canvasId: 'forwardPosterCanvas',
+              x: 0,
+              y: 0,
+              width: width,
+              height: height,
+              destWidth: width * pixelRatio,
+              destHeight: height * pixelRatio,
               fileType: 'jpg',
               quality: 1,
               success: (res) => {

+ 6 - 6
ghsApp/src/components/forward-options-popup.vue

@@ -17,22 +17,22 @@
 
 			<view class="forward-popup__row">
 				<view class="forward-popup__label">退款方式</view>
-				<view class="forward-popup__value forward-popup__value--locked">{{ payWayName || '原支付方式' }}(原单支付方式,不可修改)</view>
+				<view class="forward-popup__value forward-popup__value--locked">{{ payWayName || '原支付方式' }}</view>
 			</view>
 
 			<view class="forward-popup__row">
 				<view class="forward-popup__label">退货方式</view>
 				<view class="forward-popup__value">
-					<button
-						class="admin-button-com middle forward-popup__btn"
-						:class="forwardStock === 0 ? 'blue' : 'default'"
-						@click="forwardStock = 0"
-					>库存退回</button>
 					<button
 						class="admin-button-com middle forward-popup__btn"
 						:class="forwardStock === 1 ? 'blue' : 'default'"
 						@click="forwardStock = 1"
 					>库存不退</button>
+					<button
+						class="admin-button-com middle forward-popup__btn"
+						:class="forwardStock === 0 ? 'blue' : 'default'"
+						@click="forwardStock = 0"
+					>库存退回</button>
 				</view>
 			</view>