15102826049 преди 8 часа
родител
ревизия
3f7adbc36f

+ 13 - 0
.env.development

@@ -0,0 +1,13 @@
+
+VITE_NODE_ENV = development
+
+# 测试环境配置
+VITE_ENV = 'development'
+
+# 若依管理系统/开发环境
+VITE_APP_BASE_API = ''
+
+# 路由懒加载
+VITE_CLI_BABEL_TRANSPILE_MODULES = true
+
+VITE_API_URL=http://192.168.168.71:8080

+ 9 - 0
.env.production

@@ -0,0 +1,9 @@
+
+# 生产环境配置
+VITE_ENV = 'production'
+VITE_NODE_ENV = production
+
+# 若依管理系统/生产环境
+VITE_APP_BASE_API = '/prod-api'
+
+VITE_API_URL=https://shuzhi.qiuyutech.com.cn/prod-api

+ 11 - 0
.env.staging

@@ -0,0 +1,11 @@
+
+
+VITE_NODE_ENV = production
+
+# 测试环境配置
+VITE_ENV = 'staging'
+
+# 若依管理系统/测试环境
+VITE_APP_BASE_API = '/stage-api'
+
+VITE_API_URL=https://shuzhi.qiuyutech.com.cn/prod-api

+ 6 - 1
dist/dev/mp-weixin/app.js

@@ -17,11 +17,16 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       console.log("App Launch");
     });
     common_vendor.onShow(() => {
-      console.log("App Show");
+      const appid = common_vendor.index.getAccountInfoSync().miniProgram.appId;
+      common_vendor.index.setStorageSync("appid", appid);
     });
     common_vendor.onHide(() => {
       console.log("App Hide");
     });
+    common_vendor.onLoad(() => {
+      const appid = common_vendor.wx$1.getAccountInfoSync().miniProgram.appId;
+      console.log("------------------", appid);
+    });
     return () => {
     };
   }

+ 23 - 12
dist/dev/mp-weixin/pages/index/index.js

@@ -1,5 +1,6 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
+const services_ams = require("../../services/ams.js");
 if (!Array) {
   const _easycom_wd_swiper2 = common_vendor.resolveComponent("wd-swiper");
   _easycom_wd_swiper2();
@@ -12,27 +13,37 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "index",
   setup(__props) {
     const current = common_vendor.ref(0);
-    const swiperList = common_vendor.ref([
-      "https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg",
-      "https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg",
-      "https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg",
-      "https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg",
-      "https://registry.npmmirror.com/wot-design-uni-assets/*/files/meng.jpg"
-    ]);
+    const appid = common_vendor.index.getStorageSync("appid");
+    common_vendor.onLoad(() => {
+      getBanner();
+    });
+    const getphonenumber = (e) => {
+      console.log("-----------------------", e.detail.code);
+    };
+    const bannerList = common_vendor.ref([]);
+    const getBanner = () => {
+      services_ams.getCarousel(appid).then((res) => {
+        bannerList.value = res.data;
+      });
+    };
+    const toActivity = () => {
+      common_vendor.index.navigateTo({
+        url: "/pagesOne/winner/index"
+      });
+    };
     common_vendor.onShow(() => {
     });
     return (_ctx, _cache) => {
       return {
         a: common_vendor.p({
           customClass: "customSwiper",
-          list: swiperList.value,
+          list: bannerList.value,
           autoplay: true,
+          ["value-key"]: "imageUrl",
           value: current.value
         }),
-        b: common_vendor.o(
-          //@ts-ignore
-          (...args) => _ctx.payment && _ctx.payment(...args)
-        )
+        b: common_vendor.o(toActivity),
+        c: common_vendor.o(getphonenumber)
       };
     };
   }

+ 1 - 1
dist/dev/mp-weixin/pages/index/index.wxml

@@ -1 +1 @@
-<view class="homeContent"><wd-swiper wx:if="{{a}}" u-i="f5f2151a-0" bind:__l="__l" u-p="{{a}}"></wd-swiper><image class="enter-img" src="https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/enter.png" mode="scaleToFill" bindtap="{{b}}"/></view>
+<view class="homeContent"><wd-swiper wx:if="{{a}}" u-i="f5f2151a-0" bind:__l="__l" u-p="{{a}}"></wd-swiper><image class="enter-img" src="https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/enter.png" mode="scaleToFill" bindtap="{{b}}"/><button open-type="getPhoneNumber" bindgetphonenumber="{{c}}"> 获取手机号 </button></view>

+ 6 - 6
dist/dev/mp-weixin/pages/my/index.js

@@ -13,7 +13,7 @@ if (!Math) {
 const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "index",
   setup(__props) {
-    const imgObj2 = {
+    const imgObj = {
       user: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/user.png",
       gift: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/gift.png",
       page: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/page.png",
@@ -39,9 +39,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     });
     return (_ctx, _cache) => {
       return {
-        a: imgObj2.myBg,
+        a: imgObj.myBg,
         b: navTop.value + "rpx",
-        c: imgObj2.user,
+        c: imgObj.user,
         d: navTop.value + 125 + "rpx",
         e: common_vendor.f(list, (item, index, i0) => {
           return {
@@ -50,13 +50,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           };
         }),
         f: navTop.value + 280 + "rpx",
-        g: imgObj2.gift,
-        h: imgObj2.with,
+        g: imgObj.gift,
+        h: imgObj.with,
         i: common_vendor.p({
           ["is-link"]: true,
           title: "奖励记录"
         }),
-        j: imgObj2.page,
+        j: imgObj.page,
         k: common_vendor.p({
           border: true,
           ["is-link"]: true,

+ 28 - 17
dist/dev/mp-weixin/pagesOne/winner/components/uploadReceptPopop.js

@@ -18,43 +18,54 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     show: {
       type: Boolean,
       default: false
-    }
+    },
+    list: Array
   },
   emits: ["update:show"],
   setup(__props, { emit: __emit }) {
     const props = __props;
     const emit = __emit;
     common_vendor.ref("1");
-    const list = [
-      { name: "满25返8", id: "1", checked: false },
-      { name: "满25返8", id: "2", checked: false },
-      { name: "满25返8", id: "3", checked: true },
-      { name: "满25返8", id: "1", checked: false },
-      { name: "满25返8", id: "2", checked: false }
-    ];
+    const onCamera = () => {
+      common_vendor.index.chooseImage({
+        count: 1,
+        sourceType: ["camera"],
+        success: function(res) {
+          common_vendor.index.saveImageToPhotosAlbum({
+            filePath: res.tempFilePaths[0],
+            success: function() {
+              console.log("save success");
+            }
+          });
+        }
+      });
+    };
     const { handleClose } = hooks_useDraw.useDraw(props, emit);
     return (_ctx, _cache) => {
       return {
-        a: common_vendor.f(list, (item, k0, i0) => {
+        a: common_vendor.f(props.list, (item, k0, i0) => {
           return {
-            a: item.id,
-            b: item.checked,
+            a: common_vendor.t(item.thresholdAmount),
+            b: common_vendor.t(item.cashbackAmount),
             c: item.id,
-            d: common_vendor.n(item.checked ? "active" : "static")
+            d: item.checked,
+            e: item.id,
+            f: common_vendor.n(item.checked ? "active" : "static")
           };
         }),
         b: common_vendor.unref(pagesOne_winner_utils_source.imgObj).icon1,
-        c: common_vendor.p({
+        c: common_vendor.o(onCamera),
+        d: common_vendor.p({
           height: "16rpx",
           ["bg-color"]: "#F7F8F9"
         }),
-        d: common_vendor.o(
+        e: common_vendor.o(
           //@ts-ignore
           (...args) => common_vendor.unref(handleClose) && common_vendor.unref(handleClose)(...args)
         ),
-        e: common_vendor.o(common_vendor.unref(handleClose)),
-        f: common_vendor.o(($event) => props.show = $event),
-        g: common_vendor.p({
+        f: common_vendor.o(common_vendor.unref(handleClose)),
+        g: common_vendor.o(($event) => props.show = $event),
+        h: common_vendor.p({
           position: "bottom",
           ["safe-area-inset-bottom"]: true,
           ["custom-style"]: "height: 922rpx;border-radius: 40rpx 40rpx 0 0;",

+ 1 - 1
dist/dev/mp-weixin/pagesOne/winner/components/uploadReceptPopop.wxml

@@ -1 +1 @@
-<view class="uploadReceptPopup"><wd-popup wx:if="{{g}}" u-s="{{['d']}}" bindclose="{{e}}" u-i="6fe79449-0" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"><view class="topTitle"><text>上传小票</text><text class="tips">(*先选择优惠力度再上传)</text></view><radio-group class="receptBox"><label wx:for="{{a}}" wx:for-item="item" wx:key="c" class="{{['radioItem', item.d]}}"><view class="left"><image class="icon" src="{{b}}" mode="scaleToFill"/><text class="label">满25返8</text></view><radio class="radio" color="#225036" value="{{item.a}}" style="transform:scale(0.9)" checked="{{item.b}}"/></label></radio-group><view class="btnBox"><view class="play">拍摄照片</view><view class="phone">从手机相册选择</view><wd-gap wx:if="{{c}}" u-i="6fe79449-1,6fe79449-0" bind:__l="__l" u-p="{{c}}"></wd-gap><view bindtap="{{d}}">取消</view></view></wd-popup></view>
+<view class="uploadReceptPopup"><wd-popup wx:if="{{h}}" u-s="{{['d']}}" bindclose="{{f}}" u-i="6fe79449-0" bind:__l="__l" bindupdateModelValue="{{g}}" u-p="{{h}}"><view class="topTitle"><text>上传小票</text><text class="tips">(*先选择优惠力度再上传)</text></view><radio-group class="receptBox"><label wx:for="{{a}}" wx:for-item="item" wx:key="e" class="{{['radioItem', item.f]}}"><view class="left"><image class="icon" src="{{b}}" mode="scaleToFill"/><text class="label">满{{item.a}}返{{item.b}}</text></view><radio class="radio" color="#225036" value="{{item.c}}" style="transform:scale(0.9)" checked="{{item.d}}"/></label></radio-group><view class="btnBox"><view class="play" bindtap="{{c}}">拍摄照片</view><view class="phone">从手机相册选择</view><wd-gap wx:if="{{d}}" u-i="6fe79449-1,6fe79449-0" bind:__l="__l" u-p="{{d}}"></wd-gap><view bindtap="{{e}}">取消</view></view></wd-popup></view>

+ 54 - 4
dist/dev/mp-weixin/pagesOne/winner/index.js

@@ -1,6 +1,7 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const pagesOne_winner_utils_source = require("./utils/source.js");
+const services_ams = require("../../services/ams.js");
 if (!Array) {
   const _easycom_wd_gap2 = common_vendor.resolveComponent("wd-gap");
   _easycom_wd_gap2();
@@ -22,9 +23,54 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     let showWiner = common_vendor.ref(false);
     let showRecord = common_vendor.ref(false);
     let showDesc = common_vendor.ref(false);
+    const appid = common_vendor.index.getStorageSync("appid");
+    const backImage = common_vendor.ref(
+      "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/Group%201.png"
+    );
+    let aData = common_vendor.reactive({ discounts: [] });
+    let list = common_vendor.ref([]);
+    common_vendor.computed(() => {
+      return aData.authCheck.includes("2") ? true : false;
+    });
+    const getList = () => {
+      services_ams.getActivity(appid).then((res) => {
+        aData = res.data[0] || {};
+        aData.authCheck = aData.authCheck.split(",");
+        list.value = aData.discounts.map((item) => {
+          return {
+            ...item,
+            checked: false
+          };
+        });
+        console.log("---------------------", aData);
+      }).catch((err) => {
+        console.log(err);
+      });
+    };
+    const handledUpload = () => {
+      common_vendor.index.getLocation({
+        type: "gcj02",
+        success: async (res) => {
+          const { latitude, longitude } = res;
+          const key = "7c607ea6b491804270ddcdd72daad58c";
+          const url = `https://restapi.amap.com/v3/geocode/regeo?key=${key}&location=${longitude},${latitude}`;
+          await common_vendor.index.request({ url });
+          console.log("用户所在位置", res);
+        },
+        fail: (err) => {
+          common_vendor.index.showToast({
+            title: "获取位置失败",
+            icon: "none"
+          });
+        }
+      });
+    };
+    common_vendor.onShow(() => {
+      getList();
+    });
     return (_ctx, _cache) => {
       return {
-        a: common_vendor.unref(pagesOne_winner_utils_source.imgObj).backImg,
+        a: backImage.value,
         b: common_vendor.o(($event) => common_vendor.isRef(showDesc) ? showDesc.value = true : showDesc = true),
         c: common_vendor.unref(pagesOne_winner_utils_source.imgObj).rule,
         d: common_vendor.o(($event) => _ctx.showWinner = true),
@@ -34,10 +80,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         h: common_vendor.unref(pagesOne_winner_utils_source.imgObj).book,
         i: common_vendor.o(($event) => common_vendor.isRef(showRecord) ? showRecord.value = true : showRecord = true),
         j: common_vendor.unref(pagesOne_winner_utils_source.gifObj).pointer,
-        k: common_vendor.o(($event) => common_vendor.isRef(showUpload) ? showUpload.value = true : showUpload = true),
-        l: common_vendor.f(6, (item, k0, i0) => {
+        k: common_vendor.o(handledUpload),
+        l: common_vendor.f(common_vendor.unref(list), (item, k0, i0) => {
           return {
-            a: item
+            a: common_vendor.t(item.cashbackAmount),
+            b: common_vendor.t(item.thresholdAmount),
+            c: common_vendor.t(item.cashbackAmount),
+            d: item.id
           };
         }),
         m: common_vendor.p({
@@ -49,6 +98,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         }),
         p: common_vendor.o(($event) => common_vendor.isRef(showUpload) ? showUpload.value = $event : showUpload = $event),
         q: common_vendor.p({
+          list: common_vendor.unref(list),
           show: common_vendor.unref(showUpload)
         }),
         r: common_vendor.o(($event) => common_vendor.isRef(showWiner) ? showWiner.value = $event : showWiner = $event),

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/dev/mp-weixin/pagesOne/winner/index.wxml


+ 1 - 1
dist/dev/mp-weixin/pagesOne/winner/index.wxss

@@ -67,7 +67,7 @@
   box-sizing: border-box;
 }
 .winnerContent .recordBox > view.data-v-3457e999 {
-  width: 306rpx;
+  width: 49%;
   height: 144rpx;
   background: linear-gradient(180deg, #e5fff6 0%, #ffffff 100%);
   border-radius: 24rpx;

+ 1 - 0
dist/dev/mp-weixin/pagesOne/winner/utils/interface.js

@@ -0,0 +1 @@
+"use strict";

+ 17 - 0
dist/dev/mp-weixin/services/ams.js

@@ -0,0 +1,17 @@
+"use strict";
+const utils_http = require("../utils/http.js");
+const getCarousel = (data) => {
+  return utils_http.http({
+    method: "GET",
+    url: `/miniApp/getCarousel/${data}`,
+    data
+  });
+};
+const getActivity = (data) => {
+  return utils_http.http({
+    method: "GET",
+    url: `/miniApp/getActivity/${data}`
+  });
+};
+exports.getActivity = getActivity;
+exports.getCarousel = getCarousel;

+ 0 - 2
dist/dev/mp-weixin/services/task.js

@@ -1,2 +0,0 @@
-"use strict";
-require("../utils/http.js");

+ 36 - 2
dist/dev/mp-weixin/utils/http.js

@@ -1,7 +1,6 @@
 "use strict";
 const common_vendor = require("../common/vendor.js");
-var define_import_meta_env_default = {};
-const baseURL = define_import_meta_env_default.VITE_API_URL;
+const baseURL = "http://192.168.168.71:8080";
 const httpInterceptor = {
   // 拦截前触发
   invoke(options) {
@@ -16,3 +15,38 @@ const httpInterceptor = {
   }
 };
 common_vendor.index.addInterceptor("request", httpInterceptor);
+const http = (options) => {
+  return new Promise((resolve, reject) => {
+    common_vendor.index.request({
+      ...options,
+      // 响应成功
+      success(res) {
+        if (res.statusCode >= 200 && res.statusCode < 300) {
+          if (res.data.code == 401) {
+            common_vendor.index.redirectTo({ url: "/" });
+          } else {
+            resolve(res.data);
+          }
+        } else if (res.statusCode === 401) {
+          common_vendor.index.redirectTo({ url: "/" });
+          reject(res);
+        } else {
+          common_vendor.index.showToast({
+            icon: "none",
+            title: res.data.msg || "请求错误"
+          });
+          reject(res);
+        }
+      },
+      // 响应失败
+      fail(err) {
+        common_vendor.index.showToast({
+          icon: "none",
+          title: "网络错误,换个网络试试"
+        });
+        reject(err);
+      }
+    });
+  });
+};
+exports.http = http;

+ 7 - 2
src/App.vue

@@ -1,14 +1,19 @@
 <script setup lang="ts">
-import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
+import { onLaunch, onShow, onHide, onLoad } from "@dcloudio/uni-app";
 onLaunch(() => {
   console.log("App Launch");
 });
 onShow(() => {
-  console.log("App Show");
+  const appid = uni.getAccountInfoSync().miniProgram.appId;
+  uni.setStorageSync("appid", appid);
 });
 onHide(() => {
   console.log("App Hide");
 });
+onLoad(() => {
+  const appid = wx.getAccountInfoSync().miniProgram.appId;
+  console.log("------------------", appid);
+});
 </script>
 <style lang="scss">
 view {

+ 7 - 1
src/manifest.json

@@ -54,7 +54,13 @@
     "setting": {
       "urlCheck": false
     },
-    "usingComponents": true
+    "usingComponents": true,
+    "requiredPrivateInfos": ["getLocation", "chooseLocation"],
+    "permission": {
+      "scope.userLocation": {
+        "desc": "是否允许授权地理位置信息。"
+      }
+    }
   },
   "mp-alipay": {
     "usingComponents": true

+ 26 - 75
src/pages/index/index.vue

@@ -2,8 +2,9 @@
   <view class="homeContent">
     <wd-swiper
       customClass="customSwiper"
-      :list="swiperList"
+      :list="bannerList"
       autoplay
+      value-key="imageUrl"
       :value="current"
     >
     </wd-swiper>
@@ -11,8 +12,11 @@
       class="enter-img"
       src="https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/enter.png"
       mode="scaleToFill"
-      @click="payment"
+      @click="toActivity"
     />
+    <button open-type="getPhoneNumber" @getphonenumber="getphonenumber">
+      获取手机号
+    </button>
     <!-- <image class="logo" src="/static/logo.png" />
     <view class="text-area"
       <text class="title">{{ title }}</text>
@@ -24,86 +28,33 @@
 
 <script setup lang="ts">
 import { onLoad, onShow } from "@dcloudio/uni-app";
-
+import { getCarousel } from "@/services/ams";
 import { ref } from "vue";
 const current = ref<number>(0);
+const appid = uni.getStorageSync("appid");
 
-const swiperList = ref([
-  "https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg",
-  "https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg",
-  "https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg",
-  "https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg",
-  "https://registry.npmmirror.com/wot-design-uni-assets/*/files/meng.jpg",
-]);
-function handleClick(e: any) {
-  console.log(e);
-}
-function onChange(e: any) {
-  console.log(e);
-}
-
-// const payment = () => {
-//   console.log("111111111111111111111111");
-//   console.log("2222222222222", wx.canIUse("requestMerchantTransfer"));
+onLoad(() => {
+  getBanner();
+});
 
-//   if (wx.canIUse("requestMerchantTransfer")) {
-//     wx.requestMerchantTransfer({
-//       mchId: "1704355424",
-//       appId: "wx4f6dc4ac1674547c",
-//       package:
-//         "ABBQO+oYAAABAAAAAABXTd2sUqYlyt70AY4laBAAAADnGpepZahT9IkJjn90+1qgMdPwY+yjFCPTk3QihCUyRMu4fbDXRRoJYEKmtM5WFw1NNnbDCz59pYHM1O/R7NNlNqCfDtLWcWk8aN98DCtFneeNOaU=",
-//       success: (res) => {
-//         // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
-//         console.log("success:", res);
-//       },
-//       fail: (res) => {
-//         console.log("fail:", res);
-//       },
-//     });
-//   } else {
-//     wx.showModal({
-//       content: "你的微信版本过低,请更新至最新版本。",
-//       showCancel: false,
-//     });
-//   }
-// };
+const getphonenumber = (e: any) => {
+  console.log("-----------------------", e.detail.code);
+};
 
-const getuser = () => {
-  // uni.login({
-  //   //获取code,
-  //   success: (res) => {
-  //     var code = res.code,
-  //       appId = "wx4f6dc4ac1674547c",
-  //       secret = "9e0e7fe5161541d9862b8ee2db6da840";
-  //     console.log("正在登录中...");
-  //     //根据获取的code去腾讯服务器,请求用户数据,返回的结果中,包含openid
-  //     wx.request({
-  //       url:
-  //         "https://api.weixin.qq.com/sns/jscode2session?appid=" +
-  //         appId +
-  //         "&secret=" +
-  //         secret +
-  //         "&js_code=" +
-  //         code +
-  //         "&grant_type=authorization_code",
-  //       data: {},
-  //       header: {
-  //         "content-type": "json",
-  //       },
-  //       success: (user_res) => {
-  //         //请求成功获取openid;
-  //         const user_openid = user_res.data.openid;
-  //         console.log("登录成功", user_openid);
-  //       },
-  //     });
-  //   },
-  // });
+const bannerList = ref([]);
+const getBanner = () => {
+  getCarousel(appid).then((res: any) => {
+    bannerList.value = res.data;
+    // swiperList.value = res.data;
+  });
 };
 
-onShow(() => {
-  // payment();
-  getuser();
-});
+const toActivity = () => {
+  uni.navigateTo({
+    url: "/pagesOne/winner/index",
+  });
+};
+onShow(() => {});
 </script>
 
 <style lang="scss">

+ 1 - 2
src/pages/my/index.vue

@@ -52,8 +52,7 @@ import { onLoad, onShow } from "@dcloudio/uni-app";
 
 import { ref } from "vue";
 import { getNavTop } from "@/utils/system";
-import { paymentAPI } from "@/services/task";
-import { imgObj } from "./";
+import { paymentAPI } from "@/services/ams";
 
 const imgObj = {
   user: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/user.png",

+ 29 - 10
src/pagesOne/winner/components/uploadReceptPopop.vue

@@ -13,14 +13,16 @@
       </view>
       <radio-group class="receptBox">
         <label
-          v-for="item in list"
+          v-for="item in props.list"
           :key="item.id"
           class="radioItem"
           :class="item.checked ? 'active' : 'static'"
         >
           <view class="left">
             <image class="icon" :src="imgObj.icon1" mode="scaleToFill" />
-            <text class="label">满25返8</text>
+            <text class="label"
+              >满{{ item.thresholdAmount }}返{{ item.cashbackAmount }}</text
+            >
           </view>
           <radio
             class="radio"
@@ -33,7 +35,7 @@
       </radio-group>
 
       <view class="btnBox">
-        <view class="play">拍摄照片</view>
+        <view class="play" @click="onCamera">拍摄照片</view>
         <view class="phone">从手机相册选择</view>
         <wd-gap height="16rpx" bg-color="#F7F8F9"></wd-gap>
         <view @click="handleClose">取消</view>
@@ -46,24 +48,41 @@
 import { ref } from "vue";
 import { imgObj } from "../utils/source";
 import { useDraw } from "@/hooks/useDraw";
+import { receptProp } from "../utils/interface";
 
 const props = defineProps({
   show: {
     type: Boolean,
     default: false,
   },
+  list: Array<receptProp>,
 });
 
 const emit = defineEmits(["update:show"]);
 const value = ref("1");
 
-const list = [
-  { name: "满25返8", id: "1", checked: false },
-  { name: "满25返8", id: "2", checked: false },
-  { name: "满25返8", id: "3", checked: true },
-  { name: "满25返8", id: "1", checked: false },
-  { name: "满25返8", id: "2", checked: false },
-];
+const onCamera = () => {
+  uni.chooseImage({
+    count: 1,
+    sourceType: ["camera"],
+    success: function (res) {
+      uni.saveImageToPhotosAlbum({
+        filePath: res.tempFilePaths[0],
+        success: function () {
+          console.log("save success");
+        },
+      });
+    },
+  });
+};
+
+// const list = [
+//   { name: "满25返8", id: "1", checked: false },
+//   { name: "满25返8", id: "2", checked: false },
+//   { name: "满25返8", id: "3", checked: true },
+//   { name: "满25返8", id: "1", checked: false },
+//   { name: "满25返8", id: "2", checked: false },
+// ];
 const { handleClose } = useDraw(props, emit);
 </script>
 

+ 72 - 9
src/pagesOne/winner/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="winnerContent">
-    <image class="backImage" :src="imgObj.backImg" mode="scaleToFill" />
+    <image class="backImage" :src="backImage" mode="scaleToFill" />
     <view class="content">
       <view class="floatWindow">
         <image @click="showDesc = true" :src="imgObj.rule" mode="scaleToFill" />
@@ -22,7 +22,7 @@
       </view>
       <view class="uploadBox">
         <view class="count">您还有0次奖励机会</view>
-        <view @click="showUpload = true" class="btnBox">
+        <view @click="handledUpload" class="btnBox">
           <image :src="gifObj.pointer" />
         </view>
         <view class="tip"
@@ -42,9 +42,11 @@
           <text class="bigTitle title">商品列表</text>
         </view>
         <view class="goodsList">
-          <view v-for="item in 6" :key="item" class="goodsItem">
-            <text class="money">8元</text>
-            <text class="content">满25返8</text>
+          <view v-for="item in list" :key="item.id" class="goodsItem">
+            <text class="money">{{ item.cashbackAmount }}元</text>
+            <text class="content"
+              >满{{ item.thresholdAmount }}返{{ item.cashbackAmount }}</text
+            >
             <text class="name">满返红包</text>
           </view>
         </view>
@@ -52,7 +54,10 @@
     </view>
     <wd-gap bg-color="transparent"></wd-gap>
     <photo-example-popup v-model:show="showExample"></photo-example-popup>
-    <upload-recept-popop v-model:show="showUpload"></upload-recept-popop>
+    <upload-recept-popop
+      :list="list"
+      v-model:show="showUpload"
+    ></upload-recept-popop>
     <win-record-popup v-model:show="showWiner"></win-record-popup>
     <upload-record-popup v-model:show="showRecord"></upload-record-popup>
     <activity-desc-popup v-model:show="showDesc"></activity-desc-popup>
@@ -60,19 +65,77 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from "vue";
+import { reactive, ref, computed } from "vue";
+import { onLoad, onShow } from "@dcloudio/uni-app";
+
 import { imgObj, gifObj } from "./utils/source";
 import PhotoExamplePopup from "./components/photoExamplePopup.vue";
 import UploadReceptPopop from "./components/uploadReceptPopop.vue";
 import WinRecordPopup from "./components/winRecordPopup.vue";
 import UploadRecordPopup from "./components/uploadRecordPopup.vue";
 import ActivityDescPopup from "./components/activityDescPopup.vue";
-
+import { getActivity } from "@/services/ams";
+import { receptProp } from "./utils/interface";
 let showExample = ref<boolean>(false);
 let showUpload = ref<boolean>(false);
 let showWiner = ref<boolean>(false);
 let showRecord = ref<boolean>(false);
 let showDesc = ref<boolean>(false);
+const appid = uni.getStorageSync("appid");
+const backImage = ref<string>(
+  "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/Group%201.png"
+);
+
+let aData: any = reactive({ discounts: [] });
+let list = ref([] as receptProp[]);
+
+const isAddress = computed(() => {
+  return aData.authCheck.includes("2") ? true : false;
+});
+
+const getList = () => {
+  getActivity(appid)
+    .then((res: any) => {
+      aData = res.data[0] || {};
+      aData.authCheck = aData.authCheck.split(",");
+      list.value = aData.discounts.map((item: receptProp) => {
+        return {
+          ...item,
+          checked: false,
+        };
+      });
+      console.log("---------------------", aData);
+
+      // backImage.value = res.data[0].activityImage;
+    })
+    .catch((err) => {
+      console.log(err);
+    });
+};
+
+const handledUpload = () => {
+  uni.getLocation({
+    type: "gcj02",
+    success: async (res) => {
+      const { latitude, longitude } = res;
+      // 调用高德API
+      const key = "7c607ea6b491804270ddcdd72daad58c";
+      const url = `https://restapi.amap.com/v3/geocode/regeo?key=${key}&location=${longitude},${latitude}`;
+      const data = await uni.request({ url });
+      console.log("用户所在位置", res);
+    },
+    fail: (err) => {
+      uni.showToast({
+        title: "获取位置失败",
+        icon: "none",
+      });
+    },
+  });
+};
+
+onShow(() => {
+  getList();
+});
 </script>
 
 <style lang="scss" scoped>
@@ -124,7 +187,7 @@ let showDesc = ref<boolean>(false);
     align-items: center;
     box-sizing: border-box;
     > view {
-      width: 306rpx;
+      width: 49%;
       height: 144rpx;
       background: linear-gradient(180deg, #e5fff6 0%, #ffffff 100%);
       border-radius: 24rpx;

+ 12 - 0
src/pagesOne/winner/utils/interface.ts

@@ -0,0 +1,12 @@
+export interface receptProp {
+  brandId: string;
+  cashbackAmount: number;
+  createTime: string;
+  id: string;
+  marketingActivityId: string;
+  participationLimit: string;
+  priority: string;
+  thresholdAmount: number;
+  updateTime: string;
+  checked: boolean;
+}

+ 74 - 75
src/services/task.ts → src/services/ams.ts

@@ -1,75 +1,74 @@
-import { http } from "@/utils/http";
-/**
- * 任务列表(旧)
- */
-export const taskList = (data: any) => {
-  return http({
-    method: "GET",
-    url: "/customer/taskList",
-    data,
-  });
-};
-/**
- * 任务门店列表(旧)
- */
-export const storeListByTaskId = (taskId: string, data: any) => {
-  return http({
-    method: "GET",
-    url: "/customer/storeListByTaskId/" + taskId,
-    data,
-  });
-};
-/**
- * 任务列表(新)
- */
-export const todaysTask = (data: any) => {
-  return http({
-    method: "GET",
-    url: "/wx/taskInfo/todaysTask",
-    data,
-  });
-};
-/**
- * 任务门店列表(新)
- */
-export const taskDetail = (data: any) => {
-  return http({
-    method: "GET",
-    url: "/wx/taskInfo/taskDetail",
-    data,
-  });
-};
-/**
- * 今日任务未读数量
- */
-export const todaysTaskCount = () => {
-  return http({
-    method: "GET",
-    url: "/wx/taskInfo/todaysTaskCount",
-  });
-};
-/**
- * 筛选渠道列表
- */
-export const channelByUserId = () => {
-  return http({
-    method: "GET",
-    url: "/wx/taskInfo/getChannelByUserId",
-  });
-};
-
-export const postLoginAPI = (data: any) => {
-  return http({
-    method: "POST",
-    url: "/login",
-    data,
-  });
-};
-
-export const paymentAPI = (data: any) => {
-  return http({
-    method: "POST",
-    url: "/v3/fund-app/mch-transfer/transfer-bills",
-    data,
-  });
-};
+import { http } from "@/utils/http";
+/**
+ * 小程序轮播图
+ */
+export const getCarousel = (data: any) => {
+  return http({
+    method: "GET",
+    url: `/miniApp/getCarousel/${data}`,
+    data,
+  });
+};
+/**
+ * 营销活动
+ */
+export const getActivity = (data: any) => {
+  return http({
+    method: "GET",
+    url: `/miniApp/getActivity/${data}`,
+  });
+};
+/**
+ * 活动用户添加
+ */
+export const addCustomer = (data: any) => {
+  return http({
+    method: "POST",
+    url: "/customer/add",
+    data,
+  });
+};
+/**
+ * 任务门店列表(新)
+ */
+export const taskDetail = (data: any) => {
+  return http({
+    method: "GET",
+    url: "/wx/taskInfo/taskDetail",
+    data,
+  });
+};
+/**
+ * 今日任务未读数量
+ */
+export const todaysTaskCount = () => {
+  return http({
+    method: "GET",
+    url: "/wx/taskInfo/todaysTaskCount",
+  });
+};
+/**
+ * 筛选渠道列表
+ */
+export const channelByUserId = () => {
+  return http({
+    method: "GET",
+    url: "/wx/taskInfo/getChannelByUserId",
+  });
+};
+
+export const postLoginAPI = (data: any) => {
+  return http({
+    method: "POST",
+    url: "/login",
+    data,
+  });
+};
+
+export const paymentAPI = (data: any) => {
+  return http({
+    method: "POST",
+    url: "/v3/fund-app/mch-transfer/transfer-bills",
+    data,
+  });
+};

+ 1 - 0
src/utils/http.ts

@@ -21,6 +21,7 @@ const httpInterceptor = {
     if (!options.url.startsWith("http")) {
       options.url = baseURL + options.url;
     }
+
     // 2. 请求超时, 默认 60s
     options.timeout = 30000;
     // 3. 添加小程序端请求头标识

+ 4 - 1
vite.config.ts

@@ -5,6 +5,9 @@ import { resolve } from "path";
 // https://vitejs.dev/config/
 export default defineConfig({
   plugins: [uni()],
+  define: {
+    "process.env": process.env, // 或者使用其他方法如 Vite 的内置支持
+  },
   resolve: {
     // 配置别名
     alias: {
@@ -14,7 +17,7 @@ export default defineConfig({
   server: {
     proxy: {
       [process.env.VUE_APP_BASE_API as string]: {
-        target: "https://api.mch.weixin.qq.com", //process.env.VUE_APP_API_URL, // 后端API服务器的地址
+        target: process.env.VUE_APP_API_URL, // 后端API服务器的地址
         changeOrigin: true, // 是否改变源地址
         rewrite: (path) =>
           path.replace(`/^\/${process.env.VUE_APP_BASE_API}/`, ""), // 重写路径

Някои файлове не бяха показани, защото твърде много файлове са промени