zhangkunkun %!s(int64=3) %!d(string=hai) anos
pai
achega
6b0b5a2f16
Modificáronse 8 ficheiros con 192 adicións e 72 borrados
  1. 2 2
      app.js
  2. 2 1
      app.json
  3. 11 1
      pages/boutique/outique.js
  4. 105 3
      pages/details/details.js
  5. 2 0
      pages/details/details.wxml
  6. BIN=BIN
      pages/image/mm.jpg
  7. 3 3
      pages/search/search.wxml
  8. 67 62
      project.config.json

+ 2 - 2
app.js

@@ -31,8 +31,8 @@ App({
   },
   globalData: {
     userInfo: null,
-    url:"http://127.0.0.1:8081"
+    //url:"http://127.0.0.1:8081"
     //url:"http://www.tao1024.com:8081"
-    //url:"https://www.shisanmiao.com"
+    url:"https://www.shisanmiao.com"
   }
 })

+ 2 - 1
app.json

@@ -9,7 +9,8 @@
     "pages/search-details/earch-details",
     "pages/friends/friends",
     "pages/friends-list/friends-list",
-    "pages/trans/trans"
+    "pages/trans/trans",
+    "pages/search/search"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 11 - 1
pages/boutique/outique.js

@@ -107,6 +107,7 @@ Page({
     that.channel_type = "4"
     that.pid = "9112489_209622235"
     that.cat_id = ""
+    console.log("opt = "+options)
     console.log(options)
    //var openId = options.openId
     
@@ -116,7 +117,7 @@ Page({
        "Content-Type": "application/json"
       }, 
       method: "POST",
-      data:  { version: "1.0.3" }, 
+      data:  { version: "1.0.4" }, 
       complete: function( res ) { 
        console.log(res)
        if( res == null || res.data == null ) { 
@@ -188,6 +189,15 @@ Page({
       }
     })
 
+    if (options.goodsSign != undefined){
+      var goodsSign = options.goodsSign
+      var searchId = options.searchId
+      wx.navigateTo({
+        url: `/pages/details/details?goodsSign=${goodsSign}&searchId=${searchId}`,
+       // url: `/pages/goods-detail/index`,
+       })
+    }
+
   },
   search: function(options){
     wx.navigateTo({

+ 105 - 3
pages/details/details.js

@@ -10,6 +10,12 @@ Page({
     p_id:"",
     search_id:"",
     goods_sign:"",
+    goods_details:"",
+    goods_name:"",
+    amount:0,
+    price:0,
+    rebate:0,
+    text:"",
   },
 
   /**
@@ -17,12 +23,40 @@ Page({
    */
   onLoad: function (options) {
     var that=this
+    console.log("ppp="+options)
+    console.log(options)
     const goodsSign=options.goodsSign
     const searchId=options.searchId
     //const pid = "9112489_209622235"
     var pid = "9112489_212035116"
     var opneId = wx.getStorageSync('openId')
     console.log(opneId)
+    if (options.id == "111"){
+      console.log(options.id)
+      wx.login({
+        success: res => {
+          // 发送 res.code 到后台换取 openId, sessionKey, unionId
+          console.log(res)
+          wx.request( { 
+            url: link + "/v1/user/open.id/set", 
+            header: { 
+             "Content-Type": "application/json"
+            }, 
+            method: "POST",
+            //
+            data:  { code: res.code,openId: options.openId }, 
+            complete: function( res ) { 
+              console.log(res)
+              console.log('openid='+ options.openId )
+             if (res.data.code == 200){
+              wx.setStorageSync('openId', res.data.data.openid)
+             }
+            
+            } 
+           }) 
+        }
+      })
+    }
     //获取pid
     wx.request({
       url: link + '/v1/user/pid/get', 
@@ -52,6 +86,14 @@ Page({
        
         success (res) {
           console.log(res)
+          that.goods_details = res.data.data.goods_detail_response.goods_details[0].goods_image_url
+         
+          that.amount =(res.data.data.goods_detail_response.goods_details[0].min_group_price - res.data.data.goods_detail_response.goods_details[0].coupon_discount)/100
+          that.price = (res.data.data.goods_detail_response.goods_details[0].min_group_price)/100
+          that.rebate = res.data.data.goods_detail_response.goods_details[0].rebate
+
+          that.goods_name = res.data.data.goods_detail_response.goods_details[0].goods_name
+          that.text = that.goods_name + "\n" + "原价:" + that.price + "元\n"  + "优惠价:"+that.amount + "元\n" + "返利:"+that.rebate + "元\n" + "点击下方链接即可查看产品详情"
           that.setData({
           goodsDetails: res.data.data.goods_detail_response.goods_details,
           searchId:searchId
@@ -64,6 +106,35 @@ Page({
 
 
    
+  },
+  copyText: function (e) {
+    var that = this
+    console.log(e)
+
+    wx.setClipboardData({
+
+      data: that.text,
+
+      success: function (res) {
+
+        wx.getClipboardData({
+
+          success: function (res) {
+
+            wx.showToast({
+
+              title: '复制成功'
+
+            })
+
+          }
+
+        })
+
+      }
+
+    })
+
   },
   counponBtn:function(e){
     var that = this
@@ -133,7 +204,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    
   },
 
   /**
@@ -167,7 +238,38 @@ Page({
   /**
    * 用户点击右上角分享
    */
-  // onShareAppMessage: function () {
+  onShareAppMessage: function () {
+    var that = this
+    var openId = wx.getStorageSync('openId')
+    var goodsSign = that.goods_sign
+    var searchId = that.search_id
+    wx.showShareMenu({
+      withShareTicket: true,
+      menus: ['shareAppMessage', 'shareTimeline']
+    })
 
-  // }
+    return {
+      title: '自定义转发标题',
+      path: `pages/boutique/outique?openId=${openId}&goodsSign=${goodsSign}&searchId=${searchId}` // 路径,传递参数到指定页面。,
+     
+    }
+  },
+
+  onShareTimeline: function(){
+    var that = this
+    var openId = wx.getStorageSync('openId')
+    var goodsSign = that.goods_sign
+    var searchId = that.search_id
+    // return {
+    //   title: '自定义转发标题',
+    //   path: '/page/user?id=123',
+    //   promise 
+    // }
+    return {
+      title: that.goods_name,
+      query:'goodsSign='+ goodsSign +'&searchId=' + searchId + '&openId=' + openId + '&id=111',
+      imageUrl: that.goods_details
+    }
+  }
+  
 })

+ 2 - 0
pages/details/details.wxml

@@ -62,6 +62,8 @@
 
   </scroll-view> 
 
+  <button bindtap="copyText" style='position:fixed;width:100%;bottom:0'>复制文案</button>
+
   <l-tab-bar list="{{list}}" />
 
 

BIN=BIN
pages/image/mm.jpg


+ 3 - 3
pages/search/search.wxml

@@ -2,7 +2,7 @@
 <!-- <l-search-bar l-container-class="aa" bg-color="#e5e7df" placeholder="搜索" show-cancel="{{false}}" bind:linconfirm="search"/> -->
 
 
-<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill"  image="https://cdn.3n6.cn/yun.share.tour/2021-05-27/2029259/1622099734452029086.jpg"
+<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill"  image="/pages/image/mm.jpg"
   title="非洲野猫的样子" bindtap="goodsDetail">
   <view class="content">
     初中一生物老师的佳作,讲非洲草原上的生态,全班无人听讲。
@@ -10,14 +10,14 @@
 </l-card>
 
 
-<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill" image="https://cdn.3n6.cn/yun.share.tour/2021-05-27/2029259/1622099734452029086.jpg"
+<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill" image="/pages/image/mm.jpg"
   title="拿一个柿饼来" bindtap="goodsDetail2">
   <view class="content">
     有个农妇,天清晨醒来,觉得饿,她想,皇后娘娘是怎么享福的呢?”
   </view>
 </l-card>
 
-<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill" image="https://cdn.3n6.cn/yun.share.tour/2021-05-27/2029259/1622099734452029086.jpg"
+<l-card type="primary" full l-class="card" l-img-class="right-card" image-mode="aspectFill" image="/pages/image/mm.jpg"
   title="忘了一半" bindtap="goodsDetail3">
   <view class="content">
     一人死,奈何桥头喝孟婆汤,近半时突吻孟婆,婆羞且怒:戏弄老婆子作甚?

+ 67 - 62
project.config.json

@@ -1,68 +1,73 @@
 {
-  "description": "项目配置文件",
-  "packOptions": {
-    "ignore": []
-  },
-  "setting": {
-    "urlCheck": false,
-    "es6": true,
-    "enhance": true,
-    "postcss": true,
-    "preloadBackgroundData": false,
-    "minified": true,
-    "newFeature": false,
-    "coverView": true,
-    "nodeModules": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": true,
-    "scopeDataCheck": false,
-    "uglifyFileName": false,
-    "checkInvalidKey": true,
-    "checkSiteMap": true,
-    "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "useMultiFrameRuntime": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
+    "description": "项目配置文件",
+    "packOptions": {
+        "ignore": []
     },
-    "useIsolateContext": true,
-    "userConfirmedBundleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "minifyWXSS": true,
-    "showES6CompileOption": false
-  },
-  "compileType": "miniprogram",
-  "libVersion": "2.17.0",
-  "appid": "wxc5b88e9d942121cc",
-  "projectname": "ddk",
-  "debugOptions": {
-    "hidedInDevtools": []
-  },
-  "scripts": {},
-  "isGameTourist": false,
-  "condition": {
-    "search": {
-      "list": []
+    "setting": {
+        "urlCheck": false,
+        "es6": true,
+        "enhance": true,
+        "postcss": true,
+        "preloadBackgroundData": false,
+        "minified": true,
+        "newFeature": false,
+        "coverView": true,
+        "nodeModules": false,
+        "autoAudits": false,
+        "showShadowRootInWxmlPanel": true,
+        "scopeDataCheck": false,
+        "uglifyFileName": false,
+        "checkInvalidKey": true,
+        "checkSiteMap": true,
+        "uploadWithSourceMap": true,
+        "compileHotReLoad": false,
+        "lazyloadPlaceholderEnable": false,
+        "useMultiFrameRuntime": true,
+        "useApiHook": true,
+        "useApiHostProcess": true,
+        "babelSetting": {
+            "ignore": [],
+            "disablePlugins": [],
+            "outputPath": ""
+        },
+        "useIsolateContext": true,
+        "userConfirmedBundleSwitch": false,
+        "packNpmManually": false,
+        "packNpmRelationList": [],
+        "minifyWXSS": true,
+        "disableUseStrict": false,
+        "showES6CompileOption": false,
+        "useCompilerPlugins": false,
+        "ignoreUploadUnusedFiles": true,
+        "minifyWXML": true
     },
-    "conversation": {
-      "list": []
+    "compileType": "miniprogram",
+    "libVersion": "2.17.0",
+    "appid": "wxc5b88e9d942121cc",
+    "projectname": "duoduo-wx",
+    "debugOptions": {
+        "hidedInDevtools": []
     },
-    "game": {
-      "list": []
-    },
-    "plugin": {
-      "list": []
-    },
-    "gamePlugin": {
-      "list": []
-    },
-    "miniprogram": {
-      "list": []
+    "scripts": {},
+    "isGameTourist": false,
+    "condition": {
+        "search": {
+            "list": []
+        },
+        "conversation": {
+            "list": []
+        },
+        "game": {
+            "list": []
+        },
+        "plugin": {
+            "list": []
+        },
+        "gamePlugin": {
+            "list": []
+        },
+        "miniprogram": {
+            "list": []
+        }
     }
-  }
 }