谢杰标 2 жил өмнө
parent
commit
fe1ca94dc0

+ 12 - 1
pages/actdetail/index.vue

@@ -70,7 +70,7 @@
         </view>
       </view>
     </view>
-    <view class="actdetail-btn" v-if="detailInfo.status == 1">
+    <view class="actdetail-btn" v-if="isShowBtn()">
       <u-button
         class="c_btn"
         text="生成专属海报"
@@ -113,6 +113,17 @@ export default {
         });
       });
     },
+	isShowBtn(){
+		let {startTime,endTime,status} = this.detailInfo
+		if(status!=1){
+			return false
+		}
+		let nowTime = Date.parse(new Date()) / 1000;
+		if(nowTime < startTime || nowTime > endTime){
+			return false
+		}
+		return true
+	}
   },
 };
 </script>

+ 11 - 1
pages/actlist/index.vue

@@ -21,7 +21,7 @@
           <view>{{ item.endTime | formate("yyyy-mm-dd hh:mm") }}</view>
         </view>
       </view>
-      <template v-if="item.status == 1">
+      <template v-if="isShowBtn(item)">
         <view class="line"></view>
         <view class="act-ward-box-btn">
           <text></text>
@@ -78,6 +78,16 @@ export default {
         url: "/pages/actdetail/index?id=" + distributionId,
       });
     },
+	isShowBtn({startTime,endTime,status}){
+		if(status!=1){
+			return false
+		}
+		let nowTime = Date.parse(new Date()) / 1000;
+		if(nowTime < startTime || nowTime > endTime){
+			return false
+		}
+		return true
+	}
   },
   onLoad(option) {},
   onShow() {

+ 185 - 191
pages/bill/index.vue

@@ -1,204 +1,198 @@
 <template>
-  <view class="bill-ward">
-    <view class="bill-head" v-if="userInfo">
-      <image
-        :src="
+	<view class="bill-ward">
+		<view class="bill-head" v-if="userInfo">
+			<image :src="
           userInfo.avatar
             ? $method.splitImgHost(userInfo.avatar, true)
             : defaultHead
-        "
-      ></image>
-    </view>
-    <view
-      v-for="(item, index) in posterConfig"
-      :key="index"
-      :style="backPosition(item)"
-    >
-      <image
-        :style="item.css"
-        v-if="(item.type == 0 || item.type == 2) && item.checked"
-        :src="$method.splitImgHost(item.name)"
-        mode=""
-      />
+        "></image>
+		</view>
+		<view v-for="(item, index) in posterConfig" :key="index" :style="backPosition(item)">
+			<image :style="item.css" v-if="(item.type == 0 || item.type == 2) && item.checked"
+				:src="$method.splitImgHost(item.name)" mode="" />
 
-      <view
-        :style="item.css"
-        v-if="item.type == 1"
-        style="white-space: pre-wrap"
-      >
-        {{ item.name }}
-      </view>
+			<view :style="item.css" v-if="item.type == 1" style="white-space: pre-wrap">
+				{{ item.name }}
+			</view>
 
-      <view class="code-box" v-if="item.type == 3 && item.checked">
-        <tki-qrcode
-          :cid="item.codeUrl"
-          ref="qrcode"
-          :val="item.codeUrl"
-          :size="item.height * 2 - 20"
-          unit="upx"
-          background="#ffffff"
-          foreground="#000000"
-          pdground="#000000"
-          :lv="3"
-          :onval="true"
-          :loadMake="true"
-        />
-      </view>
-    </view>
-  </view>
+			<view class="code-box" v-if="item.type == 3 && item.checked">
+				<tki-qrcode :cid="item.codeUrl" ref="qrcode" :val="item.codeUrl" :size="item.height * 2 - 20" unit="upx"
+					background="#ffffff" foreground="#000000" pdground="#000000" :lv="3" :onval="true"
+					:loadMake="true" />
+			</view>
+		</view>
+	</view>
 </template>
 
 <script>
-import { getSharePoster, bindLink } from "@/utils/bill";
-import { authorize, backOpenId } from "@/common/authorize";
-import { openidLogin } from "@/utils/login";
-import { mapGetters } from "vuex";
-import tkiQrcode from "tki-qrcode";
-import wechat from "@/common/wechat";
-export default {
-  data() {
-    return {
-      options: {},
-      posterConfig: [],
-      billDetail: {},
-      bg: {},
-      defaultHead: require("../../static/image/defhead.png"),
-    };
-  },
-  onLoad(options) {
-    this.options = options;
-    uni.setStorageSync("BillHerf", window.location.href);
-  },
-  onShow() {
-    this.backUrl();
-    backOpenId(this.login);
-    authorize();
-    this.getSharePoster();
-  },
-  components: {
-    tkiQrcode,
-  },
+	import {
+		getSharePoster,
+		bindLink
+	} from "@/utils/bill";
+	import {
+		authorize,
+		backOpenId
+	} from "@/common/authorize";
+	import {
+		openidLogin
+	} from "@/utils/login";
+	import {
+		mapGetters
+	} from "vuex";
+	import tkiQrcode from "tki-qrcode";
+	import wechat from "@/common/wechat";
+	export default {
+		data() {
+			return {
+				options: {},
+				posterConfig: [],
+				billDetail: {},
+				bg: {},
+				defaultHead: require("../../static/image/defhead.png"),
+			};
+		},
+		onLoad(options) {
+			this.options = options;
+			uni.setStorageSync("BillHerf", window.location.href);
+		},
+		onShow() {
+			this.backUrl();
+			backOpenId(this.login);
+			authorize();
+			this.getSharePoster();
+		},
+		components: {
+			tkiQrcode,
+		},
 
-  methods: {
-    getSharePoster() {
-      getSharePoster(this.options).then((res) => {
-        let nowTime = Date.parse(new Date()) / 1000;
-        if (
-          res.status != 1 ||
-          nowTime < res.startTime ||
-          nowTime > res.endTime
-        ) {
-          uni.showModal({
-            title: "提示",
-            content:
-              res.status != 1
-                ? "活动已关闭"
-                : nowTime < res.startTime
-                ? "未到活动开启时间"
-                : "活动已过期",
-            showCancel: false,
-            success: (resst) => {
-              // uni.navigateBack();
-            },
-          });
-          return;
-        }
-        this.billDetail = res;
-        let posterConfig = JSON.parse(res.posterConfig);
-        this.posterConfig = this.changeData(posterConfig);
-        this.share(posterConfig);
-      });
-    },
-    changeData(data) {
-      Object.keys(data)
-        .filter((key) => {
-          if (key == "distribution" || key == "cardCode") {
-            data[key].codeUrl =
-              this.billDetail[
-                key == "distribution" ? "urlCard" : "urlActivity"
-              ];
-          }
-          return data[key].checked;
-        })
-        .forEach((key) => this.backStyle(data[key].css));
-      return Object.values(data);
-    },
-    px2rpx(data) {
-      if (!data.includes("px")) {
-        return data;
-      }
-      return data.split("px")[0] * 2 + "rpx";
-    },
-    backPosition(item) {
-      return {
-        position: "absolute",
-        left: item.left * 2 + "rpx",
-        top: item.top * 2 + "rpx",
-        width: item.width * 2 + "rpx",
-        height: item.height * 2 + "rpx",
-      };
-    },
-    backStyle(item) {
-      Object.keys(item).forEach((e) => {
-        item[e] = this.px2rpx(item[e]);
-      });
-    },
-    bindLink() {
-      bindLink({
-        linkCode: this.options.linkCode,
-        distributionId: this.options.distributionId,
-      });
-    },
-    share(data) {
-      wechat
-        .share({
-          title: this.billDetail.activityName,
-          desc: data.advertise.name,
-          imgUrl: this.$method.splitImgHost(data.goods.name),
-          link: this.backUrl(),
-        })
-        .then((res) => {
-          this.$method.isLogin() && this.bindLink();
-        });
-    },
-    login(openid) {
-      openidLogin({ openid }).then((data) => {
-        this.$store.commit("LOGIN_CB", data);
-        this.$store.dispatch("getUserInfo");
-      });
-    },
-    backUrl() {
-      let url = window.location.href;
-      if (url.includes("&code")) {
-        url = url.split("&code")[0];
-      }
-      return url;
-    },
-  },
-  computed: {
-    ...mapGetters(["userInfo"]),
-  },
-};
+		methods: {
+			getSharePoster() {
+				getSharePoster(this.options).then((res) => {
+					let nowTime = Date.parse(new Date()) / 1000;
+					if (
+						res.status != 1 ||
+						nowTime < res.startTime ||
+						nowTime > res.endTime
+					) {
+						uni.showModal({
+							title: "提示",
+							content: res.status != 1 ?
+								"活动已关闭" :
+								nowTime < res.startTime ?
+								"未到活动开启时间" :
+								"活动已过期",
+							showCancel: false,
+							success: (resst) => {
+								// uni.navigateBack();
+							},
+						});
+						return;
+					}
+					this.billDetail = res;
+					console.log(this.billDetail,'this.billDetail')
+					uni.setNavigationBarTitle({
+						title: this.billDetail.activityName
+					})
+					let posterConfig = JSON.parse(res.posterConfig);
+					this.posterConfig = this.changeData(posterConfig);
+					this.share(posterConfig);
+				});
+			},
+			changeData(data) {
+				Object.keys(data)
+					.filter((key) => {
+						if (key == "distribution" || key == "cardCode") {
+							data[key].codeUrl =
+								this.billDetail[
+									key == "distribution" ? "urlCard" : "urlActivity"
+								];
+						}
+						return data[key].checked;
+					})
+					.forEach((key) => this.backStyle(data[key].css));
+				return Object.values(data);
+			},
+			px2rpx(data) {
+				if (!data.includes("px")) {
+					return data;
+				}
+				return data.split("px")[0] * 2 + "rpx";
+			},
+			backPosition(item) {
+				return {
+					position: "absolute",
+					left: item.left * 2 + "rpx",
+					top: item.top * 2 + "rpx",
+					width: item.width * 2 + "rpx",
+					height: item.height * 2 + "rpx",
+				};
+			},
+			backStyle(item) {
+				Object.keys(item).forEach((e) => {
+					item[e] = this.px2rpx(item[e]);
+				});
+			},
+			bindLink() {
+				bindLink({
+					linkCode: this.options.linkCode,
+					distributionId: this.options.distributionId,
+				});
+			},
+			share(data) {
+				wechat
+					.share({
+						title: this.billDetail.activityName,
+						desc: data.advertise.name,
+						imgUrl: this.$method.splitImgHost(data.goods.name),
+						link: this.backUrl(),
+					})
+					.then((res) => {
+						this.$method.isLogin() && this.bindLink();
+					});
+			},
+			login(openid) {
+				openidLogin({
+					openid
+				}).then((data) => {
+					this.$store.commit("LOGIN_CB", data);
+					this.$store.dispatch("getUserInfo");
+				});
+			},
+			backUrl() {
+				let url = window.location.href;
+				if (url.includes("&code")) {
+					url = url.split("&code")[0];
+				}
+				return url;
+			},
+		},
+		computed: {
+			...mapGetters(["userInfo"]),
+		},
+	};
 </script>
 
 <style lang="scss" scoped>
-.bill-ward {
-  position: relative;
-  .code-box {
-    padding: 10rpx;
-    background: #ffffff;
-    box-sizing: border-box;
-  }
-  .bill-head {
-    position: absolute;
-    left: 30rpx;
-    top: 20rpx;
-    z-index: 100;
-    image {
-      width: 60rpx;
-      height: 60rpx;
-      border-radius: 50%;
-    }
-  }
-}
-</style>
+	.bill-ward {
+		position: relative;
+
+		.code-box {
+			padding: 10rpx;
+			background: #ffffff;
+			box-sizing: border-box;
+		}
+
+		.bill-head {
+			position: absolute;
+			left: 30rpx;
+			top: 20rpx;
+			z-index: 100;
+
+			image {
+				width: 60rpx;
+				height: 60rpx;
+				border-radius: 50%;
+			}
+		}
+	}
+</style>