Browse Source

2023-4-25

cmy 1 year ago
parent
commit
5782b98d56
3 changed files with 59 additions and 9 deletions
  1. 9 0
      api/model.js
  2. 15 0
      pages/user/model/model.vue
  3. 35 9
      pages/user/model/mymodellist.vue

+ 9 - 0
api/model.js

@@ -88,6 +88,15 @@ export function userShowTemplateList(data) {
 		method: 'post',
 		data
 	});
+}
+
+//默认模板
+export function setShowTemplate(data) {
+	return request({
+		url: '/api/user/setShowTemplate',
+		method: 'post',
+		data
+	});
 }
 
 //获取本人用户名片信息

+ 15 - 0
pages/user/model/model.vue

@@ -319,6 +319,21 @@
 						success: function(res) {
 							// obj.paySuccessTo();
 							// alert('支付成功')
+							uni.showModal({
+								title: '提示',
+								content: '支付成功!',
+								cancelText: '关闭',
+								confirmText: '查看模板',
+								success: res => {
+									if(res.confirm){
+										uni.reLaunch({
+											url: '/pages/user/model/model?mtype='+that.mtype,
+										});
+									}
+								},
+								fail: () => {},
+								complete: () => {}
+							});
 							console.log('支付成功')
 						},
 						fail: (err) => {

+ 35 - 9
pages/user/model/mymodellist.vue

@@ -2,7 +2,8 @@
 	<view class="indexBox">
 		<view class="hot-list-box">
 			<view class="list-box">
-				<view class="list" v-for="(item,index) in navList.orderList">
+				<view class="list" @click="navTo('/pages/user/model/model?mtype=' + item.show_template_id)"
+					v-for="(item,index) in navList.orderList">
 					<view class="list-image-box">
 						<image class="list-image" :src="item.img" mode="widthFix"></image>
 					</view>
@@ -10,10 +11,11 @@
 						<view class="list-title clamp">
 							{{item.title}}
 						</view>
-						<view class="list-money flex flex-start">
-							<view class="money">
-								¥{{item.price}}
-							</view>
+						<view v-if="item.is_default==0" class="list-money action" @click.stop="setmodel(item)">
+							设为默认
+						</view>
+						<view v-else class="list-money" @click.stop="">
+							默认模板
 						</view>
 					</view>
 				</view>
@@ -32,7 +34,8 @@
 		share
 	} from '@/api/wx';
 	import {
-		userShowTemplateList
+		userShowTemplateList,
+		setShowTemplate
 	} from '@/api/model.js';
 	export default {
 		data() {
@@ -56,6 +59,21 @@
 			this.getList();
 		},
 		methods: {
+			// 设为默认
+			setmodel(item) {
+				setShowTemplate({
+						show_template_id: item.show_template_id
+					})
+					.then((res) => {
+						item.is_default=1;
+						uni.showToast({
+							title:res.msg
+						})
+					})
+					.catch(e => {
+
+					});
+			},
 			// 获取模板列表
 			getList(source) {
 				//这里是将订单挂载到tab列表下
@@ -158,6 +176,7 @@
 				.list-content {
 					padding: 20rpx;
 					line-height: 1;
+
 					.list-title {
 						color: $font-color-dark;
 						font-size: $font-base;
@@ -165,9 +184,16 @@
 					}
 
 					.list-money {
-						.money {
-							font: $font-lg;
-							color: #FF3342;
+						border-radius: 10rpx;
+						padding: 20rpx 20rpx;
+						background: linear-gradient(to bottom, #ff629f, rgba(255, 98, 159, 0.5));
+						text-align: center;
+						font-size: $font-lg;
+						font-weight: bold;
+						color: #FFFFFF;
+						&.action{
+							background: #FFFFFF;
+							color: $font-color-dark;
 						}
 					}
 				}