|
@@ -1,6 +1,5 @@
|
|
|
-import { basePage } from './draw/base.js'
|
|
|
|
|
-import FLD from './draw/FirstLevelDirectory.js'
|
|
|
|
|
-import SLD from './draw/SecondLevelDirectory.js'
|
|
|
|
|
|
|
+import loading from './draw/loading.js'
|
|
|
|
|
+import { basePage, leftScroll } from './draw/base.js'
|
|
|
import Content from './draw/content.js'
|
|
import Content from './draw/content.js'
|
|
|
import Details from './draw/details.js'
|
|
import Details from './draw/details.js'
|
|
|
import setPrice from './draw/price.js'
|
|
import setPrice from './draw/price.js'
|
|
@@ -11,11 +10,11 @@ import SizeModal from './draw/SizeModal.js'
|
|
|
import PriceModal from './draw/PriceModal.js';
|
|
import PriceModal from './draw/PriceModal.js';
|
|
|
import HelpModal from './draw/HelpModal.js';
|
|
import HelpModal from './draw/HelpModal.js';
|
|
|
//import canvas from './libs/weapp-adapter.js'
|
|
//import canvas from './libs/weapp-adapter.js'
|
|
|
|
|
+import drawText from './util/drawText.js'
|
|
|
|
|
|
|
|
var url = 'https://t6.9026.com/api/album/cat?parent_id=0&store_id=1'//初始顶级目录url
|
|
var url = 'https://t6.9026.com/api/album/cat?parent_id=0&store_id=1'//初始顶级目录url
|
|
|
var SLDsource = []//二级目录对象列表
|
|
var SLDsource = []//二级目录对象列表
|
|
|
var GoodsSource = []//商品对象列表
|
|
var GoodsSource = []//商品对象列表
|
|
|
-var AllSource = []//所有商品对象
|
|
|
|
|
var GoodsDetail//商品详情
|
|
var GoodsDetail//商品详情
|
|
|
var flag1 = 0//通过flag1来判断现在处于哪一个顶级目录,然后利用flag1传参数获取该顶级目录下的二级目录信息
|
|
var flag1 = 0//通过flag1来判断现在处于哪一个顶级目录,然后利用flag1传参数获取该顶级目录下的二级目录信息
|
|
|
var flag2 = 0//通过flag1来判断现在处于哪一个二级目录,然后利用flag2传参数获取该顶级目录下的商品列表
|
|
var flag2 = 0//通过flag1来判断现在处于哪一个二级目录,然后利用flag2传参数获取该顶级目录下的商品列表
|
|
@@ -23,22 +22,17 @@ var flag3 = 0//通过flag3来判断选择的是哪一个商品,然后获取它
|
|
|
var flag4 = 0//价格设置参考参数
|
|
var flag4 = 0//价格设置参考参数
|
|
|
var flag5 = 0//风格菜单选中状态
|
|
var flag5 = 0//风格菜单选中状态
|
|
|
|
|
|
|
|
-//是否为iPhoneX
|
|
|
|
|
-let isiPhoneX
|
|
|
|
|
//定义画布
|
|
//定义画布
|
|
|
-//let canvas = wx.createCanvas()
|
|
|
|
|
let context
|
|
let context
|
|
|
|
|
+let IAC = wx.createInnerAudioContext()
|
|
|
|
|
+IAC.src = 'music/click.mp3'
|
|
|
|
|
+//IAC.autoplay = true
|
|
|
|
|
|
|
|
-//中间商品列表显示区绘制辅助变量
|
|
|
|
|
-let imgx = 0
|
|
|
|
|
-let imgy = 0
|
|
|
|
|
-let imgX = 0
|
|
|
|
|
-let imgY = 0
|
|
|
|
|
-let imgyy = 0
|
|
|
|
|
|
|
|
|
|
//定义按钮区域
|
|
//定义按钮区域
|
|
|
//一级目录按钮区域
|
|
//一级目录按钮区域
|
|
|
import {
|
|
import {
|
|
|
|
|
+ ExitBtnArea,
|
|
|
FLDsource,
|
|
FLDsource,
|
|
|
FLDbtnArea,
|
|
FLDbtnArea,
|
|
|
FLDbtnAreaOffset,
|
|
FLDbtnAreaOffset,
|
|
@@ -46,10 +40,13 @@ import {
|
|
|
ContentbtnArea,
|
|
ContentbtnArea,
|
|
|
SLDArea,
|
|
SLDArea,
|
|
|
setpriceArea,
|
|
setpriceArea,
|
|
|
|
|
+ TopArea,
|
|
|
SearchButtonArea,
|
|
SearchButtonArea,
|
|
|
SetPriceBtnArea,
|
|
SetPriceBtnArea,
|
|
|
page,
|
|
page,
|
|
|
modalCloseBtnArea,
|
|
modalCloseBtnArea,
|
|
|
|
|
+ ProductBuyModalBtnArea,
|
|
|
|
|
+ ProductSizeModalBtnArea,
|
|
|
triggerMoveDelta,
|
|
triggerMoveDelta,
|
|
|
homepage_page_size
|
|
homepage_page_size
|
|
|
} from './conf/data.js'
|
|
} from './conf/data.js'
|
|
@@ -59,24 +56,17 @@ let current_page = page.homepage
|
|
|
//二级目录按钮区域
|
|
//二级目录按钮区域
|
|
|
let SLDbtnArea = []
|
|
let SLDbtnArea = []
|
|
|
|
|
|
|
|
-let CA = []
|
|
|
|
|
-let DA = []
|
|
|
|
|
-let SA = []
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-//搜索按钮
|
|
|
|
|
-let pageArea = []
|
|
|
|
|
-//尺寸安装图片转换界面
|
|
|
|
|
-let attrArea = []
|
|
|
|
|
-
|
|
|
|
|
-let sp = []
|
|
|
|
|
let priceModal
|
|
let priceModal
|
|
|
-
|
|
|
|
|
|
|
+let productBuyModal
|
|
|
|
|
+let isTouchMoving = false
|
|
|
|
|
|
|
|
GameGlobal.isiPhoneX = false
|
|
GameGlobal.isiPhoneX = false
|
|
|
-let res = wx.getSystemInfoSync()
|
|
|
|
|
|
|
+
|
|
|
|
|
+let percent = 10
|
|
|
|
|
+
|
|
|
function init() {
|
|
function init() {
|
|
|
console.log('init')
|
|
console.log('init')
|
|
|
|
|
+ let res = wx.getSystemInfoSync()
|
|
|
let mobileType = res.model
|
|
let mobileType = res.model
|
|
|
|
|
|
|
|
let drawRatio = GameGlobal.drawRatio = 2
|
|
let drawRatio = GameGlobal.drawRatio = 2
|
|
@@ -98,35 +88,21 @@ function init() {
|
|
|
GameGlobal.font_size = 28
|
|
GameGlobal.font_size = 28
|
|
|
console.log('screenWidth: ' + screenWidth + ', screenHeight: ' + screenHeight)
|
|
console.log('screenWidth: ' + screenWidth + ', screenHeight: ' + screenHeight)
|
|
|
|
|
|
|
|
- context.fillStyle = '#fff'
|
|
|
|
|
- context.fillRect(0, 0, screenWidth * drawRatio, screenHeight * drawRatio)
|
|
|
|
|
-
|
|
|
|
|
- if (isiPhoneX) {
|
|
|
|
|
- imgx = (screenWidth - 240 - 35) / 3
|
|
|
|
|
- imgy = (screenHeight - 118) / 3
|
|
|
|
|
- } else {
|
|
|
|
|
- imgx = (screenWidth - 180) / 3
|
|
|
|
|
- imgy = (screenHeight - 118) / 3
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- imgX = imgx
|
|
|
|
|
- imgY = imgy
|
|
|
|
|
- imgyy = (screenHeight - 95) / 9
|
|
|
|
|
|
|
+ // context.fillStyle = '#fff'
|
|
|
|
|
+ // context.fillRect(0, 0, screenWidth, screenHeight)
|
|
|
|
|
+ // wx.setPreferredFramesPerSecond(30)
|
|
|
|
|
+ sleep(0).then(() => {
|
|
|
|
|
|
|
|
- //详情界面按钮区域
|
|
|
|
|
- var DA = [{ startX: 0, startY: screenHeight - 50, endX: 50, endY: screenHeight }, { startX: screenWidth / 2 - 200, startY: screenHeight - 35, endX: screenWidth / 2 - 110, endY: screenHeight - 12 }, { startX: screenWidth / 2 - 100, startY: screenHeight - 35, endX: screenWidth / 2 - 10, endY: screenHeight - 12 }, { startX: screenWidth / 2, startY: screenHeight - 35, endX: screenWidth / 2 + 90, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 100, startY: screenHeight - 35, endX: screenWidth / 2 + 190, endY: screenHeight - 12 }, { startX: 10, startY: screenHeight / 2 - 15, endX: 40, endY: screenHeight / 2 + 15 }, { startX: screenWidth - 40, startY: screenHeight / 2 - 15, endX: screenWidth - 10, endY: screenHeight / 2 + 15 }]
|
|
|
|
|
- //搜索按钮
|
|
|
|
|
- pageArea = [{ startX: screenWidth - 50, startY: screenHeight - 30, endX: screenWidth, endY: screenHeight }, { startX: screenWidth - 50, startY: screenHeight - 65, endX: screenWidth, endY: screenHeight - 35 }]
|
|
|
|
|
- //尺寸安装图片转换界面
|
|
|
|
|
- attrArea = [{ startX: (screenWidth - (screenHeight - 100) * 1.778) / 2, startY: 30, endX: screenWidth / 2, endY: 60 }, { startX: screenWidth / 2, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, endY: 60 }, { startX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2, endY: 60 }]
|
|
|
|
|
-
|
|
|
|
|
- sp = [{ startX: screenWidth / 2 - 150, startY: screenHeight / 2 - 80, endX: screenWidth / 2 + 150, endY: screenHeight / 2 }, { startX: screenWidth / 2 - 40, startY: screenHeight / 2 + 30, endX: screenWidth / 2 + 40, endY: screenHeight / 2 + 70 },]
|
|
|
|
|
|
|
+ loading(percent)
|
|
|
|
|
+ showLoading()
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
-init()
|
|
|
|
|
|
|
|
|
|
-//定义目录选中状态
|
|
|
|
|
-let FLDstatus = false
|
|
|
|
|
-let SLDstatus = false
|
|
|
|
|
|
|
+// wx.getSystemInfoSync({
|
|
|
|
|
+// success: function (res) {
|
|
|
|
|
+// init(res)
|
|
|
|
|
+// }
|
|
|
|
|
+// })
|
|
|
//定义是否在详情界面状态
|
|
//定义是否在详情界面状态
|
|
|
let Detailstatus = false
|
|
let Detailstatus = false
|
|
|
//是否隐藏了按钮
|
|
//是否隐藏了按钮
|
|
@@ -154,6 +130,7 @@ let startx = 0
|
|
|
let starty = 0
|
|
let starty = 0
|
|
|
//agent_id
|
|
//agent_id
|
|
|
let agent_id = 0
|
|
let agent_id = 0
|
|
|
|
|
+let user_id = 0
|
|
|
//状态 1 只选择热销 2 只选择最新上市 3只选择一个风格 4 同时选择热销和最新上市 5同时选择热销和风格 6同时选择最新上市和风格 7全选 0全不选
|
|
//状态 1 只选择热销 2 只选择最新上市 3只选择一个风格 4 同时选择热销和最新上市 5同时选择热销和风格 6同时选择最新上市和风格 7全选 0全不选
|
|
|
let status = 0
|
|
let status = 0
|
|
|
let style = 0
|
|
let style = 0
|
|
@@ -166,13 +143,33 @@ var FactoryName = ''
|
|
|
var pricein = 0.0
|
|
var pricein = 0.0
|
|
|
//输入的电话
|
|
//输入的电话
|
|
|
var mobilein = '0'
|
|
var mobilein = '0'
|
|
|
|
|
+
|
|
|
|
|
+let isLoading = true
|
|
|
|
|
+
|
|
|
|
|
+function showLoading() {
|
|
|
|
|
+
|
|
|
|
|
+ let interval = window.requestAnimationFrame(function () {
|
|
|
|
|
+ // console.log('next frame')
|
|
|
|
|
+ if (percent < 99.6 && isLoading) {
|
|
|
|
|
+ percent += 0.2
|
|
|
|
|
+ loading(percent)
|
|
|
|
|
+ showLoading(percent)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ isLoading = false;
|
|
|
|
|
+ window.cancelAnimationFrame(interval)
|
|
|
|
|
+ interval = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }, canvas)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//绘制函数
|
|
//绘制函数
|
|
|
-function reStart() {
|
|
|
|
|
|
|
+function reStart(dontReset) {
|
|
|
console.log('reStartSuccess')//调用成功输出'reStartSuccess'
|
|
console.log('reStartSuccess')//调用成功输出'reStartSuccess'
|
|
|
- reset()//清空之前屏幕上的绘制内容,减少缓存占用,及信息重叠
|
|
|
|
|
|
|
+ // !dontReset && reset()//清空之前屏幕上的绘制内容,减少缓存占用,及信息重叠
|
|
|
if (current_page === page.homepage || current_page === page.set_price) {
|
|
if (current_page === page.homepage || current_page === page.set_price) {
|
|
|
//绘制两个侧边栏
|
|
//绘制两个侧边栏
|
|
|
- basePage(context, KeyWord, isAgent, flag1, flag5, setprice).then(({height}) => {
|
|
|
|
|
|
|
+ return basePage(context, KeyWord, isAgent, flag1, flag5, setprice).then(({height}) => {
|
|
|
if (current_page === page.homepage) {
|
|
if (current_page === page.homepage) {
|
|
|
new Content(GoodsSource, product_page_index, height).draw()
|
|
new Content(GoodsSource, product_page_index, height).draw()
|
|
|
} else {
|
|
} else {
|
|
@@ -187,10 +184,18 @@ function reStart() {
|
|
|
let img = new Image()
|
|
let img = new Image()
|
|
|
img.src = GoodsDetail.detail_pic
|
|
img.src = GoodsDetail.detail_pic
|
|
|
if (Buttonstatus == false) {
|
|
if (Buttonstatus == false) {
|
|
|
- dt.showDetails(context, GoodsDetail.detail_pic, GoodsDetail.name, GoodsDetail.price)
|
|
|
|
|
|
|
+ return dt.showDetails(context, GoodsDetail.detail_pic, GoodsDetail.name, GoodsDetail.price).catch(() => {
|
|
|
|
|
+ wx.hideLoading()
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '商品详情图片加载失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 800
|
|
|
|
|
+ })
|
|
|
|
|
+ current_page = page.homepage
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- drawImage(GoodsDetail.detail_pic, 0, 0, screenWidth, screenHeight)
|
|
|
|
|
|
|
+ return drawImage(context, GoodsDetail.detail_pic, 0, 0, screenWidth, screenHeight)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -204,6 +209,15 @@ function reStart() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+wx.onShow((e) => {
|
|
|
|
|
+ if (!isLoading) {
|
|
|
|
|
+ console.log('on show')
|
|
|
|
|
+ sleep(500).then(() => reStart())
|
|
|
|
|
+ } else {
|
|
|
|
|
+ init()
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
//触摸响应函数
|
|
//触摸响应函数
|
|
|
wx.onTouchStart(((e) => {
|
|
wx.onTouchStart(((e) => {
|
|
|
try {
|
|
try {
|
|
@@ -217,6 +231,20 @@ wx.onTouchStart(((e) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}))
|
|
}))
|
|
|
|
|
+wx.onTouchMove((e) =>{
|
|
|
|
|
+ var endX = e.changedTouches[0].clientX * 2 - offsetX
|
|
|
|
|
+ var endY = e.changedTouches[0].clientY * 2
|
|
|
|
|
+ switch (current_page) {
|
|
|
|
|
+
|
|
|
|
|
+ case page.product_buy_modal:
|
|
|
|
|
+ handleProductBuyModalMoveEvents(startx, starty, endX, endY)
|
|
|
|
|
+ startx = endX
|
|
|
|
|
+ starty = endY
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
//滑动响应函数
|
|
//滑动响应函数
|
|
|
wx.onTouchEnd(((e) => {
|
|
wx.onTouchEnd(((e) => {
|
|
|
var endX = e.changedTouches[0].clientX * 2 - offsetX
|
|
var endX = e.changedTouches[0].clientX * 2 - offsetX
|
|
@@ -240,13 +268,16 @@ wx.onTouchEnd(((e) => {
|
|
|
switch (current_page) {
|
|
switch (current_page) {
|
|
|
case page.homepage:
|
|
case page.homepage:
|
|
|
handleHomepageEvents(endX, endY)
|
|
handleHomepageEvents(endX, endY)
|
|
|
|
|
+ handelExitEvents(endX, endY)
|
|
|
break;
|
|
break;
|
|
|
case page.product_homepage:
|
|
case page.product_homepage:
|
|
|
handleProductHomepageEvents(endX, endY)
|
|
handleProductHomepageEvents(endX, endY)
|
|
|
|
|
+ handelExitEvents(endX, endY)
|
|
|
break;
|
|
break;
|
|
|
case page.set_price:
|
|
case page.set_price:
|
|
|
|
|
|
|
|
handleHomepageEvents(endX, endY)
|
|
handleHomepageEvents(endX, endY)
|
|
|
|
|
+ handelExitEvents(endX, endY)
|
|
|
break;
|
|
break;
|
|
|
case page.set_price_modal:
|
|
case page.set_price_modal:
|
|
|
handleModalCloseModal(endX, endY)
|
|
handleModalCloseModal(endX, endY)
|
|
@@ -260,9 +291,11 @@ wx.onTouchEnd(((e) => {
|
|
|
break;
|
|
break;
|
|
|
case page.product_buy_modal:
|
|
case page.product_buy_modal:
|
|
|
handleModalCloseModal(endX, endY)
|
|
handleModalCloseModal(endX, endY)
|
|
|
|
|
+ handleProductBuyModalEvents(endX, endY)
|
|
|
break;
|
|
break;
|
|
|
case page.product_size_modal:
|
|
case page.product_size_modal:
|
|
|
handleModalCloseModal(endX, endY)
|
|
handleModalCloseModal(endX, endY)
|
|
|
|
|
+ handleProductSizeModalEvents(endX, endY)
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -299,7 +332,7 @@ function handleHomepageMoveEvents(startx, starty, endX, endY) {
|
|
|
}
|
|
}
|
|
|
if (offsetY !== FLDbtnAreaOffset.y) {
|
|
if (offsetY !== FLDbtnAreaOffset.y) {
|
|
|
FLDbtnAreaOffset.y = offsetY
|
|
FLDbtnAreaOffset.y = offsetY
|
|
|
- reStart()
|
|
|
|
|
|
|
+ leftScroll(context, flag1)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -315,7 +348,7 @@ function handleProductHomepageMoveEvents(startx, starty, endX, endY) {
|
|
|
duration: 800
|
|
duration: 800
|
|
|
})
|
|
})
|
|
|
flag3 = 0
|
|
flag3 = 0
|
|
|
- reStart()
|
|
|
|
|
|
|
+ reStart(true)
|
|
|
} else {
|
|
} else {
|
|
|
flag3 = flag3 - 1
|
|
flag3 = flag3 - 1
|
|
|
console.log('flag3:' + flag3)
|
|
console.log('flag3:' + flag3)
|
|
@@ -338,14 +371,24 @@ function handleProductHomepageMoveEvents(startx, starty, endX, endY) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function handelExitEvents (x, y) {
|
|
|
|
|
+ let d = ExitBtnArea[0]
|
|
|
|
|
+ if (x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ console.log("exit")
|
|
|
|
|
+ wx.exitMiniProgram({})
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
function handleHomepageEvents(x, y) {
|
|
function handleHomepageEvents(x, y) {
|
|
|
//右边一级目录控制
|
|
//右边一级目录控制
|
|
|
- if (x >= FLDbtnArea[0].startX) {
|
|
|
|
|
|
|
+ if (x >= FLDbtnArea[0].startX && y > TopArea[0].endY) {
|
|
|
for (let i = 0, len = FLDbtnArea.length; i < len; i++) {
|
|
for (let i = 0, len = FLDbtnArea.length; i < len; i++) {
|
|
|
if (x >= FLDbtnArea[i].startX
|
|
if (x >= FLDbtnArea[i].startX
|
|
|
&& x <= FLDbtnArea[i].endX
|
|
&& x <= FLDbtnArea[i].endX
|
|
|
&& y >= FLDbtnArea[i].startY
|
|
&& y >= FLDbtnArea[i].startY
|
|
|
&& y <= FLDbtnArea[i].endY) {
|
|
&& y <= FLDbtnArea[i].endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ KeyWord = ''
|
|
|
for (let i in FLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
|
|
for (let i in FLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
|
|
|
FLDbtnArea[i].status = false
|
|
FLDbtnArea[i].status = false
|
|
|
}
|
|
}
|
|
@@ -358,64 +401,72 @@ function handleHomepageEvents(x, y) {
|
|
|
flag5 = 0//风格重置为新品
|
|
flag5 = 0//风格重置为新品
|
|
|
status = 2
|
|
status = 2
|
|
|
//FLDbtnArea[btn].status = true
|
|
//FLDbtnArea[btn].status = true
|
|
|
- current_page = page.homepage
|
|
|
|
|
- getFLDsource(callback1, url)//重绘
|
|
|
|
|
|
|
+ // current_page = page.homepage
|
|
|
|
|
+ getGoodsSource(callback3, SLDsource)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (x <= SLDArea[0].endX) {
|
|
|
|
|
|
|
+ } else if (x <= SLDArea[0].endX && y > TopArea[0].endY) {
|
|
|
//左边二级目录控制
|
|
//左边二级目录控制
|
|
|
for (let i = 0; i < SLDArea.length; i++) {
|
|
for (let i = 0; i < SLDArea.length; i++) {
|
|
|
let d = SLDArea[i]
|
|
let d = SLDArea[i]
|
|
|
|
|
+ KeyWord = ''
|
|
|
if (d && x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
if (d && x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
|
- current_page = page.homepage
|
|
|
|
|
|
|
+ // current_page = page.homepage
|
|
|
if (i === 0) { //新品上市
|
|
if (i === 0) { //新品上市
|
|
|
|
|
+ IAC.play()
|
|
|
product_page_index = 0
|
|
product_page_index = 0
|
|
|
flag2 = 0
|
|
flag2 = 0
|
|
|
flag5 = 0
|
|
flag5 = 0
|
|
|
status = 2
|
|
status = 2
|
|
|
getGoodsSource(callback3, SLDsource)
|
|
getGoodsSource(callback3, SLDsource)
|
|
|
} else if (i === 1) { //促销产品
|
|
} else if (i === 1) { //促销产品
|
|
|
|
|
+ IAC.play()
|
|
|
product_page_index = 0
|
|
product_page_index = 0
|
|
|
flag2 = 0
|
|
flag2 = 0
|
|
|
flag5 = 1
|
|
flag5 = 1
|
|
|
status = 1
|
|
status = 1
|
|
|
getGoodsSource(callback3, SLDsource)
|
|
getGoodsSource(callback3, SLDsource)
|
|
|
} else if (i === 2) { //风格
|
|
} else if (i === 2) { //风格
|
|
|
|
|
+ IAC.play()
|
|
|
product_page_index = 0
|
|
product_page_index = 0
|
|
|
flag2 = 0
|
|
flag2 = 0
|
|
|
flag5 = 2
|
|
flag5 = 2
|
|
|
status = 3
|
|
status = 3
|
|
|
getGoodsSource(callback3, SLDsource)
|
|
getGoodsSource(callback3, SLDsource)
|
|
|
} else if (isAgent == true && i === 4) { //报价
|
|
} else if (isAgent == true && i === 4) { //报价
|
|
|
- if (GoodsSource.length != 0) {
|
|
|
|
|
- setMobile = false
|
|
|
|
|
- if (setprice == true) { //退出报价
|
|
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ if (current_page === page.set_price) { //退出报价
|
|
|
setprice = false
|
|
setprice = false
|
|
|
|
|
+ current_page = page.homepage
|
|
|
reStart()
|
|
reStart()
|
|
|
} else {
|
|
} else {
|
|
|
- current_page = page.set_price
|
|
|
|
|
- setprice = true
|
|
|
|
|
- reStart()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (GoodsSource.length === 0) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '当前列表无商品',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 500
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ current_page = page.set_price
|
|
|
|
|
+ setprice = true
|
|
|
|
|
+ reStart()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '当前列表无商品',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- duration: 500
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
} else if (setprice && i === 5) { //报价帮助按钮
|
|
} else if (setprice && i === 5) { //报价帮助按钮
|
|
|
|
|
+ IAC.play()
|
|
|
current_page = page.set_price_help_modal
|
|
current_page = page.set_price_help_modal
|
|
|
new HelpModal(context).draw()
|
|
new HelpModal(context).draw()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (y <= SearchButtonArea[0].startY) {
|
|
|
|
|
|
|
+ } else if (y <= TopArea[0].endY) {
|
|
|
//搜索
|
|
//搜索
|
|
|
if (x >= SearchButtonArea[0].startX
|
|
if (x >= SearchButtonArea[0].startX
|
|
|
&& x <= SearchButtonArea[0].endX
|
|
&& x <= SearchButtonArea[0].endX
|
|
|
&& y >= SearchButtonArea[0].startY
|
|
&& y >= SearchButtonArea[0].startY
|
|
|
&& y <= SearchButtonArea[0].endY) {
|
|
&& y <= SearchButtonArea[0].endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
//清除目录控制状态
|
|
//清除目录控制状态
|
|
|
flag5 = -1
|
|
flag5 = -1
|
|
|
for (let i in FLDbtnArea) {
|
|
for (let i in FLDbtnArea) {
|
|
@@ -440,6 +491,7 @@ function handleHomepageEvents(x, y) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
} else if (setprice) { //打开报价弹窗
|
|
} else if (setprice) { //打开报价弹窗
|
|
|
|
|
+ IAC.play()
|
|
|
for (let con in setpriceArea) {
|
|
for (let con in setpriceArea) {
|
|
|
if (x >= setpriceArea[con].startX
|
|
if (x >= setpriceArea[con].startX
|
|
|
&& x <= setpriceArea[con].endX
|
|
&& x <= setpriceArea[con].endX
|
|
@@ -455,6 +507,7 @@ function handleHomepageEvents(x, y) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else { //进入商品详情
|
|
} else { //进入商品详情
|
|
|
|
|
+ IAC.play()
|
|
|
for (let con in ContentbtnArea) {
|
|
for (let con in ContentbtnArea) {
|
|
|
if (x >= ContentbtnArea[con].startX
|
|
if (x >= ContentbtnArea[con].startX
|
|
|
&& x <= ContentbtnArea[con].endX
|
|
&& x <= ContentbtnArea[con].endX
|
|
@@ -489,27 +542,44 @@ function handleProductHomepageEvents(x, y) {
|
|
|
for (let i = 0; i < DetailbtnArea.length; i++) {
|
|
for (let i = 0; i < DetailbtnArea.length; i++) {
|
|
|
let d = DetailbtnArea[i]
|
|
let d = DetailbtnArea[i]
|
|
|
if (x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
if (x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
|
- if (i === 0) {
|
|
|
|
|
|
|
+ if (i === 0) { //返回
|
|
|
|
|
+ IAC.play()
|
|
|
Detailstatus = false
|
|
Detailstatus = false
|
|
|
current_page = page.homepage
|
|
current_page = page.homepage
|
|
|
reStart() //重绘
|
|
reStart() //重绘
|
|
|
} else if (i === 1) {//分享好友
|
|
} else if (i === 1) {//分享好友
|
|
|
|
|
+ IAC.play()
|
|
|
wx.shareAppMessage({
|
|
wx.shareAppMessage({
|
|
|
//title: '经销商id:' + agent_id,
|
|
//title: '经销商id:' + agent_id,
|
|
|
query: 'agent_id=' + agent_id
|
|
query: 'agent_id=' + agent_id
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
} else if (i === 2) {//联系商家
|
|
} else if (i === 2) {//联系商家
|
|
|
|
|
+ IAC.play()
|
|
|
current_page = page.product_contact_modal
|
|
current_page = page.product_contact_modal
|
|
|
let tel = GoodsDetail.mobile
|
|
let tel = GoodsDetail.mobile
|
|
|
- new ContactModal(context, GoodsDetail.name, tel, GoodsDetail.addr).draw()
|
|
|
|
|
|
|
+ new ContactModal(context, FactoryName, tel, GoodsDetail.addr).draw()
|
|
|
} else if (i === 3) {//详情&购买
|
|
} else if (i === 3) {//详情&购买
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
current_page = page.product_buy_modal
|
|
current_page = page.product_buy_modal
|
|
|
- new ProductModal(context, GoodsDetail).draw()
|
|
|
|
|
|
|
+ productBuyModal = new ProductModal(context, GoodsDetail)
|
|
|
|
|
+ productBuyModal.draw().then(() => {
|
|
|
|
|
+ wx.hideLoading()
|
|
|
|
|
+ })
|
|
|
} else if (i === 4) {//尺寸&安装
|
|
} else if (i === 4) {//尺寸&安装
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
current_page = page.product_size_modal
|
|
current_page = page.product_size_modal
|
|
|
- new SizeModal(context, GoodsDetail).draw()
|
|
|
|
|
|
|
+ new SizeModal(context, GoodsDetail, 'size').draw().then(() => {
|
|
|
|
|
+ wx.hideLoading()
|
|
|
|
|
+ })
|
|
|
} else if (i === 5) {//上一张
|
|
} else if (i === 5) {//上一张
|
|
|
|
|
+ IAC.play()
|
|
|
Buttonstatus = false
|
|
Buttonstatus = false
|
|
|
if (flag3 <= 0) {
|
|
if (flag3 <= 0) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
@@ -526,6 +596,7 @@ function handleProductHomepageEvents(x, y) {
|
|
|
getGoodsDetail(callback4, GoodsSource)
|
|
getGoodsDetail(callback4, GoodsSource)
|
|
|
}
|
|
}
|
|
|
} else if (i === 6) {//下一张
|
|
} else if (i === 6) {//下一张
|
|
|
|
|
+ IAC.play()
|
|
|
Buttonstatus = false
|
|
Buttonstatus = false
|
|
|
if (flag3 == GoodsSource.length - 1) {
|
|
if (flag3 == GoodsSource.length - 1) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
@@ -550,6 +621,7 @@ function handleModalCloseModal(x, y) {
|
|
|
&& x <= modalCloseBtnArea[0].endX
|
|
&& x <= modalCloseBtnArea[0].endX
|
|
|
&& y >= modalCloseBtnArea[0].startY
|
|
&& y >= modalCloseBtnArea[0].startY
|
|
|
&& y <= modalCloseBtnArea[0].endY) {
|
|
&& y <= modalCloseBtnArea[0].endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
if (current_page === page.set_price_help_modal || current_page === page.set_price_modal) {
|
|
if (current_page === page.set_price_help_modal || current_page === page.set_price_modal) {
|
|
|
current_page = page.set_price
|
|
current_page = page.set_price
|
|
|
} else {
|
|
} else {
|
|
@@ -564,6 +636,7 @@ function handleSetPriceModalEvents(x, y) {
|
|
|
&& x <= SetPriceBtnArea[0].endX
|
|
&& x <= SetPriceBtnArea[0].endX
|
|
|
&& y >= SetPriceBtnArea[0].startY
|
|
&& y >= SetPriceBtnArea[0].startY
|
|
|
&& y <= SetPriceBtnArea[0].endY) {
|
|
&& y <= SetPriceBtnArea[0].endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
wx.showKeyboard({
|
|
wx.showKeyboard({
|
|
|
defaultValue: '',
|
|
defaultValue: '',
|
|
|
maxLength: 8,
|
|
maxLength: 8,
|
|
@@ -582,9 +655,11 @@ function handleSetPriceModalEvents(x, y) {
|
|
|
&& x <= SetPriceBtnArea[1].endX
|
|
&& x <= SetPriceBtnArea[1].endX
|
|
|
&& y >= SetPriceBtnArea[1].startY
|
|
&& y >= SetPriceBtnArea[1].startY
|
|
|
&& y <= SetPriceBtnArea[1].endY) {
|
|
&& y <= SetPriceBtnArea[1].endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
// 保存价格
|
|
// 保存价格
|
|
|
- setClick = false
|
|
|
|
|
- console.log('setSuccess')
|
|
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
let turl = 'https://t6.9026.com/api/album/set-price'
|
|
let turl = 'https://t6.9026.com/api/album/set-price'
|
|
|
wx.request({
|
|
wx.request({
|
|
|
url: turl,
|
|
url: turl,
|
|
@@ -608,9 +683,103 @@ function handleSetPriceModalEvents(x, y) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+function handleProductBuyModalMoveEvents(x1, y1, x2, y2) {
|
|
|
|
|
+ let p
|
|
|
|
|
+ if (!isTouchMoving) {
|
|
|
|
|
+ isTouchMoving = true
|
|
|
|
|
+ p = productBuyModal.scroll(x1, y1, x2, y2)
|
|
|
|
|
+ if (p) {
|
|
|
|
|
+ p.then(() => {
|
|
|
|
|
+ isTouchMoving = false
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ isTouchMoving = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+function handleProductBuyModalEvents(x, y) {
|
|
|
|
|
+ let d = ProductBuyModalBtnArea[3]
|
|
|
|
|
+ if (x >= d.startX && x <= d.endX && y >= d.startY && y <= d.endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ let is_fav = GoodsDetail.is_favorite
|
|
|
|
|
+ let url
|
|
|
|
|
+ if (is_fav) {
|
|
|
|
|
+ url = 'https://t6.9026.com/api/album/favorite_del'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ url = 'https://t6.9026.com/api/album/add_favorite'
|
|
|
|
|
+ }
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
|
|
+ wx.request({
|
|
|
|
|
+ url: url, //这里''里面填写你的服务器API接口的路径
|
|
|
|
|
+ data: {
|
|
|
|
|
+ store_id: 1,
|
|
|
|
|
+ user_id: 1,
|
|
|
|
|
+ product_id: GoodsDetail.id
|
|
|
|
|
+ }, //这里是可以填写服务器需要的参数
|
|
|
|
|
+ method: 'GET', // 声明GET请求
|
|
|
|
|
+ // header: {}, // 设置请求的 header,GET请求可以不填
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ wx.hideLoading()
|
|
|
|
|
+ if (res.statusCode == 200) {
|
|
|
|
|
+ GoodsDetail.is_favorite = is_fav ? '0' : '1'
|
|
|
|
|
+ productBuyModal.fav()
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '收藏成功',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 500
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '收藏失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 500
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ //console.log(res.statusCode)
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function(error) {
|
|
|
|
|
+ console.error('收藏失败', error)
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '收藏失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 500
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+function handleProductSizeModalEvents(x, y) {
|
|
|
|
|
+ let d0 = ProductSizeModalBtnArea[0]
|
|
|
|
|
+ let d1 = ProductSizeModalBtnArea[1]
|
|
|
|
|
+ let d2 = ProductSizeModalBtnArea[2]
|
|
|
|
|
+ if (x >= d0.startX && x <= d0.endX && y >= d0.startY && y <= d0.endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ reStart().then(() => {
|
|
|
|
|
+
|
|
|
|
|
+ new SizeModal(context, GoodsDetail, 'size').draw()
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (x >= d1.startX && x <= d1.endX && y >= d1.startY && y <= d1.endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ reStart().then(() => {
|
|
|
|
|
+
|
|
|
|
|
+ new SizeModal(context, GoodsDetail, 'pic').draw()
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (x >= d2.startX && x <= d2.endX && y >= d2.startY && y <= d2.endY) {
|
|
|
|
|
+ IAC.play()
|
|
|
|
|
+ reStart().then(() => {
|
|
|
|
|
+
|
|
|
|
|
+ new SizeModal(context, GoodsDetail, 'video').draw()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//清除之前绘制内容
|
|
//清除之前绘制内容
|
|
|
function reset() {
|
|
function reset() {
|
|
|
- context.clearRect(0, 0, screenWidth, screenHeight)
|
|
|
|
|
|
|
+ // context.clearRect(0, 0, screenWidth, screenHeight)
|
|
|
context.fillStyle = "#fff"
|
|
context.fillStyle = "#fff"
|
|
|
context.fillRect(0, 0, screenWidth, screenHeight)
|
|
context.fillRect(0, 0, screenWidth, screenHeight)
|
|
|
}
|
|
}
|
|
@@ -647,6 +816,8 @@ function getFLDsource(callback1, url) {
|
|
|
}
|
|
}
|
|
|
//在回调函数中通过顶级目录个数获得它的按钮区域
|
|
//在回调函数中通过顶级目录个数获得它的按钮区域
|
|
|
function callback1(res) {
|
|
function callback1(res) {
|
|
|
|
|
+
|
|
|
|
|
+ percent < 70 && (percent = 70)
|
|
|
getSLDsource(callback2, FLDsource)//获取二级目录信息
|
|
getSLDsource(callback2, FLDsource)//获取二级目录信息
|
|
|
}
|
|
}
|
|
|
//根据获取第一个请求函数得到的顶级目录信息来获取二级目录信息
|
|
//根据获取第一个请求函数得到的顶级目录信息来获取二级目录信息
|
|
@@ -683,6 +854,8 @@ function getSLDsource(callback2, FLDsource) {
|
|
|
}
|
|
}
|
|
|
//通过二级目录列表的长度来得到它的按钮区域列表
|
|
//通过二级目录列表的长度来得到它的按钮区域列表
|
|
|
function callback2(res) {
|
|
function callback2(res) {
|
|
|
|
|
+
|
|
|
|
|
+ percent < 80 && (percent = 80)
|
|
|
SLDbtnArea.splice(0, SLDbtnArea.length)//每次调用重新填充数据的时候清空之前数据
|
|
SLDbtnArea.splice(0, SLDbtnArea.length)//每次调用重新填充数据的时候清空之前数据
|
|
|
for (let i = 0; i < res.length; i++) {
|
|
for (let i = 0; i < res.length; i++) {
|
|
|
let s = false
|
|
let s = false
|
|
@@ -705,6 +878,9 @@ function getGoodsSource(callback3, SLDsource) {
|
|
|
style = SLDsource[flag2].id
|
|
style = SLDsource[flag2].id
|
|
|
}
|
|
}
|
|
|
let u = 'https://t6.9026.com/api/album/goods' + '?store_id=1&cat_id=' + cat_id + '&status=' + status + '&style=' + style
|
|
let u = 'https://t6.9026.com/api/album/goods' + '?store_id=1&cat_id=' + cat_id + '&status=' + status + '&style=' + style
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
wx.request({
|
|
wx.request({
|
|
|
url: u,
|
|
url: u,
|
|
|
data: {
|
|
data: {
|
|
@@ -712,6 +888,7 @@ function getGoodsSource(callback3, SLDsource) {
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ wx.hideLoading()
|
|
|
let test = JSON.stringify(res.data)
|
|
let test = JSON.stringify(res.data)
|
|
|
let tet = JSON.parse(test)
|
|
let tet = JSON.parse(test)
|
|
|
FactoryName = tet.data.name
|
|
FactoryName = tet.data.name
|
|
@@ -719,6 +896,13 @@ function getGoodsSource(callback3, SLDsource) {
|
|
|
for (let i in tet.data.goods) {
|
|
for (let i in tet.data.goods) {
|
|
|
GoodsSource.push(tet.data.goods[i])
|
|
GoodsSource.push(tet.data.goods[i])
|
|
|
}
|
|
}
|
|
|
|
|
+ if (GoodsSource.length === 0) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '当前列表无商品',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 500
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
title: '请求异常',
|
|
title: '请求异常',
|
|
@@ -733,22 +917,26 @@ function getGoodsSource(callback3, SLDsource) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
function callback3(res) {
|
|
function callback3(res) {
|
|
|
|
|
+ percent < 100 && (percent = 100)
|
|
|
console.log(GoodsSource)
|
|
console.log(GoodsSource)
|
|
|
|
|
+
|
|
|
|
|
+ isLoading = false
|
|
|
reStart()
|
|
reStart()
|
|
|
}
|
|
}
|
|
|
function getGoodsDetail(callback4, GoodsSource) {
|
|
function getGoodsDetail(callback4, GoodsSource) {
|
|
|
//如果所点击的区域没有商品展示,那么不进入详情界面
|
|
//如果所点击的区域没有商品展示,那么不进入详情界面
|
|
|
- let ur = 'https://t6.9026.com/api/album/goods-detail?store_id=1&agent_id=' + agent_id + '&goods_id='
|
|
|
|
|
- try {
|
|
|
|
|
- ur = ur + GoodsSource[flag3].id
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.log(e.message)
|
|
|
|
|
- Detailstatus = false
|
|
|
|
|
- // reStart()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let ur = 'https://t6.9026.com/api/album/goods-detail'
|
|
|
|
|
+ wx.showLoading({
|
|
|
|
|
+ title: 'loading',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
wx.request({
|
|
wx.request({
|
|
|
url: ur,
|
|
url: ur,
|
|
|
data: {
|
|
data: {
|
|
|
|
|
+ store_id: 1,
|
|
|
|
|
+ agent_id: agent_id,
|
|
|
|
|
+ goods_id: GoodsSource[flag3].id,
|
|
|
|
|
+ user_id: user_id
|
|
|
},
|
|
},
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
@@ -766,71 +954,104 @@ function getGoodsDetail(callback4, GoodsSource) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
callback4(GoodsDetail)//导出商品列表
|
|
callback4(GoodsDetail)//导出商品列表
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function(error) {
|
|
|
|
|
+ console.error(error)
|
|
|
|
|
+ Detailstatus = false
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
function callback4(res) {
|
|
function callback4(res) {
|
|
|
- if (GoodsDetail == null) {
|
|
|
|
|
- // wx.hideLoading()
|
|
|
|
|
- } else {
|
|
|
|
|
- wx.showLoading({
|
|
|
|
|
- title: 'loading',
|
|
|
|
|
- })
|
|
|
|
|
- //console.log(GoodsDetail)
|
|
|
|
|
- }
|
|
|
|
|
if (Detailstatus == true)//如果没获取到详情,说明所点击区域没有元素,不进行重绘
|
|
if (Detailstatus == true)//如果没获取到详情,说明所点击区域没有元素,不进行重绘
|
|
|
- reStart()
|
|
|
|
|
|
|
+ reStart(true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UserLogin() {
|
|
function UserLogin() {
|
|
|
|
|
|
|
|
- wx.showLoading({
|
|
|
|
|
- title: '正在登录',
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // wx.showLoading({
|
|
|
|
|
+ // title: '正在登录',
|
|
|
|
|
+ // })
|
|
|
wx.login({
|
|
wx.login({
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
let code = res.code
|
|
let code = res.code
|
|
|
console.log(code)
|
|
console.log(code)
|
|
|
|
|
+ percent < 20 && (percent = 20)
|
|
|
wx.getUserInfo({
|
|
wx.getUserInfo({
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
|
|
+ percent < 30 && (percent = 30)
|
|
|
let encrypted_data = res.encryptedData
|
|
let encrypted_data = res.encryptedData
|
|
|
let iv = res.iv
|
|
let iv = res.iv
|
|
|
let tx = res.userInfo.avatarUrl
|
|
let tx = res.userInfo.avatarUrl
|
|
|
let nn = res.userInfo.nickName
|
|
let nn = res.userInfo.nickName
|
|
|
console.log('getUserInfo success')
|
|
console.log('getUserInfo success')
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ code: code,
|
|
|
|
|
+ avatar: tx,
|
|
|
|
|
+ nickName: nn,
|
|
|
|
|
+ iv: iv,
|
|
|
|
|
+ store_id: 1
|
|
|
|
|
+ }
|
|
|
|
|
+ // wx.showToast({
|
|
|
|
|
+ // title: JSON.stringify(params),
|
|
|
|
|
+ // icon: 'none',
|
|
|
|
|
+ // duration: 5000
|
|
|
|
|
+ // })
|
|
|
|
|
+
|
|
|
wx.request({
|
|
wx.request({
|
|
|
url: 'https://t6.9026.com/api/album/xyx_login',
|
|
url: 'https://t6.9026.com/api/album/xyx_login',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
- data: {
|
|
|
|
|
- code: code,
|
|
|
|
|
- avatar: tx,
|
|
|
|
|
- nickName: nn,
|
|
|
|
|
- iv: iv,
|
|
|
|
|
- store_id: 1
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ data: params,
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
- let is_agent = res.data.data.d.data.is_agent
|
|
|
|
|
|
|
+ percent < 60 && (percent = 60)
|
|
|
|
|
+ let data = res.data.data
|
|
|
|
|
+ let is_agent = data.is_agent
|
|
|
if (is_agent == 1) {
|
|
if (is_agent == 1) {
|
|
|
isAgent = true
|
|
isAgent = true
|
|
|
- agent_id = res.data.data.d.data.agent_id
|
|
|
|
|
|
|
+ agent_id = data.agent_id
|
|
|
|
|
+ user_id = data.user_id
|
|
|
wx.hideLoading()
|
|
wx.hideLoading()
|
|
|
getFLDsource(callback1, url)
|
|
getFLDsource(callback1, url)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- isAgent = true
|
|
|
|
|
|
|
+ isAgent = false
|
|
|
var test = wx.getLaunchOptionsSync()
|
|
var test = wx.getLaunchOptionsSync()
|
|
|
console.log(test)
|
|
console.log(test)
|
|
|
agent_id = test.query.agent_id
|
|
agent_id = test.query.agent_id
|
|
|
|
|
+ user_id = data.user_id
|
|
|
if (agent_id == undefined)
|
|
if (agent_id == undefined)
|
|
|
agent_id = 0
|
|
agent_id = 0
|
|
|
console.log(agent_id)
|
|
console.log(agent_id)
|
|
|
wx.hideLoading()
|
|
wx.hideLoading()
|
|
|
getFLDsource(callback1, url)
|
|
getFLDsource(callback1, url)
|
|
|
}
|
|
}
|
|
|
|
|
+ }, fail: function () {
|
|
|
|
|
+ isLoading = false
|
|
|
|
|
+ // drawText(context, code, 0, 0, '', 28, '#000')
|
|
|
|
|
+ // drawText(context, tx, 0, font_size, '', 28, '#000')
|
|
|
|
|
+ // drawText(context, nn, 0, font_size * 2, '', 28, '#000')
|
|
|
|
|
+ // drawText(context, iv, 0, font_size * 3, '', 28, '#000')
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '系统登录失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 800
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ }, fail: function(){
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '获取用户信息失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 800
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ }, fail: function () {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '微信登录失败',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 800
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -847,6 +1068,11 @@ function search(KeyWord) {
|
|
|
let test = JSON.stringify(res.data)
|
|
let test = JSON.stringify(res.data)
|
|
|
let tet = JSON.parse(test)
|
|
let tet = JSON.parse(test)
|
|
|
GoodsSource.splice(0, GoodsSource.length)//每次调用重新填充数据的时候清空之前数据
|
|
GoodsSource.splice(0, GoodsSource.length)//每次调用重新填充数据的时候清空之前数据
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '这次共搜索到' + tet.data.goods.length + '个产品',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 800
|
|
|
|
|
+ })
|
|
|
for (let i in tet.data.goods) {
|
|
for (let i in tet.data.goods) {
|
|
|
GoodsSource.push(tet.data.goods[i])
|
|
GoodsSource.push(tet.data.goods[i])
|
|
|
}
|
|
}
|