From b1bffc696783ae15b08114f502f72d69cf25c740 Mon Sep 17 00:00:00 2001 From: liu Date: Fri, 24 Mar 2023 11:26:36 +0800 Subject: [PATCH] page --- .../pages/goods/buyRecords.js | 742 ++++++ .../pages/goods/buyRecords.json | 13 + .../pages/goods/buyRecords.wxml | 169 ++ .../pages/goods/buyRecords.wxss | 384 +++ eaterplanet_ecommerce/pages/goods/comment.js | 748 ++++++ .../pages/goods/comment.json | 12 + .../pages/goods/comment.wxml | 177 ++ .../pages/goods/comment.wxss | 395 +++ .../pages/goods/goodsDetail.js | 1943 +++++++++++++++ .../pages/goods/goodsDetail.json | 18 + .../pages/goods/goodsDetail.wxml | 587 +++++ .../pages/goods/goodsDetail.wxss | 1538 ++++++++++++ .../pages/goods/industrial.js | 33 + .../pages/goods/industrial.json | 4 + .../pages/goods/industrial.wxml | 3 + .../pages/goods/industrial.wxss | 3 + .../pages/goods/relativeGoodsList.js | 45 + .../pages/goods/relativeGoodsList.json | 8 + .../pages/goods/relativeGoodsList.wxml | 22 + .../pages/goods/relativeGoodsList.wxss | 98 + eaterplanet_ecommerce/pages/index/advert.js | 66 + eaterplanet_ecommerce/pages/index/advert.json | 6 + eaterplanet_ecommerce/pages/index/advert.wxml | 18 + eaterplanet_ecommerce/pages/index/advert.wxss | 122 + eaterplanet_ecommerce/pages/index/banner.wxml | 16 + eaterplanet_ecommerce/pages/index/blank.wxml | 3 + .../pages/index/communityShow.wxml | 55 + eaterplanet_ecommerce/pages/index/coupon.wxml | 27 + eaterplanet_ecommerce/pages/index/coupon.wxss | 85 + eaterplanet_ecommerce/pages/index/cube.wxml | 9 + eaterplanet_ecommerce/pages/index/cube.wxss | 156 ++ .../pages/index/diyCoupon.wxml | 65 + .../pages/index/diySeckill.wxml | 71 + .../pages/index/diySeckill.wxss | 13 + .../pages/index/diySingleImg.wxml | 7 + .../pages/index/floatBtn.wxml | 16 + .../pages/index/floatBtn.wxss | 36 + .../pages/index/goodsList.wxml | 86 + eaterplanet_ecommerce/pages/index/index.js | 2181 +++++++++++++++++ eaterplanet_ecommerce/pages/index/index.json | 41 + eaterplanet_ecommerce/pages/index/index.wxml | 553 +++++ eaterplanet_ecommerce/pages/index/index.wxss | 2075 ++++++++++++++++ eaterplanet_ecommerce/pages/index/line.wxml | 3 + eaterplanet_ecommerce/pages/index/notice.wxml | 15 + .../pages/index/richtext.wxml | 5 + eaterplanet_ecommerce/pages/index/search.wxml | 12 + eaterplanet_ecommerce/pages/index/search.wxss | 42 + eaterplanet_ecommerce/pages/index/share.js | 128 + eaterplanet_ecommerce/pages/index/share.json | 8 + eaterplanet_ecommerce/pages/index/share.wxml | 5 + eaterplanet_ecommerce/pages/index/share.wxss | 18 + .../pages/index/template/cube.wxml | 102 + .../pages/index/template/cube.wxss | 89 + .../pages/index/template/navlist.wxml | 41 + .../pages/index/template/navlist.wxss | 63 + .../pages/index/template/pin.wxml | 28 + .../pages/index/template/pin.wxss | 123 + .../pages/index/template/pinrow.wxml | 47 + .../pages/index/template/pinrow.wxss | 190 ++ .../pages/index/template/presalerow.wxml | 67 + .../pages/index/template/presalerow.wxss | 47 + .../pages/index/template/seckill.wxml | 29 + .../pages/index/template/seckill.wxss | 81 + .../pages/index/template/video.wxml | 9 + .../pages/index/template/video.wxss | 21 + .../pages/index/template/virtualcardrow.wxml | 66 + eaterplanet_ecommerce/pages/index/test.wxs | 16 + eaterplanet_ecommerce/pages/index/text.wxml | 5 + eaterplanet_ecommerce/pages/index/video.wxml | 5 + eaterplanet_ecommerce/pages/order/evaluate.js | 265 ++ .../pages/order/evaluate.json | 7 + .../pages/order/evaluate.wxml | 38 + .../pages/order/evaluate.wxss | 156 ++ .../pages/order/goods_express.js | 69 + .../pages/order/goods_express.json | 8 + .../pages/order/goods_express.wxml | 35 + .../pages/order/goods_express.wxss | 158 ++ eaterplanet_ecommerce/pages/order/index.js | 322 +++ eaterplanet_ecommerce/pages/order/index.json | 12 + eaterplanet_ecommerce/pages/order/index.wxml | 86 + eaterplanet_ecommerce/pages/order/index.wxss | 724 ++++++ eaterplanet_ecommerce/pages/order/order.js | 862 +++++++ eaterplanet_ecommerce/pages/order/order.json | 23 + eaterplanet_ecommerce/pages/order/order.wxml | 717 ++++++ eaterplanet_ecommerce/pages/order/order.wxss | 699 ++++++ .../pages/order/placeOrder.js | 1589 ++++++++++++ .../pages/order/placeOrder.json | 17 + .../pages/order/placeOrder.wxml | 584 +++++ .../pages/order/placeOrder.wxss | 966 ++++++++ eaterplanet_ecommerce/pages/order/refund.js | 447 ++++ eaterplanet_ecommerce/pages/order/refund.json | 6 + eaterplanet_ecommerce/pages/order/refund.wxml | 126 + eaterplanet_ecommerce/pages/order/refund.wxss | 222 ++ .../pages/order/refunddetail.js | 154 ++ .../pages/order/refunddetail.json | 7 + .../pages/order/refunddetail.wxml | 58 + .../pages/order/refunddetail.wxss | 172 ++ .../pages/order/shareOrderInfo.js | 109 + .../pages/order/shareOrderInfo.json | 13 + .../pages/order/shareOrderInfo.wxml | 44 + .../pages/order/shareOrderInfo.wxss | 118 + eaterplanet_ecommerce/pages/order/shopCart.js | 1818 ++++++++++++++ .../pages/order/shopCart.json | 18 + .../pages/order/shopCart.wxml | 334 +++ .../pages/order/shopCart.wxss | 667 +++++ .../pages/position/cities.js | 233 ++ .../pages/position/cities.json | 10 + .../pages/position/cities.wxml | 10 + .../pages/position/cities.wxss | 39 + .../pages/position/community.js | 448 ++++ .../pages/position/community.json | 9 + .../pages/position/community.wxml | 65 + .../pages/position/community.wxss | 256 ++ .../pages/position/search.js | 165 ++ .../pages/position/search.json | 9 + .../pages/position/search.wxml | 22 + .../pages/position/search.wxss | 79 + .../pages/refund/refundList.js | 245 ++ .../pages/refund/refundList.json | 10 + .../pages/refund/refundList.wxml | 76 + .../pages/refund/refundList.wxss | 305 +++ eaterplanet_ecommerce/pages/supply/apply.js | 239 ++ eaterplanet_ecommerce/pages/supply/apply.json | 7 + eaterplanet_ecommerce/pages/supply/apply.wxml | 54 + eaterplanet_ecommerce/pages/supply/apply.wxss | 186 ++ eaterplanet_ecommerce/pages/supply/home.js | 163 ++ eaterplanet_ecommerce/pages/supply/home.json | 15 + eaterplanet_ecommerce/pages/supply/home.wxml | 35 + eaterplanet_ecommerce/pages/supply/home.wxss | 154 ++ eaterplanet_ecommerce/pages/supply/index.js | 212 ++ eaterplanet_ecommerce/pages/supply/index.json | 14 + eaterplanet_ecommerce/pages/supply/index.wxml | 42 + eaterplanet_ecommerce/pages/supply/index.wxss | 148 ++ eaterplanet_ecommerce/pages/supply/recruit.js | 98 + .../pages/supply/recruit.json | 8 + .../pages/supply/recruit.wxml | 13 + .../pages/supply/recruit.wxss | 18 + eaterplanet_ecommerce/pages/type/details.js | 191 ++ eaterplanet_ecommerce/pages/type/details.json | 16 + eaterplanet_ecommerce/pages/type/details.wxml | 37 + eaterplanet_ecommerce/pages/type/details.wxss | 94 + eaterplanet_ecommerce/pages/type/index.js | 855 +++++++ eaterplanet_ecommerce/pages/type/index.json | 17 + eaterplanet_ecommerce/pages/type/index.wxml | 92 + eaterplanet_ecommerce/pages/type/index.wxss | 351 +++ eaterplanet_ecommerce/pages/type/result.js | 186 ++ eaterplanet_ecommerce/pages/type/result.json | 14 + eaterplanet_ecommerce/pages/type/result.wxml | 22 + eaterplanet_ecommerce/pages/type/result.wxss | 27 + eaterplanet_ecommerce/pages/type/search.js | 160 ++ eaterplanet_ecommerce/pages/type/search.json | 11 + eaterplanet_ecommerce/pages/type/search.wxml | 17 + eaterplanet_ecommerce/pages/type/search.wxss | 67 + eaterplanet_ecommerce/pages/type/type-item.js | 5 + .../pages/type/type-item.json | 11 + .../pages/type/type-item.wxml | 49 + .../pages/type/type-item.wxss | 309 +++ .../pages/user/articleProtocol.js | 110 + .../pages/user/articleProtocol.json | 8 + .../pages/user/articleProtocol.wxml | 6 + .../pages/user/articleProtocol.wxss | 8 + eaterplanet_ecommerce/pages/user/charge.js | 269 ++ eaterplanet_ecommerce/pages/user/charge.json | 9 + eaterplanet_ecommerce/pages/user/charge.wxml | 38 + eaterplanet_ecommerce/pages/user/charge.wxss | 130 + eaterplanet_ecommerce/pages/user/coupon.js | 148 ++ eaterplanet_ecommerce/pages/user/coupon.json | 10 + eaterplanet_ecommerce/pages/user/coupon.wxml | 52 + eaterplanet_ecommerce/pages/user/coupon.wxss | 355 +++ eaterplanet_ecommerce/pages/user/me.js | 623 +++++ eaterplanet_ecommerce/pages/user/me.json | 15 + eaterplanet_ecommerce/pages/user/me.wxml | 665 +++++ eaterplanet_ecommerce/pages/user/me.wxss | 915 +++++++ eaterplanet_ecommerce/pages/user/protocol.js | 82 + .../pages/user/protocol.json | 7 + .../pages/user/protocol.wxml | 8 + .../pages/user/protocol.wxss | 18 + .../pages/user/rechargeDetails.js | 120 + .../pages/user/rechargeDetails.json | 11 + .../pages/user/rechargeDetails.wxml | 26 + .../pages/user/rechargeDetails.wxss | 116 + eaterplanet_ecommerce/pages/user/rule.js | 94 + eaterplanet_ecommerce/pages/user/rule.json | 9 + eaterplanet_ecommerce/pages/user/rule.wxml | 6 + eaterplanet_ecommerce/pages/user/rule.wxss | 5 + eaterplanet_ecommerce/pages/web-view.js | 74 + eaterplanet_ecommerce/pages/web-view.json | 1 + eaterplanet_ecommerce/pages/web-view.wxml | 1 + eaterplanet_ecommerce/pages/web-view.wxss | 1 + 189 files changed, 35422 insertions(+) create mode 100644 eaterplanet_ecommerce/pages/goods/buyRecords.js create mode 100644 eaterplanet_ecommerce/pages/goods/buyRecords.json create mode 100644 eaterplanet_ecommerce/pages/goods/buyRecords.wxml create mode 100644 eaterplanet_ecommerce/pages/goods/buyRecords.wxss create mode 100644 eaterplanet_ecommerce/pages/goods/comment.js create mode 100644 eaterplanet_ecommerce/pages/goods/comment.json create mode 100644 eaterplanet_ecommerce/pages/goods/comment.wxml create mode 100644 eaterplanet_ecommerce/pages/goods/comment.wxss create mode 100644 eaterplanet_ecommerce/pages/goods/goodsDetail.js create mode 100644 eaterplanet_ecommerce/pages/goods/goodsDetail.json create mode 100644 eaterplanet_ecommerce/pages/goods/goodsDetail.wxml create mode 100644 eaterplanet_ecommerce/pages/goods/goodsDetail.wxss create mode 100644 eaterplanet_ecommerce/pages/goods/industrial.js create mode 100644 eaterplanet_ecommerce/pages/goods/industrial.json create mode 100644 eaterplanet_ecommerce/pages/goods/industrial.wxml create mode 100644 eaterplanet_ecommerce/pages/goods/industrial.wxss create mode 100644 eaterplanet_ecommerce/pages/goods/relativeGoodsList.js create mode 100644 eaterplanet_ecommerce/pages/goods/relativeGoodsList.json create mode 100644 eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxml create mode 100644 eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxss create mode 100644 eaterplanet_ecommerce/pages/index/advert.js create mode 100644 eaterplanet_ecommerce/pages/index/advert.json create mode 100644 eaterplanet_ecommerce/pages/index/advert.wxml create mode 100644 eaterplanet_ecommerce/pages/index/advert.wxss create mode 100644 eaterplanet_ecommerce/pages/index/banner.wxml create mode 100644 eaterplanet_ecommerce/pages/index/blank.wxml create mode 100644 eaterplanet_ecommerce/pages/index/communityShow.wxml create mode 100644 eaterplanet_ecommerce/pages/index/coupon.wxml create mode 100644 eaterplanet_ecommerce/pages/index/coupon.wxss create mode 100644 eaterplanet_ecommerce/pages/index/cube.wxml create mode 100644 eaterplanet_ecommerce/pages/index/cube.wxss create mode 100644 eaterplanet_ecommerce/pages/index/diyCoupon.wxml create mode 100644 eaterplanet_ecommerce/pages/index/diySeckill.wxml create mode 100644 eaterplanet_ecommerce/pages/index/diySeckill.wxss create mode 100644 eaterplanet_ecommerce/pages/index/diySingleImg.wxml create mode 100644 eaterplanet_ecommerce/pages/index/floatBtn.wxml create mode 100644 eaterplanet_ecommerce/pages/index/floatBtn.wxss create mode 100644 eaterplanet_ecommerce/pages/index/goodsList.wxml create mode 100644 eaterplanet_ecommerce/pages/index/index.js create mode 100644 eaterplanet_ecommerce/pages/index/index.json create mode 100644 eaterplanet_ecommerce/pages/index/index.wxml create mode 100644 eaterplanet_ecommerce/pages/index/index.wxss create mode 100644 eaterplanet_ecommerce/pages/index/line.wxml create mode 100644 eaterplanet_ecommerce/pages/index/notice.wxml create mode 100644 eaterplanet_ecommerce/pages/index/richtext.wxml create mode 100644 eaterplanet_ecommerce/pages/index/search.wxml create mode 100644 eaterplanet_ecommerce/pages/index/search.wxss create mode 100644 eaterplanet_ecommerce/pages/index/share.js create mode 100644 eaterplanet_ecommerce/pages/index/share.json create mode 100644 eaterplanet_ecommerce/pages/index/share.wxml create mode 100644 eaterplanet_ecommerce/pages/index/share.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/cube.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/cube.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/navlist.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/navlist.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/pin.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/pin.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/pinrow.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/pinrow.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/presalerow.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/presalerow.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/seckill.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/seckill.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/video.wxml create mode 100644 eaterplanet_ecommerce/pages/index/template/video.wxss create mode 100644 eaterplanet_ecommerce/pages/index/template/virtualcardrow.wxml create mode 100644 eaterplanet_ecommerce/pages/index/test.wxs create mode 100644 eaterplanet_ecommerce/pages/index/text.wxml create mode 100644 eaterplanet_ecommerce/pages/index/video.wxml create mode 100644 eaterplanet_ecommerce/pages/order/evaluate.js create mode 100644 eaterplanet_ecommerce/pages/order/evaluate.json create mode 100644 eaterplanet_ecommerce/pages/order/evaluate.wxml create mode 100644 eaterplanet_ecommerce/pages/order/evaluate.wxss create mode 100644 eaterplanet_ecommerce/pages/order/goods_express.js create mode 100644 eaterplanet_ecommerce/pages/order/goods_express.json create mode 100644 eaterplanet_ecommerce/pages/order/goods_express.wxml create mode 100644 eaterplanet_ecommerce/pages/order/goods_express.wxss create mode 100644 eaterplanet_ecommerce/pages/order/index.js create mode 100644 eaterplanet_ecommerce/pages/order/index.json create mode 100644 eaterplanet_ecommerce/pages/order/index.wxml create mode 100644 eaterplanet_ecommerce/pages/order/index.wxss create mode 100644 eaterplanet_ecommerce/pages/order/order.js create mode 100644 eaterplanet_ecommerce/pages/order/order.json create mode 100644 eaterplanet_ecommerce/pages/order/order.wxml create mode 100644 eaterplanet_ecommerce/pages/order/order.wxss create mode 100644 eaterplanet_ecommerce/pages/order/placeOrder.js create mode 100644 eaterplanet_ecommerce/pages/order/placeOrder.json create mode 100644 eaterplanet_ecommerce/pages/order/placeOrder.wxml create mode 100644 eaterplanet_ecommerce/pages/order/placeOrder.wxss create mode 100644 eaterplanet_ecommerce/pages/order/refund.js create mode 100644 eaterplanet_ecommerce/pages/order/refund.json create mode 100644 eaterplanet_ecommerce/pages/order/refund.wxml create mode 100644 eaterplanet_ecommerce/pages/order/refund.wxss create mode 100644 eaterplanet_ecommerce/pages/order/refunddetail.js create mode 100644 eaterplanet_ecommerce/pages/order/refunddetail.json create mode 100644 eaterplanet_ecommerce/pages/order/refunddetail.wxml create mode 100644 eaterplanet_ecommerce/pages/order/refunddetail.wxss create mode 100644 eaterplanet_ecommerce/pages/order/shareOrderInfo.js create mode 100644 eaterplanet_ecommerce/pages/order/shareOrderInfo.json create mode 100644 eaterplanet_ecommerce/pages/order/shareOrderInfo.wxml create mode 100644 eaterplanet_ecommerce/pages/order/shareOrderInfo.wxss create mode 100644 eaterplanet_ecommerce/pages/order/shopCart.js create mode 100644 eaterplanet_ecommerce/pages/order/shopCart.json create mode 100644 eaterplanet_ecommerce/pages/order/shopCart.wxml create mode 100644 eaterplanet_ecommerce/pages/order/shopCart.wxss create mode 100644 eaterplanet_ecommerce/pages/position/cities.js create mode 100644 eaterplanet_ecommerce/pages/position/cities.json create mode 100644 eaterplanet_ecommerce/pages/position/cities.wxml create mode 100644 eaterplanet_ecommerce/pages/position/cities.wxss create mode 100644 eaterplanet_ecommerce/pages/position/community.js create mode 100644 eaterplanet_ecommerce/pages/position/community.json create mode 100644 eaterplanet_ecommerce/pages/position/community.wxml create mode 100644 eaterplanet_ecommerce/pages/position/community.wxss create mode 100644 eaterplanet_ecommerce/pages/position/search.js create mode 100644 eaterplanet_ecommerce/pages/position/search.json create mode 100644 eaterplanet_ecommerce/pages/position/search.wxml create mode 100644 eaterplanet_ecommerce/pages/position/search.wxss create mode 100644 eaterplanet_ecommerce/pages/refund/refundList.js create mode 100644 eaterplanet_ecommerce/pages/refund/refundList.json create mode 100644 eaterplanet_ecommerce/pages/refund/refundList.wxml create mode 100644 eaterplanet_ecommerce/pages/refund/refundList.wxss create mode 100644 eaterplanet_ecommerce/pages/supply/apply.js create mode 100644 eaterplanet_ecommerce/pages/supply/apply.json create mode 100644 eaterplanet_ecommerce/pages/supply/apply.wxml create mode 100644 eaterplanet_ecommerce/pages/supply/apply.wxss create mode 100644 eaterplanet_ecommerce/pages/supply/home.js create mode 100644 eaterplanet_ecommerce/pages/supply/home.json create mode 100644 eaterplanet_ecommerce/pages/supply/home.wxml create mode 100644 eaterplanet_ecommerce/pages/supply/home.wxss create mode 100644 eaterplanet_ecommerce/pages/supply/index.js create mode 100644 eaterplanet_ecommerce/pages/supply/index.json create mode 100644 eaterplanet_ecommerce/pages/supply/index.wxml create mode 100644 eaterplanet_ecommerce/pages/supply/index.wxss create mode 100644 eaterplanet_ecommerce/pages/supply/recruit.js create mode 100644 eaterplanet_ecommerce/pages/supply/recruit.json create mode 100644 eaterplanet_ecommerce/pages/supply/recruit.wxml create mode 100644 eaterplanet_ecommerce/pages/supply/recruit.wxss create mode 100644 eaterplanet_ecommerce/pages/type/details.js create mode 100644 eaterplanet_ecommerce/pages/type/details.json create mode 100644 eaterplanet_ecommerce/pages/type/details.wxml create mode 100644 eaterplanet_ecommerce/pages/type/details.wxss create mode 100644 eaterplanet_ecommerce/pages/type/index.js create mode 100644 eaterplanet_ecommerce/pages/type/index.json create mode 100644 eaterplanet_ecommerce/pages/type/index.wxml create mode 100644 eaterplanet_ecommerce/pages/type/index.wxss create mode 100644 eaterplanet_ecommerce/pages/type/result.js create mode 100644 eaterplanet_ecommerce/pages/type/result.json create mode 100644 eaterplanet_ecommerce/pages/type/result.wxml create mode 100644 eaterplanet_ecommerce/pages/type/result.wxss create mode 100644 eaterplanet_ecommerce/pages/type/search.js create mode 100644 eaterplanet_ecommerce/pages/type/search.json create mode 100644 eaterplanet_ecommerce/pages/type/search.wxml create mode 100644 eaterplanet_ecommerce/pages/type/search.wxss create mode 100644 eaterplanet_ecommerce/pages/type/type-item.js create mode 100644 eaterplanet_ecommerce/pages/type/type-item.json create mode 100644 eaterplanet_ecommerce/pages/type/type-item.wxml create mode 100644 eaterplanet_ecommerce/pages/type/type-item.wxss create mode 100644 eaterplanet_ecommerce/pages/user/articleProtocol.js create mode 100644 eaterplanet_ecommerce/pages/user/articleProtocol.json create mode 100644 eaterplanet_ecommerce/pages/user/articleProtocol.wxml create mode 100644 eaterplanet_ecommerce/pages/user/articleProtocol.wxss create mode 100644 eaterplanet_ecommerce/pages/user/charge.js create mode 100644 eaterplanet_ecommerce/pages/user/charge.json create mode 100644 eaterplanet_ecommerce/pages/user/charge.wxml create mode 100644 eaterplanet_ecommerce/pages/user/charge.wxss create mode 100644 eaterplanet_ecommerce/pages/user/coupon.js create mode 100644 eaterplanet_ecommerce/pages/user/coupon.json create mode 100644 eaterplanet_ecommerce/pages/user/coupon.wxml create mode 100644 eaterplanet_ecommerce/pages/user/coupon.wxss create mode 100644 eaterplanet_ecommerce/pages/user/me.js create mode 100644 eaterplanet_ecommerce/pages/user/me.json create mode 100644 eaterplanet_ecommerce/pages/user/me.wxml create mode 100644 eaterplanet_ecommerce/pages/user/me.wxss create mode 100644 eaterplanet_ecommerce/pages/user/protocol.js create mode 100644 eaterplanet_ecommerce/pages/user/protocol.json create mode 100644 eaterplanet_ecommerce/pages/user/protocol.wxml create mode 100644 eaterplanet_ecommerce/pages/user/protocol.wxss create mode 100644 eaterplanet_ecommerce/pages/user/rechargeDetails.js create mode 100644 eaterplanet_ecommerce/pages/user/rechargeDetails.json create mode 100644 eaterplanet_ecommerce/pages/user/rechargeDetails.wxml create mode 100644 eaterplanet_ecommerce/pages/user/rechargeDetails.wxss create mode 100644 eaterplanet_ecommerce/pages/user/rule.js create mode 100644 eaterplanet_ecommerce/pages/user/rule.json create mode 100644 eaterplanet_ecommerce/pages/user/rule.wxml create mode 100644 eaterplanet_ecommerce/pages/user/rule.wxss create mode 100644 eaterplanet_ecommerce/pages/web-view.js create mode 100644 eaterplanet_ecommerce/pages/web-view.json create mode 100644 eaterplanet_ecommerce/pages/web-view.wxml create mode 100644 eaterplanet_ecommerce/pages/web-view.wxss diff --git a/eaterplanet_ecommerce/pages/goods/buyRecords.js b/eaterplanet_ecommerce/pages/goods/buyRecords.js new file mode 100644 index 0000000..f269424 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/buyRecords.js @@ -0,0 +1,742 @@ +// eaterplanet_ecommerce/pages/goods/buyRecords.js +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); + +var app = getApp(); +var buyClearTime = null; + +function count_down(that, total_micro_second) { + var second = Math.floor(total_micro_second / 1000); + var days = second / 3600 / 24; + var daysRound = Math.floor(days); + var hours = second / 3600 - (24 * daysRound); + var hoursRound = Math.floor(hours); + var minutes = second / 60 - (24 * 60 * daysRound) - (60 * hoursRound); + var minutesRound = Math.floor(minutes); + var seconds = second - (24 * 3600 * daysRound) - (3600 * hoursRound) - (60 * minutesRound); + + that.setData({ + endtime: { + days: fill_zero_prefix(daysRound), + hours: fill_zero_prefix(hoursRound), + minutes: fill_zero_prefix(minutesRound), + seconds: fill_zero_prefix(seconds), + show_detail: 1 + } + }); + + if (total_micro_second <= 0) { + clearTimeout(buyClearTime); + that.setData({ + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + } + }); + return; + } + + buyClearTime = setTimeout(function() { + total_micro_second -= 1000; + count_down(that, total_micro_second); + }, 1000) + +} +// 位数不足补零 +function fill_zero_prefix(num) { + return num < 10 ? "0" + num : num +} + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + showData: 1, + goodDetail: {}, + showTitle: "", + endTime: "", + loadText: "正在加载", + showBtn: true, + showSku: false, + skuList: [], + cartNum: 0, + type: 0, + goodsStatus: 0, + needAuth: false, + goodsIndex: 1, + goods_id: 0, + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + }, + rushList: [], + hasRefeshin: false, + pageNum: 1, + is_share_html: true, + iconArr: { + home: '', + car: '' + } + }, + goodId: 0, + community_id: '', + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + var token = wx.getStorageSync('token'); + status.setIcon().then(function(iconArr) { + that.setData({ iconArr }); + }); + this.goodId = options.id; + this.community_id = options.community_id; + + let currentCommunity = wx.getStorageSync('community'); + let currentCommunity_id = (currentCommunity && currentCommunity.communityId) || ''; + if (!currentCommunity_id) { + let community = {}; + if (options.community_id !== void 0 && options.community_id > 0) { + community.communityId = options.community_id; + } + util.getCommunityInfo(community).then(function(res) { + console.log('step1') + paramHandle(); + get_goods_details(res); + }).catch((param) => { + console.log('step4 新人') + if (Object.keys(param) != '') { + that.addhistory(param, true); + } + }); + } else { + console.log('step3') + paramHandle(); + get_goods_details(); + } + + if (options.share_id != 'undefined' && options.share_id > 0) wx.setStorage({ + key: "share_id", + data: options.share_id + }) + + function paramHandle() { + console.log('step2') + if (options.community_id != 'undefined' && options.community_id > 0) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_community_info', + 'community_id': options.community_id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + var community = res.data.data; + let community_id = currentCommunity_id; + if (options.community_id != community_id) { + wx.showModal({ + title: '温馨提示', + content: '是否切换为分享人所在小区“' + community.communityName, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + app.globalData.community = community; + app.globalData.changedCommunity = true; + wx.setStorage({ + key: "community", + data: community + }) + token && that.addhistory(community); + get_goods_details(community); + console.log('用户点击确定') + } else if (res.cancel) { + that.showNoBindCommunity(); + console.log('用户点击取消') + } + } + }) + } + } + } + }) + } + + that.setData({ + goods_id: options.id + }, () => { + that.load_buy_record(); + }) + } + + function get_goods_details(communityInfo) { + if (communityInfo) currentCommunity_id = communityInfo.communityId; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.get_goods_detail', + 'token': token, + 'id': options.id, + community_id: currentCommunity_id + }, + dataType: 'json', + success: function(res) { + wx.hideLoading(); + let goods = (res.data.data && res.data.data.goods) || ''; + // 商品不存在 + if (!goods || goods.length == 0 || Object.keys(goods) == '') { + wx.showModal({ + title: '提示', + content: '该商品不存在,回首页', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } + } + }) + } + let comment_list = res.data.comment_list; + comment_list.map(function(item) { + 14 * item.content.length / app.globalData.systemInfo.windowWidth > 3 && (item.showOpen = true), item.isOpen = true; + }) + that.setData({ + order_comment_count: res.data.order_comment_count, + order_comment_images: res.data.order_comment_images, + comment_list: comment_list, + loadover: true, + goods: goods, + buy_record_arr: res.data.data.buy_record_arr, + site_name: res.data.data.site_name, + share_title: goods.share_title, + options: res.data.data.options, + goods_image: res.data.data.goods_image, + goods_image_length: res.data.data.goods_image.length, + service: goods.tag, + favgoods: goods.favgoods, + cur_time: res.data.data.cur_time, + order: { + goods_id: res.data.data.goods.goods_id, + pin_id: res.data.data.pin_id, + }, + showSkeleton: false, + is_comunity_rest: res.data.is_comunity_rest, + goodsdetails_addcart_bg_color: res.data.goodsdetails_addcart_bg_color || 'linear-gradient(270deg, #f9c706 0%, #feb600 100%)', + goodsdetails_buy_bg_color: res.data.goodsdetails_buy_bg_color || 'linear-gradient(90deg, #ff5041 0%, #ff695c 100%)' + }) + if (res.data.is_comunity_rest == 1) { + wx.showModal({ + title: '温馨提示', + content: '团长休息中,欢迎下次光临!', + showCancel: false, + confirmColor: '#F75451', + confirmText: '好的', + success(res) {} + }) + } + let over_type = goods.over_type; + var seconds = 0; + if (over_type == 0) { + seconds = (goods.begin_time - res.data.data.cur_time) * 1000; + } else { + seconds = (goods.end_time - res.data.data.cur_time) * 1000; + } + if (seconds > 0) { + count_down(that, seconds); + } + } + }) + } + }, + + //未绑定提示 + showNoBindCommunity: function() { + wx.showModal({ + title: '提示', + content: '您未绑定该小区,请切换后下单!', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/position/community', + }) + } + } + }) + }, + + /** + * 历史社区 + */ + addhistory: function(community, isNew = false) { + var community_id = community.communityId; + console.log('addhistory'); + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.addhistory_community', + community_id: community_id, + 'token': token + }, + dataType: 'json', + success: function(res) { + if (isNew) { + console.log('新人 社区') + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_community_info', + community_id: community_id + }, + dataType: 'json', + success: function(result) { + if (result.data.code == 0) { + let community = result.data.data; + app.globalData.community = community; + app.globalData.changedCommunity = true; + wx.setStorage({ + key: "community", + data: community + }) + } + } + }) + } + } + }) + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + var id = this.goodId; + let currentCommunity = wx.getStorageSync('community'); + let community_id = (currentCommunity && currentCommunity.communityId) || (this.community_id || ''); + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/goods/buyRecords?id=' + id + '&community_id=' + community_id, + }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + + load_buy_record: function() { + var that = this; + var goods_id = this.data.goods_id; + if (!that.data.hasRefeshin) { + that.setData({ + hasRefeshin: true, + loadMore: true + }); + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.load_buy_recordlist', + goods_id: goods_id, + pageNum: that.data.pageNum, + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let rushList = that.data.rushList.concat(res.data.data); + that.setData({ + rushList: rushList, + pageNum: that.data.pageNum + 1, + loadMore: false, + hasRefeshin: false, + tip: '' + }); + + } else if (res.data.code == 1) { + //go data + that.setData({ + loadMore: false, + tip: '^_^已经到底了' + }) + + } else if (res.data.code == 2) { + //no login + } + } + }) + } + + }, + + addToCart: function(e) { + if (!this.authModal()) return; + var that = this; + var from_id = e.detail.formId; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": from_id + }, + dataType: 'json', + success: function(res) {} + }) + that.setData({ + is_just_addcar: 1 + }) + //加入购物车 + that.openSku(); + }, + + openSku: function() { + var that = this; + var goods_id = this.data.goods_id; + var options = this.data.options; + + that.setData({ + addCar_goodsid: goods_id + }) + + let list = options.list || []; + let arr = []; + if (list.length > 0) { + for (let i = 0; i < list.length; i++) { + let sku = list[i]['option_value'][0]; + let temp = { + name: sku['name'], + id: sku['option_value_id'], + index: i, + idx: 0 + }; + arr.push(temp); + } + //把单价剔除出来begin + + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + + var cur_sku_arr = options.sku_mu_list[id]; + + that.setData({ + sku: arr, + sku_val: 1, + cur_sku_arr: cur_sku_arr, + skuList: options, + visible: true, + showSku: true + }); + } else { + let goods = this.data.goods; + let cur_sku_arr = { + canBuyNum: goods.total, + spuName: goods.goodsname, + actPrice: goods.actPrice, + marketPrice: goods.marketPrice, + stock: goods.total, + skuImage: goods.image_thumb + } + that.setData({ + sku: [], + sku_val: 1, + cur_sku_arr: cur_sku_arr, + skuList: [] + }) + let formIds = { + detail: { + formId: "" + } + }; + formIds.detail.formId = "the formId is a mock one"; + that.gocarfrom(formIds); + //todo...addcart + } + + }, + + gocarfrom: function(e) { + var that = this; + var is_just_addcar = this.data.is_just_addcar; + wx.showLoading(); + var token = wx.getStorageSync('token'); + + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": e.detail.formId + }, + dataType: 'json', + success: function(res) {} + }) + + that.goOrder(); + }, + + closeSku: function() { + this.setData({ + visible: 0, + stopClick: false, + }); + }, + + goOrder: function() { + var that = this; + if (that.data.can_car) { + that.data.can_car = false; + } + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + var goods_id = that.data.goods_id; + var community_id = community.communityId; + var quantity = that.data.sku_val; + var cur_sku_arr = that.data.cur_sku_arr; + var sku_str = ''; + var is_just_addcar = that.data.is_just_addcar; + + if (cur_sku_arr && cur_sku_arr.option_item_ids) { + sku_str = cur_sku_arr.option_item_ids; + } + + let data = { + goods_id, + community_id, + quantity, + sku_str, + buy_type: 'dan', + pin_id: 0, + is_just_addcar + } + util.addCart(data).then(res=>{ + if(res.showVipModal==1) { + let { pop_vipmember_buyimage } = res.data; + wx.hideLoading(); + that.setData({ pop_vipmember_buyimage, showVipModal: true, visible: false }) + } else { + if (res.data.code == 3 || res.data.code == 7) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } else if (res.data.code == 4) { + wx.showToast({ + title: '您未登录', + duration: 2000, + }) + } else if (res.data.code == 6) { + var msg = res.data.msg; + let max_quantity = res.data.max_quantity || ''; + (max_quantity > 0) && that.setData({ sku_val: max_quantity }) + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + if (is_just_addcar == 1) { + that.closeSku(); + wx.showToast({ + title: "已加入购物车", + image: "../../images/addShopCart.png" + }) + app.globalData.cartNum = res.data.total + that.setData({ + cartNum: res.data.total + }); + status.indexListCarCount(goods_id); + } else { + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type=dan' + }) + } else { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type=dan' + }) + } + } + } + } + }).catch(res=>{ + app.util.message(res||'请求失败', '', 'error'); + }) + + }, + + selectSku: function(event) { + var that = this; + let str = event.currentTarget.dataset.type; + let obj = str.split("_"); + let arr = that.data.sku; + let temp = { + name: obj[3], + id: obj[2], + index: obj[0], + idx: obj[1] + }; + arr.splice(obj[0], 1, temp); + that.setData({ + sku: arr + }) + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + var options = this.data.skuList; + var cur_sku_arr = options.sku_mu_list[id]; + + that.setData({ + cur_sku_arr: cur_sku_arr + }); + + console.log(id); + }, + + submit: function(e) { + var from_id = e.detail.formId; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": from_id + }, + dataType: 'json', + success: function(res) {} + }) + + + }, + + balance: function(e) { + if (!this.authModal()) return; + this.setData({ + is_just_addcar: 0 + }) + //加入购物车 + this.openSku(); + }, + + setNum: function(event) { + let types = event.currentTarget.dataset.type; + var that = this; + var num = 1; + let sku_val = this.data.sku_val * 1; + if (types == 'add') { + num = sku_val + 1; + } else if (types == 'decrease') { + if (sku_val > 1) { + num = sku_val - 1; + } + } + + let arr = that.data.sku; + var options = this.data.skuList; + + + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + var cur_sku_arr = options.sku_mu_list[id]; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + + this.setData({ + sku_val: num + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + let that = this; + util.check_login_new().then((res) => { + if (!res) { + that.setData({ + needAuth: true + }) + } else { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } + }) + }, + + /** + * 提交购物车 + */ + confirmSku: function() { + var t = this; + this.closeSku(); + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + clearTimeout(buyClearTime); + console.log('onUload') + this.setData({ + showSku: false + }); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + this.load_buy_record(); + } +}) diff --git a/eaterplanet_ecommerce/pages/goods/buyRecords.json b/eaterplanet_ecommerce/pages/goods/buyRecords.json new file mode 100644 index 0000000..f5b1bae --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/buyRecords.json @@ -0,0 +1,13 @@ +{ + "navigationBarBackgroundColor": "#FFF", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "购买记录", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "i-card": "../../components/card/index", + "i-img": "../../components/img/index", + "i-load-more": "../../components/load-more/index", + "i-sku": "../../components/sku/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/buyRecords.wxml b/eaterplanet_ecommerce/pages/goods/buyRecords.wxml new file mode 100644 index 0000000..5d9b2cc --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/buyRecords.wxml @@ -0,0 +1,169 @@ + + + + + + + + {{goods.goodsname}} + + 每人限购{{goods.total_limit_count}}份 + 每单限购{{goods.one_limit_count}}份 + + 已售{{goods.seller_count}}{{goods_sale_unit}},剩余{{goods.total}}{{goods_sale_unit}} + + + + + ¥ + {{goods.price_front}}.{{goods.price_after}} + + 距结束 + 距开始 + 结束时间 + {{goods.end_date}} + + {{endtime.days}}天 + {{endtime.hours}}: + {{endtime.minutes}}: + {{endtime.seconds}} + + + + + + + + + + + + 还没有人购买哦 + + + + + + + + + {{item.username}} + 买了 + {{item.quantity}} + {{item.pay_time}} + + + + + + + + + + + + + + + 回首页 + + + + + + + {{cartNum}} + + 购物车 + + + + + 已抢光 + 已结束 + 已下架 + 即将开抢 + 团长休息中 + +
+ 加入购物车 + +
+
+ +
+ + +
+
+
+ + + + + + +
+ + + + diff --git a/eaterplanet_ecommerce/pages/goods/buyRecords.wxss b/eaterplanet_ecommerce/pages/goods/buyRecords.wxss new file mode 100644 index 0000000..1e840d8 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/buyRecords.wxss @@ -0,0 +1,384 @@ +.noBuyList { + background: #fff; +} + +.noBuyList .noBuyListCon { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + padding-bottom: 100rpx; +} + +.noBuyList .noBuyListCon .noBuyListImg { + width: 218rpx; + height: 218rpx; + margin-top: 200rpx; + margin-bottom: 30rpx; +} + +.noBuyList .noBuyListCon .noBuyListTit { + font-size: 30rpx; + color: #666; +} + +.buyRecords { + padding-bottom: 40rpx; +} + +.buyRecords .buyListCon { + padding: 0 20rpx; + margin-top: 30rpx; + margin-bottom: 120rpx; +} + +.buyRecords .buyListCon .buyList .buyListInfo { + height: 120rpx; + padding-left: 30rpx; + border-bottom: 1rpx solid #efefef; + display: flex; + align-items: center; + justify-content: flex-start; +} + +.buyRecords .buyListCon .buyList .buyListInfo:last-child { + border: none; +} + +.buyRecords .buyListCon .buyList .buyListInfo .userImg { + width: 72rpx; + height: 72rpx; + border-radius: 36rpx; + margin-right: 20rpx; +} + +.buyRecords .buyListCon .buyList .buyListInfo .userName { + max-width: 200rpx; + font-size: 28rpx; + color: #666; + margin-right: 10rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.buyRecords .buyListCon .buyList .buyListInfo .buyNum { + font-size: 28rpx; + color: #666; + margin-right: 20rpx; +} + +.buyRecords .buyListCon .buyList .buyListInfo .buyNum text { + color: #ff758c; +} + +.buyRecords .buyListCon .buyList .buyListInfo .buyTime { + font-size: 22rpx; + color: #aaa; +} + +.canvas-img { + position: absolute; + top: -20000rpx; +} + +button::after { + border: none; +} + +.goodsInfo { + background: #fff; + padding: 30rpx; + border-top: 0.1rpx solid #efefef; + border-bottom: 0.1rpx solid #efefef; + display: flex; + justify-content: space-between; +} + +.goodsInfo .goodsImg { + width: 180rpx; + margin-right: 30rpx; +} + +.goodsInfo .goodsImg .img-class { + width: 180rpx; + height: 180rpx; +} + +.goodsInfo .goodsDetail { + width: 480rpx; + min-height: 180rpx; +} + +.goodsInfo .goodsDetail .detailTop { + min-height: 120rpx; + display: flex; + justify-content: space-between; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo { + width: 380rpx; + padding-right: 20rpx; + border-right: 2rpx dashed #aaa; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo .goodsName { + width: 380rpx; + font-size: 26rpx; + color: #444; + font-weight: bold; + line-height: 32rpx; + margin-bottom: 6rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo .purchasing, +.goodsInfo .goodsDetail .detailTop .detailTopInfo .saleNum { + font-size: 22rpx; + color: #aaa; +} + +.goodsInfo .goodsDetail .detailTop .shareBtn { + display: flex; + justify-content: center; + align-items: center; + background: #fff; + padding: 0; + margin-right: 4rpx; +} + +.goodsInfo .goodsDetail .detailTop .shareBtn .shareImg { + width: 42rpx; + height: 36rpx; +} + +.goodsInfo .goodsDetail .detailBottom { + margin-top: 10rpx; + display: flex; + align-items: center; + justify-content: space-between; +} + +.goodsInfo .goodsDetail .detailBottom .price { + font-size: 20rpx; + color: #ff758c; +} + +.goodsInfo .goodsDetail .detailBottom .price text { + font-size: 36rpx; + font-weight: bold; +} + +.goodsInfo .goodsDetail .detailBottom .time { + width: 290rpx; + font-size: 26rpx; + color: #444; + white-space: nowrap; + display: flex; + align-items: center; + justify-content: flex-end; +} + +.goodsInfo .goodsDetail .detailBottom .time .countdown { + display: flex; + justify-content: center; + align-items: center; +} + +.goodsInfo .goodsDetail .detailBottom .time .countdown .itemTime { + width: 38rpx; + height: 32rpx; + background: #444; + border-radius: 4rpx; + font-size: 26rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +/***商品底部按钮begin **/ +.goods-bottom-bar { + border-radius: 30rpx 30rpx 30rpx 30rpx; + height: 96rpx; + display: flex; +} + +.goods-bottom-bar .leftBtn { + height: 96rpx; + display: flex; + +} + +.goods-bottom-bar .leftBtn .bar-item { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} +.goods-bottom-bar .leftBtn .back-to-index { + background-color: #36362D; + border-radius: 0rpx 8rpx 8rpx 0rpx; + width: 125rpx; + height: 96rpx; + font-size: 18rpx; + color: #fff; +} +.goods-bottom-bar .leftBtn .back-to-index image { + width: 50rpx; + height: 50rpx; +} +.goods-bottom-bar .leftBtn .shop-cart { + + border-radius: 8rpx 0rpx 0rpx 8rpx; + margin-left: 6rpx; + background-color: #36362D; + width: 125rpx; + height: 96rpx; + font-size: 18rpx; + color: #fff; + position: relative; +} +.goods-bottom-bar .leftBtn .shop-cart .icon { + + width: 50rpx; + height: 50rpx; + position: relative; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon image { + + padding-right: 40rpx; + width: 100%; + height: 100%; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon .cart-num { + position: absolute; + right: -16rpx; + top: -4rpx; + width: 36rpx; + height: 36rpx; + background: #ff758c; + border-radius: 36rpx; + color: #fff; + font-size: 22rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .goodsStatus { + width: 100%; + height: 96rpx; + background: #dcdcdc; + font-size: 30rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-weight: bold; + /**background-color: #1c1819;**/ + overflow: hidden; + border-radius: 0rpx 40rpx 40rpx 0rpx; + +} +.bar-item add-to-cart { + background: rgb(247, 112, 98); +} + + +.goods-bottom-bar .gobuy .add-to-cart { + width: 270rpx; + height: 96rpx; + background: #36362D!important; + border-left:2rpx solid #666; + color: #fff; + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy .btn { + width: 270rpx; + height: 96rpx; + position: absolute; + opacity: 0; + z-index: 9; + top: 0; + padding: 0; + margin: 0; + box-shadow: 20rpx 20rpx 20rpx 0rpx rgba(0,0,0,0.8); +} + +.goods-bottom-bar .gobuy .balanceBtn { + display: flex; + flex: 1; +} + +.goods-bottom-bar .gobuy .balanceBtn .balance { + height: 96rpx; + flex: 1; + background: linear-gradient(270deg,rgb(253, 35, 70) 0%,#feb600 100%)!important; + color: #fff; + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0rpx 0px 0px 0rpx; +} + +.i-fixed-bottom { + background-color: rgba(0,0,0,0.3); + position: fixed; + bottom: 40rpx; + z-index: 100; + overflow: hidden; + left: 30rpx; + right:30rpx; + border-radius: 48rpx 48rpx 48rpx 48rpx; + box-shadow: 0rpx 10rpx 20rpx 10rpx rgba(0,0,0,0.4); + +} + .filter { + background-color: rgba(255, 255, 255, 0.8); + display: flex; + flex-direction: row; + justify-content: space-around; + position: fixed; + bottom: 40rpx; + left: 0; + z-index: 2; + width: 100%; + height: 96rpx; + backdrop-filter: blur(30rpx) ; + border-radius: 30rpx 30rpx 30rpx 30rpx; + margin-left: 20rpx; + margin-right: 20rpx; + overflow: hidden; +} + +.i-fixed-bottom.iphoneX-height { + padding-bottom: 48rpx; +} + +.i-fixed-bottom.pb20 { + padding-bottom: 40rpx; +} + + + + diff --git a/eaterplanet_ecommerce/pages/goods/comment.js b/eaterplanet_ecommerce/pages/goods/comment.js new file mode 100644 index 0000000..5b7f26f --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/comment.js @@ -0,0 +1,748 @@ +// pages/goods/comment.js +var util = require('../../utils/util.js'); +var app = getApp(); +var buyClearTime = null; +var status = require('../../utils/index.js'); + +function count_down(that, total_micro_second) { + var second = Math.floor(total_micro_second / 1000); + var days = second / 3600 / 24; + var daysRound = Math.floor(days); + var hours = second / 3600 - (24 * daysRound); + var hoursRound = Math.floor(hours); + var minutes = second / 60 - (24 * 60 * daysRound) - (60 * hoursRound); + var minutesRound = Math.floor(minutes); + var seconds = second - (24 * 3600 * daysRound) - (3600 * hoursRound) - (60 * minutesRound); + + that.setData({ + endtime: { + days: fill_zero_prefix(daysRound), + hours: fill_zero_prefix(hoursRound), + minutes: fill_zero_prefix(minutesRound), + seconds: fill_zero_prefix(seconds), + show_detail: 1 + } + }); + + if (total_micro_second <= 0) { + clearTimeout(buyClearTime); + that.setData({ + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + } + }); + return; + } + + buyClearTime = setTimeout(function() { + total_micro_second -= 1000; + count_down(that, total_micro_second); + }, 1000) + +} +// 位数不足补零 +function fill_zero_prefix(num) { + return num < 10 ? "0" + num : num +} + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + showData: 1, + cartNum: 0, + needAuth: false, + iconArr: { + home: '', + car: '' + }, + list: [], + loadMore: true, + tip: '加载中' + }, + page: 1, + hasRefeshin: false, + goodId: 0, + community_id: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + var token = wx.getStorageSync('token'); + status.setNavBgColor(); + status.setIcon().then(function(iconArr) { + that.setData({iconArr}); + }); + + this.goodId = options.id; + this.community_id = options.community_id; + let currentCommunity = wx.getStorageSync('community'); + let currentCommunity_id = (currentCommunity && currentCommunity.communityId) || ''; + if (!currentCommunity_id) { + let community = {}; + if (options.community_id !== void 0 && options.community_id > 0) { + community.communityId = options.community_id; + } + util.getCommunityInfo(community).then(function (res) { + console.log('step1') + paramHandle(); + get_goods_details(res); + }).catch((param) => { + console.log('step4 新人') + if (Object.keys(param) != '') { + that.addhistory(param, true); + } + }); + } else { + console.log('step3') + paramHandle(); + get_goods_details(); + } + + if (options.share_id != 'undefined' && options.share_id > 0) wx.setStorage({ key: "share_id", data: options.share_id }) + + function paramHandle() { + console.log('step2') + if (options.community_id != 'undefined' && options.community_id > 0) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_community_info', + 'community_id': options.community_id + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + var community = res.data.data; + let hisCommunity = currentCommunity; + let community_id = currentCommunity_id; + if (options.community_id != community_id) { + wx.showModal({ + title: '温馨提示', + content: '是否切换为分享人所在小区“' + community.communityName, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + app.globalData.community = community; + app.globalData.changedCommunity = true; + wx.setStorage({ + key: "community", + data: community + }) + token && that.addhistory(community); + get_goods_details(community); + console.log('用户点击确定') + } else if (res.cancel) { + that.showNoBindCommunity(); + console.log('用户点击取消') + } + } + }) + } + } + } + }) + } + + that.setData({ + goods_id: options.id + }, ()=>{ + that.load_comment_list(); + }) + } + + function get_goods_details(communityInfo) { + if (communityInfo) currentCommunity_id = communityInfo.communityId; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.get_goods_detail', + 'token': token, + 'id': options.id, + community_id: currentCommunity_id + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + let goods = (res.data.data && res.data.data.goods) || ''; + // 商品不存在 + if (!goods || goods.length == 0 || Object.keys(goods) == '') { + wx.showModal({ + title: '提示', + content: '该商品不存在,回首页', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } + } + }) + } + let comment_list = res.data.comment_list; + comment_list.map(function (item) { + 14 * item.content.length / app.globalData.systemInfo.windowWidth > 3 && (item.showOpen = true), item.isOpen = true; + }) + that.setData({ + order_comment_count: res.data.order_comment_count, + order_comment_images: res.data.order_comment_images, + comment_list: comment_list, + loadover: true, + goods: goods, + buy_record_arr: res.data.data.buy_record_arr, + site_name: res.data.data.site_name, + share_title: goods.share_title, + options: res.data.data.options, + goods_image: res.data.data.goods_image, + goods_image_length: res.data.data.goods_image.length, + service: goods.tag, + favgoods: goods.favgoods, + cur_time: res.data.data.cur_time, + order: { + goods_id: res.data.data.goods.goods_id, + pin_id: res.data.data.pin_id, + }, + showSkeleton: false, + is_comunity_rest: res.data.is_comunity_rest, + goodsdetails_addcart_bg_color: res.data.goodsdetails_addcart_bg_color || 'linear-gradient(270deg, #f9c706 0%, #feb600 100%)', + goodsdetails_buy_bg_color: res.data.goodsdetails_buy_bg_color || 'linear-gradient(90deg, #ff5041 0%, #ff695c 100%)' + }) + if (res.data.is_comunity_rest == 1) { + wx.showModal({ + title: '温馨提示', + content: '团长休息中,欢迎下次光临!', + showCancel: false, + confirmColor: '#F75451', + confirmText: '好的', + success(res) { } + }) + } + let over_type = goods.over_type; + var seconds = 0; + if (over_type == 0) { + seconds = (goods.begin_time - res.data.data.cur_time) * 1000; + } else { + seconds = (goods.end_time - res.data.data.cur_time) * 1000; + } + if (seconds > 0) { + count_down(that, seconds); + } + } + }) + } + }, + + //未绑定提示 + showNoBindCommunity: function () { + wx.showModal({ + title: '提示', + content: '您未绑定该小区,请切换后下单!', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/position/community', + }) + } + } + }) + }, + + /** + * 历史社区 + */ + addhistory: function (community, isNew = false) { + var community_id = community.communityId; + console.log('addhistory'); + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.addhistory_community', + community_id: community_id, + 'token': token + }, + dataType: 'json', + success: function (res) { + if (isNew) { + console.log('新人 社区') + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_community_info', + community_id: community_id + }, + dataType: 'json', + success: function (result) { + if (result.data.code == 0) { + let community = result.data.data; + app.globalData.community = community; + app.globalData.changedCommunity = true; + wx.setStorage({ + key: "community", + data: community + }) + } + } + }) + } + } + }) + }, + + load_comment_list: function(){ + let goods_id = this.data.goods_id; + let token = wx.getStorageSync('token'); + let that = this; + + !this.hasRefeshin && (that.hasRefeshin = true, that.setData({ loadMore: true, tip: '加载中' }), app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.comment_info', + token: token, + goods_id: goods_id, + page: that.page + }, + dataType: 'json', + success: function (res) { + if(res.data.code==0){ + let commentList = res.data.list; + commentList.map(function (item) { + 14 * item.content.length / app.globalData.systemInfo.windowWidth > 3 && (item.showOpen = true), item.isOpen = true; + }) + let list = that.data.list.concat(commentList); + that.page++; + that.hasRefeshin = false; + that.setData({ list, loadMore: false, tip: '' }) + } else if (res.data.code == 1) { + // 无数据 + if (that.page == 1) that.setData({ showData:0 }) + that.setData({ + loadMore: false, + tip: '^_^已经到底了' + }) + } else if(res.data.code == 2) { + //no login + } else { + //其他 + } + } + })) + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + var id = this.goodId; + let currentCommunity = wx.getStorageSync('community'); + let community_id = (currentCommunity && currentCommunity.communityId) || (this.community_id || ''); + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/goods/comment?id=' + id + '&community_id=' + community_id, + }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + + onShow: function() { + let that = this; + util.check_login_new().then((res) => { + if (!res) { + that.setData({ + needAuth: true + }) + } else { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } + }) + }, + + //加入购物车 + addToCart: function(e) { + if (!this.authModal()) return; + var that = this; + var from_id = e.detail.formId; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": from_id + }, + dataType: 'json', + success: function(res) {} + }) + that.setData({ + is_just_addcar: 1 + }) + + //加入购物车 + that.openSku(); + }, + + // 打开选框 + openSku: function() { + var that = this; + var goods_id = this.data.goods_id; + var options = this.data.options; + + that.setData({ + addCar_goodsid: goods_id + }) + + let list = options.list || []; + let arr = []; + if (list.length > 0) { + for (let i = 0; i < list.length; i++) { + let sku = list[i]['option_value'][0]; + let temp = { + name: sku['name'], + id: sku['option_value_id'], + index: i, + idx: 0 + }; + arr.push(temp); + } + //把单价剔除出来begin + + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + + var cur_sku_arr = options.sku_mu_list[id]; + that.setData({ + sku: arr, + sku_val: 1, + cur_sku_arr: cur_sku_arr, + skuList: options, + visible: true, + showSku: true + }); + } else { + let goods = this.data.goods; + let cur_sku_arr = { + canBuyNum: goods.total, + spuName: goods.goodsname, + actPrice: goods.actPrice, + marketPrice: goods.marketPrice, + stock: goods.total, + skuImage: goods.image_thumb + } + that.setData({ + sku: [], + sku_val: 1, + cur_sku_arr: cur_sku_arr, + skuList: [] + }) + let formIds = { + detail: { + formId: "" + } + }; + formIds.detail.formId = "the formId is a mock one"; + that.gocarfrom(formIds); + //todo...addcart + } + }, + + gocarfrom: function(e) { + var that = this; + var is_just_addcar = this.data.is_just_addcar; + wx.showLoading(); + var token = wx.getStorageSync('token'); + + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": e.detail.formId + }, + dataType: 'json', + success: function(res) {} + }) + + that.goOrder(); + }, + + closeSku: function() { + this.setData({ + visible: 0, + stopClick: false, + }); + }, + + goOrder: function() { + var that = this; + if (that.data.can_car) { + that.data.can_car = false; + } + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + var goods_id = that.data.goods_id; + var community_id = community.communityId; + var quantity = that.data.sku_val; + var cur_sku_arr = that.data.cur_sku_arr; + var sku_str = ''; + var is_just_addcar = that.data.is_just_addcar; + if (cur_sku_arr && cur_sku_arr.option_item_ids) { + sku_str = cur_sku_arr.option_item_ids; + } + + let data = { + goods_id, + community_id, + quantity, + sku_str, + buy_type: 'dan', + pin_id: 0, + is_just_addcar + } + util.addCart(data).then(res=>{ + if(res.showVipModal==1) { + let { pop_vipmember_buyimage } = res.data; + wx.hideLoading(); + that.setData({ pop_vipmember_buyimage, showVipModal: true, visible: false }) + } else { + if (res.data.code == 3 || res.data.code == 7) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } else if (res.data.code == 4) { + wx.showToast({ + title: '您未登录', + duration: 2000, + }) + } else if (res.data.code == 6) { + var msg = res.data.msg; + let max_quantity = res.data.max_quantity || ''; + (max_quantity > 0) && that.setData({ sku_val: max_quantity }) + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + if (is_just_addcar == 1) { + that.closeSku(); + wx.showToast({ + title: "已加入购物车", + image: "../../images/addShopCart.png" + }) + app.globalData.cartNum = res.data.total + that.setData({ + cartNum: res.data.total + }); + status.indexListCarCount(goods_id); + } else { + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type=dan' + }) + } else { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type=dan' + }) + } + } + } + } + }).catch(res=>{ + app.util.message(res||'请求失败', '', 'error'); + }) + + }, + + selectSku: function(event) { + var that = this; + let str = event.currentTarget.dataset.type; + let obj = str.split("_"); + let arr = that.data.sku; + let temp = { + name: obj[3], + id: obj[2], + index: obj[0], + idx: obj[1] + }; + arr.splice(obj[0], 1, temp); + that.setData({ + sku: arr + }) + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + var options = this.data.skuList; + var cur_sku_arr = options.sku_mu_list[id]; + + that.setData({ + cur_sku_arr: cur_sku_arr + }); + + console.log(id); + }, + + submit: function(e) { + var from_id = e.detail.formId; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": from_id + }, + dataType: 'json', + success: function(res) {} + }) + }, + + balance: function(e) { + if (!this.authModal()) return; + this.setData({ + is_just_addcar: 0 + }) + //加入购物车 + this.openSku(); + }, + + //加减商品数量 + setNum: function(event) { + let types = event.currentTarget.dataset.type; + var that = this; + var num = 1; + let sku_val = this.data.sku_val * 1; + if (types == 'add') { + num = sku_val + 1; + } else if (types == 'decrease') { + if (sku_val > 1) { + num = sku_val - 1; + } + } + + let arr = that.data.sku; + var options = this.data.skuList; + + + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + var cur_sku_arr = options.sku_mu_list[id]; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + + this.setData({ + sku_val: num + }) + }, + + /** + * 图片预览 + */ + preview: function(t) { + var a = t.currentTarget.dataset.index, + e = t.currentTarget.dataset.idx; + wx.previewImage({ + urls: this.data.list[a].images, + current: this.data.list[a].images[e], + fail: function(t) { + wx.showToast({ + title: "预览图片失败,请重试", + icon: "none" + }), console.log(t); + } + }); + }, + + /** + * 复制内容 + */ + copy: function(t) { + wx.setClipboardData({ + data: t.currentTarget.dataset.val, + success: function() { + wx.showToast({ + title: "内容复制成功!", + icon: "none" + }); + } + }); + }, + + /** + * 展开收起 + */ + bindOpen: function(t) { + var idx = t.currentTarget.dataset.idx; + if (this.data.list[idx].isOpen) { + this.data.list[idx].isOpen = false; + var list = this.data.list; + this.setData({ + list: list + }); + } else { + this.data.list[idx].isOpen = true; + var list = this.data.list; + this.setData({ + list: list + }); + } + }, + + onReachBottom: function () { + console.log('我是底线'); + this.load_comment_list(); + } +}) diff --git a/eaterplanet_ecommerce/pages/goods/comment.json b/eaterplanet_ecommerce/pages/goods/comment.json new file mode 100644 index 0000000..1e4a51a --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/comment.json @@ -0,0 +1,12 @@ +{ + "navigationBarBackgroundColor": "#FFF", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "商品评价", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-card": "../../components/card/index", + "i-img": "../../components/img/index", + "i-new-auth": "../../components/new-auth/index", + "i-load-more": "../../components/load-more/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/comment.wxml b/eaterplanet_ecommerce/pages/goods/comment.wxml new file mode 100644 index 0000000..0e33512 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/comment.wxml @@ -0,0 +1,177 @@ + + + + + + + + {{goods.goodsname}} + + 每人限购{{goods.total_limit_count}}份 + 每单限购{{goods.one_limit_count}}份 + + 已售{{goods.seller_count}}{{goods_sale_unit}},剩余{{goods.total}}{{goods_sale_unit}} + + + + + ¥ + {{goods.price_front}}.{{goods.price_after}} + + 距结束 + 距开始 + 结束时间 + {{goods.end_date}} + + {{endtime.days}}天 + {{endtime.hours}}: + {{endtime.minutes}}: + {{endtime.seconds}} + + + + + + + + + + 暂无评论 + + + + + + + + + + {{item.user_name}} + + {{item.content}} + + {{item.isOpen?'展开':'收起'}} + + + + + + + + {{item.add_time}} + + + + + + + + + + + + + + + 回首页 + + + + + + + {{cartNum}} + + 购物车 + + + + + 已抢光 + 已结束 + 已下架 + 即将开抢 + 团长休息中 + +
+ 加入购物车 + +
+
+ +
+ + +
+
+
+ + + + + + +
+ + + + diff --git a/eaterplanet_ecommerce/pages/goods/comment.wxss b/eaterplanet_ecommerce/pages/goods/comment.wxss new file mode 100644 index 0000000..8d12278 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/comment.wxss @@ -0,0 +1,395 @@ +.noComments { + height: 100%; + background: #fff; +} + +.noComments .noCommentsCon { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + padding-bottom: 260rpx; +} + +.noComments .noCommentsCon .noCommentsImg { + width: 218rpx; + height: 218rpx; + margin-top: 260rpx; + margin-bottom: 30rpx; +} + +.noComments .noCommentsCon .noCommentsTit { + font-size: 30rpx; + color: #666; +} + +.comments { + padding-bottom: 40rpx; +} + +.comments .commentsDetail { + padding: 0 20rpx; + margin-top: 30rpx; + margin-bottom: 120rpx; +} + +.comments .commentsDetail .commentsList { + margin-bottom: 20rpx; +} + +.comments .commentsDetail .commentsList .commentsListInfo { + padding: 30rpx; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsCon { + font-size: 28rpx; + color: #666; + line-height: 44rpx; + margin-bottom: 10rpx; + word-wrap: break-word; +} + +.comments .commentsDetail .commentsList .commentsListInfo .doubleHidden { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsOpen { + height: 22rpx; + font-size: 22rpx; + color: #444; + font-weight: bold; + margin-bottom: 20rpx; + display: flex; + align-items: center; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsOpen .commentsOpenImg { + width: 16rpx; + height: 8rpx; + margin-left: 6rpx; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsOpen .down { + transform: rotate(180deg); +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsImgCon { + display: flex; + justify-content: flex-start; + overflow-x: auto; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsImgCon .commentsImg { + margin-right: 16rpx; + display: flex; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsImgCon .commentsImg .goodsImg { + width: 150rpx; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsImgCon .commentsImg .goodsImg .img-class { + width: 150rpx; + height: 150rpx; + border-radius: 4rpx; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsImgCon .commentsImg:last-child { + margin: 0; +} + +.comments .commentsDetail .commentsList .commentsListInfo .commentsTime { + font-size: 22rpx; + color: #aaa; + line-height: 22rpx; + margin-top: 20rpx; + display: flex; + justify-content: flex-end; +} + +.canvas-img { + position: absolute; + top: -20000rpx; +} + +button::after { + border: none; +} + +.goodsInfo { + background: #fff; + padding: 30rpx; + border-top: 0.1rpx solid #efefef; + border-bottom: 0.1rpx solid #efefef; + display: flex; + justify-content: space-between; +} + +.goodsInfo .goodsImg { + width: 180rpx; + margin-right: 30rpx; +} + +.goodsInfo .goodsImg .img-class { + width: 180rpx; + height: 180rpx; +} + +.goodsInfo .goodsDetail { + width: 480rpx; + min-height: 180rpx; +} + +.goodsInfo .goodsDetail .detailTop { + min-height: 120rpx; + display: flex; + justify-content: space-between; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo { + width: 380rpx; + padding-right: 20rpx; + border-right: 2rpx dashed #aaa; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo .goodsName { + width: 380rpx; + font-size: 26rpx; + color: #444; + font-weight: bold; + line-height: 32rpx; + margin-bottom: 6rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.goodsInfo .goodsDetail .detailTop .detailTopInfo .purchasing, +.goodsInfo .goodsDetail .detailTop .detailTopInfo .saleNum { + font-size: 22rpx; + color: #aaa; +} + +.goodsInfo .goodsDetail .detailTop .shareBtn { + display: flex; + justify-content: center; + align-items: center; + background: #fff; + padding: 0; + margin-right: 4rpx; +} + +.goodsInfo .goodsDetail .detailTop .shareBtn .shareImg { + width: 42rpx; + height: 36rpx; +} + +.goodsInfo .goodsDetail .detailBottom { + margin-top: 10rpx; + display: flex; + align-items: center; + justify-content: space-between; +} + +.goodsInfo .goodsDetail .detailBottom .price { + font-size: 20rpx; + color: #ff758c; +} + +.goodsInfo .goodsDetail .detailBottom .price text { + font-size: 36rpx; + font-weight: bold; +} + +.goodsInfo .goodsDetail .detailBottom .time { + width: 290rpx; + font-size: 26rpx; + color: #444; + white-space: nowrap; + display: flex; + align-items: center; + justify-content: flex-end; +} + +.goodsInfo .goodsDetail .detailBottom .time .countdown { + display: flex; + justify-content: center; + align-items: center; +} + +.goodsInfo .goodsDetail .detailBottom .time .countdown .itemTime { + width: 38rpx; + height: 32rpx; + background: #444; + border-radius: 4rpx; + font-size: 26rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +/***商品底部按钮begin **/ + +.goods-bottom-bar { + height: 96rpx; + display: flex; +} + +.goods-bottom-bar .leftBtn { + height: 94rpx; + display: flex; + border-top: 2rpx solid #efefef; +} + +.goods-bottom-bar .leftBtn .bar-item { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.goods-bottom-bar .leftBtn .back-to-index { + width: 132rpx; + height: 94rpx; + font-size: 20rpx; + color: #707070; +} + +.goods-bottom-bar .leftBtn .back-to-index image { + width: 54rpx; + height: 54rpx; +} + +.goods-bottom-bar .leftBtn .shop-cart { + width: 132rpx; + height: 96rpx; + font-size: 20rpx; + color: #707070; + position: relative; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon { + width: 54rpx; + height: 54rpx; + position: relative; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon image { + width: 100%; + height: 100%; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon .cart-num { + position: absolute; + right: -16rpx; + top: -4rpx; + width: 36rpx; + height: 36rpx; + background: #ff758c; + border-radius: 36rpx; + color: #fff; + font-size: 22rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .goodsStatus { + width: 100%; + height: 96rpx; + background: #dcdcdc; + font-size: 30rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-weight: bold; +} + +.goods-bottom-bar .gobuy .add-to-cart { + width: 240rpx; + height: 96rpx; + background: linear-gradient(270deg,#4facfe 0%,#00f2fe 100%); + color: #fff; + font-size: 30rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy .btn { + width: 208rpx; + height: 96rpx; + position: absolute; + opacity: 0; + z-index: 9; + top: 0; + padding: 0; + margin: 0; +} + +.goods-bottom-bar .gobuy .balanceBtn { + display: flex; + flex: 1; +} + +.goods-bottom-bar .gobuy .balanceBtn .balance { + height: 96rpx; + flex: 1; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + color: #fff; + font-size: 30rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.i-fixed-bottom { + position: fixed; + bottom: 0px; + z-index: 100; + width: 100%; + background-color: #fff; +} + +/***商品底部按钮end **/ + +.comment-user { + line-height: 60rpx; + display: flex; + margin-bottom: 10rpx +} + +.comment-user image { + width: 60rpx; + height: 60rpx; + border-radius: 50%; + margin-right: 14rpx; + background-color: #f0f0f0; +} + +.comment-user text { + font-size: 26rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/goodsDetail.js b/eaterplanet_ecommerce/pages/goods/goodsDetail.js new file mode 100644 index 0000000..94ccd15 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/goodsDetail.js @@ -0,0 +1,1943 @@ +// eaterplanet_ecommerce/pages/goods/goodsDetail.js +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var app = getApp(); +var detailClearTime = null; + +function count_down(that, total_micro_second) { + var second = Math.floor(total_micro_second / 1000); + var days = second / 3600 / 24; + var daysRound = Math.floor(days); + var hours = second / 3600 - (24 * daysRound); + var hoursRound = Math.floor(hours); + var minutes = second / 60 - (24 * 60 * daysRound) - (60 * hoursRound); + var minutesRound = Math.floor(minutes); + var seconds = second - (24 * 3600 * daysRound) - (3600 * hoursRound) - (60 * minutesRound); + + that.setData({ + endtime: { + days: fill_zero_prefix(daysRound), + hours: fill_zero_prefix(hoursRound), + minutes: fill_zero_prefix(minutesRound), + seconds: fill_zero_prefix(seconds), + show_detail: 1 + } + }); + + if (total_micro_second <= 0) { + clearTimeout(detailClearTime); + detailClearTime = null; + if (that.data.goods.over_type==0){ + that.authSuccess(); + } + that.setData({ + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + } + }); + return; + } + + detailClearTime = setTimeout(function() { + total_micro_second -= 1000; + count_down(that, total_micro_second); + }, 1000) + +} +// 位数不足补零 +function fill_zero_prefix(num) { + return num < 10 ? "0" + num : num +} + +Page({ + $name: 'goodsDetail', + mixins: [require('../../mixin/globalMixin.js')], + data: { + bottomBarHeight: app.globalData.statusBarHeight - 4 + 'px', + needAuth: false, + goodsIndex: 1, + goods_id: 0, + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + }, + is_share_html: true, + stickyFlag: false, + showSkeleton: true, + imageSize: { + imageWidth: "100%", + imageHeight: 375 + }, + cartNum: 0, + noIns: false, + index_bottom_image: '', + hideModal: true, + shareImgUrl: '', + goods_details_middle_image: '', + is_show_buy_record: 0, + stopNotify: true, + iconArr: { + home: '', + car: '' + }, + canvasWidth: 375, + canvasHeight: 300, + fmShow: true, + relative_goods_list: [], + needPosition: false, + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + showCoverVideo: false, // Todo + loaded: false, + presale_goods_info: '', // 预售信息 + presaleState: 0, //预售状态 0未开始 1 进行中 2 已结束 + presaleBalance: 0 //预售尾款 + }, + $data: { + stickyFlag: false, + id: '', + scene: '', + community_id: 0 + }, + imageUrl: '', + goodsImg: '', + currentOptions: [], + focusFlag: false, + buy_type: '', + show_goods_preview: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + app.setShareConfig(); + let webImages = wx.getStorageSync('webImages'); + let goods_image = []; + if(webImages && webImages[0]) { + let local_path = webImages[0].local_path; + let imageSize = { imageHeight: webImages[0].height } + goods_image.push({ image: local_path, imageSize }) + wx.setStorageSync('webImages', ''); + } + this.setData({ goods_image }); + app.globalData.navBackUrl = ''; + status.setNavBgColor(); + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + status.setIcon().then(function (iconArr){ + that.setData({ iconArr }); + }); + let room_id = options.room_id || ''; + let buy_type = options.type || ''; + if(!room_id){ + var scene = decodeURIComponent(options.scene); + if (scene !== 'undefined') { + var opt_arr = scene.split("_"); + options.id = opt_arr[0]; + options.share_id = opt_arr[1]; + options.community_id = opt_arr[2]; + } + } else { + buy_type = ''; + } + this.buy_type = buy_type; + if (options.share_id != 'undefined' && options.share_id > 0) wx.setStorage({ key: "share_id", data: options.share_id }); + + this.$data.id = options.id; + this.$data.community_id = options.community_id; + this.$data.scene = options.scene; + + let h = { + canvasWidth: app.globalData.systemInfo.windowWidth, + canvasHeight: 0.8 * app.globalData.systemInfo.windowWidth, + buy_type, + goods_id: options.id + }; + + // 当前本地社区 + let currentCommunity = wx.getStorageSync('community'); + let currentCommunity_id = (currentCommunity && currentCommunity.communityId) || ''; + wx.showLoading(); + + if (options.community_id != 'undefined' && options.community_id > 0 && buy_type!='integral') { + // 存在分享社区进行比较 + if (currentCommunity_id) { + console.log('step3 本地社区存在') + this.paramHandle(options, currentCommunity); + } else { + // 当前本地社区不存在 + let community = {}; + community.communityId = options.community_id; + util.getCommunityInfo().then(function(res){ + console.log('step1 分享来的社区', res); + that.paramHandle(options, res); + }).catch((param)=>{ + console.log('step4 新人') + if(Object.keys(param) != '') util.addhistory(param, true); + }); + } + } else { + // 没有分享社区直接访问 + util.getCommunityById(0).then(ret=>{ + console.log('没有分享社区直接访问', ret) + if (ret.open_danhead_model == 1) { + let default_head_info = ret.default_head_info; + console.log('default_head_info', default_head_info) + app.globalData.community = default_head_info; + if(currentCommunity && (currentCommunity.communityId != default_head_info.communityId)) app.globalData.changedCommunity = true; + util.addhistory(default_head_info); + wx.setStorage({ key: "community", data: default_head_info }) + that.setData({ community: default_head_info }) + that.get_goods_details(options.id, default_head_info, ''); + } else { + util.getCommunityInfo().then(res=>{ + if(res) { + that.setData({ community: res }) + that.get_goods_details(options.id, '', res.communityId); + } else { + that.setData({ community: currentCommunity }); + that.get_goods_details(options.id, '', currentCommunity_id); + } + }) + } + }) + } + + that.setData(h); + this.get_instructions(); + }, + + /** + * 比较社区 + * @param {分享参数} options + * @param {本地社区信息} currentCommunity + */ + paramHandle: function (options, currentCommunity=""){ + console.log('step2') + let that = this; + let { id, community_id } = options; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.get_community_info', + community_id + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let shareCommunity = res.data.data; + console.log(shareCommunity) + let currentCommunityId = currentCommunity.communityId; + //单社区 + if (res.data.open_danhead_model == 1) { + let default_head_info = res.data.default_head_info; + app.globalData.community = default_head_info; + if(currentCommunity && (currentCommunity.communityId != default_head_info.communityId)) app.globalData.changedCommunity = true; + util.addhistory(default_head_info); + wx.setStorage({ key: "community", data: default_head_info }) + that.setData({ community: default_head_info }) + that.get_goods_details(id, default_head_info, ''); + } else { + if (currentCommunityId == community_id || shareCommunity=='') { + console.log('step5 分享与本地相同') + wx.setStorageSync('community', shareCommunity); + that.setData({ community: shareCommunity }) + that.get_goods_details(options.id, '', community_id); + } else { + if (currentCommunityId) { + that.setData({ + showChangeCommunity: true, + changeCommunity: shareCommunity, + community: currentCommunity + }) + that.get_goods_details(options.id, '', currentCommunityId, Number(!res.data.hide_community_change_btn)); + } else { + that.setData({ changeCommunity: shareCommunity }, () => { + that.confrimChangeCommunity(); + }) + } + } + } + } + } + }) + }, + + /** + * 不可购买提示 + */ + canBuyTip: function(){ + let groupInfo = this.data.groupInfo; + app.util.message(`此商品在您所属${groupInfo.group_name}不可参与`, 'switchTo:/eaterplanet_ecommerce/pages/index/index','error'); + }, + + get_goods_details: function (id, communityInfo='', currentCommunity_id, laterShowCanBuy=0){ + let that = this; + if(!id) { + wx.hideLoading(); + wx.showModal({ + title: '提示', + content: '参数错误', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } + } + }) + return false; + } + let token = wx.getStorageSync('token'); + if(communityInfo) currentCommunity_id = communityInfo.communityId; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'goods.get_goods_detail', + token: token, + id, + community_id: currentCommunity_id + }, + dataType: 'json', + success: function (res) { + setTimeout(function(){ wx.hideLoading(); },1000); + let { goods, is_can_headsales } = res.data.data; + // 商品不存在 + if (!goods || goods.nogoods || Object.keys(goods) == '') { + return wx.showModal({ + title: '提示', + content: '该商品不存在,回首页', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } + } + }) + } + + console.log('is_can_headsales', is_can_headsales, laterShowCanBuy) + if(is_can_headsales==0&&that.buy_type!='integral') { + if(laterShowCanBuy==0) { + that.canBuyTip(); + } + } + + let comment_list = res.data.comment_list; + comment_list.map(function (item) { + 14 * item.content.length / app.globalData.systemInfo.windowWidth > 3 && (item.showOpen = true), item.isOpen = true; + }) + + // 幻灯片预览数组 + let goods_images = res.data.data.goods_image || ''; + let prevImgArr = []; + if (Object.prototype.toString.call(goods_images) == '[object Array]' && goods_images.length > 0) { + goods_images.forEach(function (item) { prevImgArr.push(item.image); }) + } + + //群分享 + let isopen_community_group_share = res.data.isopen_community_group_share || 0; + let group_share_info = res.data.group_share_info; + + // 关联商品 + let relative_goods_list = res.data.data.relative_goods_list || []; + let relative_goods_list_arr = []; + if (Object.prototype.toString.call(relative_goods_list) == '[object Object]' && Object.keys(relative_goods_list).length > 0) { + Object.keys(relative_goods_list).forEach(function (item) { + relative_goods_list_arr.push(relative_goods_list[item]); + }) + } else { + relative_goods_list_arr = relative_goods_list; + } + + // 会员 + let { is_need_subscript, need_subscript_template, is_open_vipcard_buy, modify_vipcard_name, is_vip_card_member, modify_vipcard_logo, is_member_level_buy, is_only_hexiao, hexiao_arr, is_hide_details_count } = res.data; + let goodsPrice = goods.price || 0; + let goodsCardPrice = goods.card_price || 0; + goods.feePrice = (goodsPrice - goodsCardPrice).toFixed(2); + + // 佣金 + let { is_commiss_mb, commiss_mb_money, is_goods_head_mb, goods_head_money } = res.data.data; + + hexiao_arr = hexiao_arr?hexiao_arr:[]; + let hx_len = Object.keys(hexiao_arr).length; + that.currentOptions = res.data.data.options; + + //开启全屏视频 + let showCoverVideo = false; + if(goods.video && res.data.is_open_goods_full_video==1) { + showCoverVideo = true + } + + let goodsImg = res.data.data.goods_image || []; + + that.show_goods_preview = res.data.show_goods_preview || 0; + let is_close_details_time = res.data.is_close_details_time || 0; + + // 预售信息 + let preData = {}; + if(that.buy_type=='presale') { + let presale_goods_info = res.data.data.presale_goods_info; + preData.presale_goods_info = presale_goods_info; + let presaleBalance = 0; + let { presale_ding_money, presale_deduction_money } = presale_goods_info; + let presaleDeduction = presale_deduction_money>0?presale_deduction_money*1:presale_ding_money*1; + presaleBalance = goods.price*1 - presaleDeduction; + preData.presaleBalance = presaleBalance>0?presaleBalance.toFixed(2):'0.00'; + preData.presale_goods_info.presale_deduction_money = presaleDeduction; + } + + // 礼品卡 + let virtualcard_goods_info = res.data.data.virtualcard_goods_info; + + that.setData({ + showCoverVideo, + order_comment_count: res.data.order_comment_count, + comment_list: comment_list, + goods, + options: res.data.data.options, + order: { + goods_id: res.data.data.goods.goods_id, + pin_id: res.data.data.pin_id, + }, + share_title: goods.share_title, + buy_record_arr: res.data.data.buy_record_arr, + goods_image: goodsImg, + goods_image_length: goodsImg.length, + service: goods.tag, + showSkeleton: false, + is_comunity_rest: res.data.is_comunity_rest, + prevImgArr, + open_man_orderbuy: res.data.open_man_orderbuy, + man_orderbuy_money: res.data.man_orderbuy_money, + localtown_moneytype_fixed_freemoney: res.data.localtown_moneytype_fixed_freemoney, + is_only_distribution: res.data.is_only_distribution, + goodsdetails_addcart_bg_color: res.data.goodsdetails_addcart_bg_color || 'linear-gradient(270deg, #f9c706 0%, #feb600 100%)', + goodsdetails_buy_bg_color: res.data.goodsdetails_buy_bg_color || 'linear-gradient(90deg, #ff5041 0%, #ff695c 100%)', + isopen_community_group_share, + group_share_info, + relative_goods_list: relative_goods_list_arr, + needPosition: currentCommunity_id ? true : false, + is_close_details_time, + is_open_vipcard_buy: is_open_vipcard_buy || 0, + modify_vipcard_name, + is_vip_card_member: is_vip_card_member || 0, + modify_vipcard_logo, + is_commiss_mb, + commiss_mb_money, + is_goods_head_mb, + goods_head_money, + is_member_level_buy, + is_need_subscript, + need_subscript_template, + is_can_headsales, + is_only_hexiao, + hexiao_arr, + hx_len, + is_hide_details_count, + goods_details_title_bg: res.data.goods_details_title_bg, + needAuth: res.data.needauth, + ishide_details_desc: res.data.ishide_details_desc, + delivery_type_ziti: res.data.delivery_type_ziti || '', + loaded: true, + ...preData, + virtualcard_goods_info + }, () => { + let goods_share_image = goods.goods_share_image; + if (goods_share_image) { + console.log('draw分享图'); + status.download(goods_share_image + "?imageView2/1/w/500/h/400").then(function (a) { + that.goodsImg = a.tempFilePath, that.drawImgNoPrice(); + }); + } else { + console.log('draw价格'); + let shareImg = goods.image_thumb; + status.download(shareImg + "?imageView2/1/w/500/h/400").then(function (a) { + that.goodsImg = a.tempFilePath, that.drawImg(); + }); + } + }) + if (res.data.is_comunity_rest == 1) { + wx.showModal({ + title: '温馨提示', + content: `${that.data.groupInfo.owner_name}休息中,欢迎下次光临!`, + showCancel: false, + confirmColor: '#F75451', + confirmText: '好的', + success(res) { } + }) + } + + if(that.buy_type=='presale') { + // 预售商品计时 + // 判断状态 presale_ding_time_start 开始时间 presale_ding_time_end 结束时间 + let { presale_goods_info, cur_time } = res.data.data; + let { presale_ding_time_start, presale_ding_time_end } = presale_goods_info; + let presaleState = 1; + let seconds = (presale_ding_time_end*1 - cur_time) * 1000; + if(presale_ding_time_start*1>cur_time) { + // 未开始 + presaleState = 0; + seconds = (presale_ding_time_start*1 - cur_time) * 1000; + } + if(presale_ding_time_end*10&&count_down(that, seconds); + } else { + // 普通商品计时 + let over_type = goods.over_type; + var seconds = 0; + if (over_type == 0) { + seconds = (goods.begin_time - res.data.data.cur_time) * 1000; + } else { + seconds = (goods.end_time - res.data.data.cur_time) * 1000; + } + if (seconds > 0&&is_close_details_time==0) { + count_down(that, seconds); + } + } + } + }) + }, + + confrimChangeCommunity: function(){ + let community = this.data.changeCommunity; + let token = wx.getStorageSync('token'); + app.globalData.community = community; + app.globalData.changedCommunity = true; + wx.setStorage({ + key: "community", + data: community + }) + token && util.addhistory(community); + + this.setData({ community, showChangeCommunity: false }) + this.get_goods_details(this.data.goods_id, community, community.communityId); + console.log('用户点击确定') + }, + + cancelChangeCommunity: function() { + let is_can_headsales = this.data.is_can_headsales; + if(is_can_headsales==0) { + this.canBuyTip(); + } + console.log('取消切换') + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + var id = this.$data.id; + var scene = this.$data.scene; + var community_id = this.$data.community_id; + let url = '/eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + id + '&community_id=' + community_id + '&scene=' + scene+ '&type=' + this.data.buy_type; + app.globalData.navBackUrl = url; + let currentCommunity = wx.getStorageSync('community'); + let needPosition = this.data.needPosition; + this.setData({ needAuth: false }) + if (currentCommunity) needPosition = false; + needPosition || wx.redirectTo({ url }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + + /** + * 图片信息 + */ + imageLoad: function(e) { + var imageSize = util.imageUtil(e) + this.setData({ + imageSize + }) + }, + + /** + * 获取服务信息 + */ + get_instructions: function() { + let that = this; + let goods_id = this.$data.id; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.get_instructions', + goods_id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + var instructions = res.data.data.value; + if (instructions == '') that.setData({ noIns: true }) + that.setData({ + instructions, + index_bottom_image: res.data.data.index_bottom_image, + goods_details_middle_image: res.data.data.goods_details_middle_image, + is_show_buy_record: res.data.data.is_show_buy_record, + order_notify_switch: res.data.data.order_notify_switch, + is_show_comment_list: res.data.data.is_show_comment_list, + goods_details_price_bg: res.data.data.goods_details_price_bg, + isShowContactBtn: res.data.data.index_service_switch || 0, + goods_industrial_switch: res.data.data.goods_industrial_switch || 0, + goods_industrial: res.data.data.goods_industrial || '', + is_show_ziti_time: res.data.data.is_show_ziti_time || 0, + hide_community_change_btn: res.data.data.hide_community_change_btn || 0, + is_show_goodsdetails_communityinfo: res.data.data.is_show_goodsdetails_communityinfo || 0 + }) + } + } + }) + }, + + /** + * 返回顶部 + */ + returnTop: function() { + this.stickyFlag = false; + this.setData({ + stickyFlag: false + }); + wx.pageScrollTo({ + scrollTop: 0, + duration: 500 + }); + }, + + /** + * 加入购物车 + */ + addToCart: function(e) { + if (!this.authModal()) return; + var that = this; + var from_id = e.detail.formId; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": from_id + }, + dataType: 'json', + success: function(res) {} + }) + that.setData({ + is_just_addcar: 1 + }) + + //加入购物车 + that.openSku(); + }, + + /** + * 打开购物车 + */ + openSku: function(t=null) { + if (!this.authModal()) return; + var that = this; + var is_just_addcar = this.data.is_just_addcar; + let oneday_limit_count = 0; + let total_limit_count = 0; + let one_limit_count = 0; + let goods_start_count = 1; + var options = null; + let car_quantity = 0; + if(t) { + var e = t.detail; + var goods_id = e.actId; + options = e.skuList; + is_just_addcar = 1; + oneday_limit_count = e.allData && e.allData.oneday_limit_count || 0; + total_limit_count = e.allData && e.allData.total_limit_count || 0; + one_limit_count = e.allData && e.allData.one_limit_count || 0; + goods_start_count = e.allData && e.allData.goods_start_count || 1; + } else { + let goods = this.data.goods; + var goods_id = this.data.goods_id; + options = this.currentOptions; + oneday_limit_count = goods.oneday_limit_count || 0; + total_limit_count = goods.total_limit_count || 0; + one_limit_count = goods.one_limit_count || 0; + goods_start_count = goods.goods_start_count || 1; + } + + // 起始sku数量 + let sku_val = 1; + + that.setData({ + addCar_goodsid: goods_id + }) + let list = options.list || []; + let arr = []; + if (list.length > 0) { + for (let i = 0; i < list.length; i++) { + let sku = list[i]['option_value'][0]; + let temp = { + name: sku['name'], + id: sku['option_value_id'], + index: i, + idx: 0 + }; + arr.push(temp); + } + //把单价剔除出来begin + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + console.log(id) + console.log('options', options) + var cur_sku_arr = {}; + if(options.sku_mu_list[id]) { + cur_sku_arr = options.sku_mu_list[id] || {}; + console.log('cur_sku_arr1', cur_sku_arr) + } else { + let idArr = id.split("_"); + idArr = idArr.reverse(); + id = idArr.join("_"); + cur_sku_arr = options.sku_mu_list[id] || {}; + console.log('cur_sku_arr2', cur_sku_arr) + } + cur_sku_arr.oneday_limit_count = oneday_limit_count || 0; + cur_sku_arr.total_limit_count = total_limit_count || 0; + cur_sku_arr.one_limit_count = one_limit_count || 0; + cur_sku_arr.goods_start_count = goods_start_count || 1; + + let car_quantity = cur_sku_arr.car_quantity || 0; + if(car_quantity && car_quantity>=goods_start_count && is_just_addcar==0) { + sku_val = car_quantity; + } else { + sku_val = goods_start_count || 1; + } + + if(this.data.buy_type=='integral') { + sku_val = 1; + } + + that.setData({ + sku: arr, + sku_val, + cur_sku_arr, + skuList: options, + visible: true, + showSku: true, + is_just_addcar + }); + } else { + if(t) { + let goodsInfo = e.allData; + that.setData({ + sku: [], + sku_val: 1, + skuList: [], + cur_sku_arr: goodsInfo, + is_just_addcar + }) + let formIds = { + detail: { + formId: "" + } + }; + formIds.detail.formId = "the formId is a mock one"; + that.gocarfrom(formIds); + } else { + let goods = this.data.goods; + let card_price = goods.card_price || "0.00"; + let levelprice = goods.levelprice || "0.00"; + let goods_start_count = goods.goods_start_count || 1; + let cart_quantity = goods.cart_quantity || 0; + let cur_sku_arr = { + canBuyNum: goods.total, + spuName: goods.goodsname, + actPrice: goods.actPrice, + marketPrice: goods.marketPrice, + stock: goods.total, + skuImage: goods.image_thumb, + card_price, + levelprice, + goods_start_count + } + + let buy_type = this.data.buy_type || ''; + let sku_val = 1; + if(buy_type!='integral') { + sku_val = goods_start_count; + if(cart_quantity>0&&cart_quantity>goods_start_count&&is_just_addcar==0) { + sku_val = cart_quantity; + cur_sku_arr.car_quantity = cart_quantity; + } else if(cart_quantity>0&&cart_quantity>=goods_start_count){ + sku_val = 1; + } + } + + that.setData({ + sku: [], + sku_val, + cur_sku_arr: cur_sku_arr, + skuList: [], + visible: true, + showSku: true + }) + } + } + }, + + /** + * 确认购物车 + */ + gocarfrom: function(e) { + var that = this; + wx.showLoading(); + var token = wx.getStorageSync('token'); + + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_member_form_id', + 'token': token, + "from_id": e.detail.formId + }, + dataType: 'json', + success: function(res) {} + }) + + that.goOrder(); + }, + + /** + * 关闭购物车 + */ + closeSku: function() { + this.setData({ + visible: 0, + stopClick: false, + }); + }, + + goOrder: function() { + var that = this; + if (that.data.can_car) { + that.data.can_car = false; + } + + let open_man_orderbuy = this.data.open_man_orderbuy; + if (open_man_orderbuy == 1 && this.data.is_just_addcar==0){ + let man_orderbuy_money = this.data.man_orderbuy_money*1; + let sku_val = this.data.sku_val; + let cur_sku_arr = this.data.cur_sku_arr; + let actPrice = cur_sku_arr.actPrice[0] + '.' + cur_sku_arr.actPrice[1]; + console.log(actPrice * 1 * sku_val); + if (actPrice * 1 * sku_val < man_orderbuy_money){ + wx.showToast({ + title: '满' + man_orderbuy_money + '元可下单!', + icon: 'none' + }) + return false; + } + } + + let localtown_moneytype_fixed_freemoney = this.data.localtown_moneytype_fixed_freemoney*1; + let is_only_distribution = this.data.is_only_distribution; + if (localtown_moneytype_fixed_freemoney >= 0 && is_only_distribution ==1 && this.data.is_just_addcar==0){ + let sku_val = this.data.sku_val; + let cur_sku_arr = this.data.cur_sku_arr; + let actPrice = cur_sku_arr.actPrice[0] + '.' + cur_sku_arr.actPrice[1]; + if (actPrice * 1 * sku_val < localtown_moneytype_fixed_freemoney){ + wx.showToast({ + title: '同城配送商品满' + localtown_moneytype_fixed_freemoney + '元可下单!', + icon: 'none' + }) + return false; + } + } + + var community = wx.getStorageSync('community'); + var goods_id = that.data.addCar_goodsid; + var community_id = community.communityId; + var quantity = that.data.sku_val; + var cur_sku_arr = that.data.cur_sku_arr; + var sku_str = ''; + var is_just_addcar = that.data.is_just_addcar; + if (cur_sku_arr && cur_sku_arr.option_item_ids) { + sku_str = cur_sku_arr.option_item_ids; + } + + console.log(cur_sku_arr); + //20200622 + if(cur_sku_arr.car_quantity&&cur_sku_arr.car_quantity>0&&is_just_addcar==1) { + quantity -= cur_sku_arr.car_quantity*1; + } + quantity = quantity<=0 ? 1 : quantity; + + let buy_type = this.data.buy_type ? this.data.buy_type : 'dan'; + let data = { + goods_id: goods_id, + community_id, + quantity, + sku_str, + buy_type, + pin_id: 0, + is_just_addcar + } + + util.addCart(data).then(res=>{ + if(res.showVipModal==1) { + let { pop_vipmember_buyimage } = res.data; + wx.hideLoading(); + that.setData({ pop_vipmember_buyimage, showVipModal: true, visible: false }) + } else if (res.data.code == 3 || res.data.code == 7) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } else { + if (buy_type =='integral'){ + // 积分 + if (res.data.code == 6) { + var msg = res.data.msg; + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + //跳转结算页面 + wx.navigateTo({ + url: `/eaterplanet_ecommerce/pages/order/placeOrder?type=integral`, + }) + } + }else { + if (res.data.code == 4) { + wx.hideLoading(); + that.setData({ needAuth: true, showAuthModal: true, visible: false }) + } else if (res.data.code == 6) { + var msg = res.data.msg; + let max_quantity = res.data.max_quantity || ''; + (max_quantity > 0) && that.setData({ sku_val: max_quantity }) + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + if (is_just_addcar == 1) { + that.closeSku(); + wx.showToast({ + title: "已加入购物车", + image: "../../images/addShopCart.png" + }) + app.globalData.cartNum = res.data.total; + // 20200622 + let goods = that.data.goods; + let h = { goods }; + if(goods.id == goods_id) { h.goods.cart_quantity = res.data.cur_count } + that.setData({ + cartNum: res.data.total, + ...h + }); + status.indexListCarCount(goods_id, res.data.cur_count); + } else { + var is_limit = res.data.is_limit_distance_buy; + + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type='+buy_type+'&is_limit=' + is_limit + }) + } else { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type='+buy_type+'&is_limit=' + is_limit + }) + } + } + + } + } + } + }).catch(res=>{ + app.util.message(res||'请求失败', '', 'error'); + }) + }, + + vipModal: function(t) { + this.setData(t.detail) + }, + + selectSku: function(event) { + var that = this; + let str = event.currentTarget.dataset.type; + let obj = str.split("_"); + let { sku, skuList, sku_val, cur_sku_arr } = this.data; + + let temp = { + name: obj[3], + id: obj[2], + index: obj[0], + idx: obj[1] + }; + sku.splice(obj[0], 1, temp); + var id = ''; + for (let i = 0; i < sku.length; i++) { + if (i == sku.length - 1) { + id = id + sku[i]['id']; + } else { + id = id + sku[i]['id'] + "_"; + } + } + + let new_sku_arr = skuList.sku_mu_list[id]; + cur_sku_arr = {...cur_sku_arr, ...new_sku_arr}; + + let h = {}; + h.noEougnStock = false; + sku_val = sku_val || 1; + let { canBuyNum, car_quantity, goods_start_count } = cur_sku_arr; + if(sku_val > canBuyNum*1) { + h.sku_val = canBuyNum==0?1:canBuyNum; + (canBuyNum>0) && wx.showToast({ + title: `最多只能购买${cur_sku_arr.canBuyNum}件`, + icon: 'none' + }) + } + + // 20200622 + console.log(car_quantity) + if(car_quantity && car_quantity>=goods_start_count) { + sku_val = car_quantity; + } else { + sku_val = goods_start_count || 1; + } + + // 库存小于起购数量 按钮变灰 数量变起购 + if(canBuyNum*1{ + this.openSku(); + }).catch(()=>{ + this.openSku(); + }); + } else { + //加入购物车 + this.openSku(); + } + } + }, + + /** + * 数量加减 + */ + setNum: function(event) { + let types = event.currentTarget.dataset.type; + var that = this; + var num = 1; + let sku_val = this.data.sku_val * 1; + let showLimitTip = false; + let showLimitType = 0; + if (types == 'add') { + num = sku_val + 1; + let {one_limit_count, total_limit_count, oneday_limit_count} = this.data.cur_sku_arr; + if(one_limit_count>0 && num > one_limit_count) { + wx.showToast({ + title: `您本次只能购买${one_limit_count}份`, + icon: 'none' + }) + num = one_limit_count; + showLimitTip = true; + showLimitType = 1; + } else if(oneday_limit_count>0 && num > oneday_limit_count) { + wx.showToast({ + title: `您今天只能购买${oneday_limit_count}份`, + icon: 'none' + }) + num = oneday_limit_count; + showLimitTip = true; + showLimitType = 2; + } else if(total_limit_count>0 && num > total_limit_count) { + wx.showToast({ + title: `您最多只能购买${total_limit_count}份`, + icon: 'none' + }) + num = total_limit_count; + showLimitTip = true; + showLimitType = 3; + } + } else if (types == 'decrease') { + let goods_start_count = this.data.cur_sku_arr.goods_start_count; + if (sku_val > 1) { + num = sku_val - 1; + if(num 0) { + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + } + if (options.length > 0) { + var cur_sku_arr = options.sku_mu_list[id]; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + } else { + let cur_sku_arr = this.data.cur_sku_arr; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + } + this.setData({ + sku_val: num, + showLimitTip, + showLimitType + }) + }, + + scrollImagesChange: function(t) { + this.videoContext && this.videoContext.pause(); + this.setData({ + fmShow: true, + goodsIndex: t.detail.current + 1 + }); + }, + + share_handler: function() { + this.setData({ + is_share_html: false + }) + }, + + hide_share_handler: function() { + this.setData({ + is_share_html: true + }) + }, + + share_quan: function() { + if (!this.authModal()) return; + wx.showLoading({ + title: '获取中', + }) + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + + var goods_id = this.data.order.goods_id; + var community_id = community.communityId; + + var that = this; + + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'goods.get_user_goods_qrcode', + token: token, + community_id: community_id, + goods_id: goods_id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + setTimeout(function() { + wx.hideLoading() + }, 2000) + var image_path = res.data.image_path; + wx.getImageInfo({ + src: image_path, + success: function(res) { + var real_path = res.path; + wx.saveImageToPhotosAlbum({ + filePath: real_path, + success(res) { + wx.showToast({ + title: '图片保存成功,可以分享了', + icon: 'none', + duration: 2000 + }) + that.setData({ + is_share_html: true + }); + } + }) + } + }) + } else { + that.setData({ + needAuth: true + }) + } + } + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + let that = this; + util.check_login_new().then((res) => { + console.log('onShow', res) + if(!res) { + that.setData({ + needAuth: true + }) + } else { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } + }) + this.setData({ + stopNotify: false + }); + }, + + onReady: function (res) { + this.videoContext = wx.createVideoContext('myVideo'); + this.coverVideoContext = wx.createVideoContext('coverVideo'); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + this.setData({ stopNotify: true }) + console.log('详情页hide', this.data.stopNotify) + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + console.log('onUnload') + this.setData({ stopNotify: true }) + console.log('详情页unload', this.data.stopNotify); + detailClearTime = null; + clearTimeout(detailClearTime); + }, + + /** + * 获取分享图并显示 + * 20181225 新形式 + */ + get_share_img: function () { + if (!this.authModal()) return; + wx.showLoading(); + let shareImgUrl = this.data.shareImgUrl; + if (shareImgUrl != '') { + wx.hideLoading(); + this.setData({ + hideModal: false, + is_share_html: true + }) + } else { + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + var goods_id = this.data.goods_id; + var community_id = community.communityId; + + var that = this; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'goods.get_user_goods_qrcode', + token: token, + community_id: community_id, + goods_id: goods_id + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + wx.hideLoading(); + var image_path = res.data.image_path; + wx.previewImage({ + current: image_path, // 当前显示图片的http链接 + urls: [image_path] // 需要预览的图片http链接列表 + }) + } else { + that.setData({ + needAuth: true + }) + } + } + }) + } + }, + + closeShareModal: function () { + this.setData({ hideModal: true }) + }, + + /** + * 展开收起 + */ + bindOpen: function (t) { + var idx = t.currentTarget.dataset.idx; + console.log(idx) + if (this.data.comment_list[idx].isOpen) { + this.data.comment_list[idx].isOpen = false; + var comment_list = this.data.comment_list; + this.setData({ + comment_list: comment_list + }); + } else { + this.data.comment_list[idx].isOpen = true; + var comment_list = this.data.comment_list; + this.setData({ + comment_list: comment_list + }); + } + }, + + /** + * 保存分享图并显示 + * 20181225 新形式 + */ + saveThumb: function (e) { + wx.showLoading(); + let that = this; + var image_path = this.data.shareImgUrl; + wx.getImageInfo({ + src: image_path, + success: function (res) { + var real_path = res.path; + real_path && wx.saveImageToPhotosAlbum({ + filePath: real_path, + success(res) { + console.log(res) + wx.hideLoading(); + wx.showToast({ + title: '已保存相册', + icon: 'none', + duration: 2000 + }) + that.setData({ + hideModal: true + }); + }, + fail: function (res) { + wx.hideLoading(); + console.log(res) + if (res.errMsg === "saveImageToPhotosAlbum:fail:auth denied") { + wx.openSetting({ + success(settingdata) { + if (settingdata.authSetting["scope.writePhotosAlbum"]) { + console.log("获取权限成功,再次点击图片保存到相册") + } else { + console.log("获取权限失败") + } + } + }) + } + } + }) + } + }) + }, + + drawImgNoPrice: function () { + var t = this; + wx.createSelectorQuery().select(".canvas-img").boundingClientRect(function () { + const context = wx.createCanvasContext("myCanvas"); + context.drawImage(t.goodsImg, 0, 0, status.getPx(375), status.getPx(300)); + if (t.data.goods.video) context.drawImage("../../images/play.png", status.getPx(127.5), status.getPx(90), status.getPx(120), status.getPx(120)); + context.save(); + context.restore(), context.draw(false, t.checkCanvasNoPrice()); + }).exec(); + }, + + checkCanvasNoPrice: function () { + var that = this; + setTimeout(() => { + wx.canvasToTempFilePath({ + canvasId: "myCanvas", + success: function (res) { + res.tempFilePath ? that.imageUrl = res.tempFilePath : that.drawImgNoPrice(); + console.log('我画完了') + }, + fail: function (a) { + that.drawImgNoPrice(); + } + }) + }, 500) + }, + + drawImg: function () { + let endtime = this.data.endtime; + let shareTime = (endtime.days > 0 ? endtime.days + '天' : '') + endtime.hours + ':' + endtime.minutes + ':' + endtime.seconds; + console.log('endtime', shareTime); + var t = this; + wx.createSelectorQuery().select(".canvas-img").boundingClientRect(function () { + const context = wx.createCanvasContext("myCanvas"); + context.font = "28px Arial"; + if(t.data.buy_type=='integral') { + var e = context.measureText(" ").width; + var o = context.measureText(t.data.goods.price + "积分").width; + } else { + var e = context.measureText("¥").width + 2; + var o = context.measureText(t.data.goods.price_front + "." + t.data.goods.price_after).width; + } + context.font = "17px Arial"; + var s = context.measureText("¥" + t.data.goods.productprice).width + 3, + n = context.measureText("累计销售 " + t.data.goods.seller_count).width, + u = context.measureText("· 剩余" + t.data.goods.total + " ").width + 10; + context.font = "18px Arial"; + let over_type_text = t.data.goods.over_type == 0 ? '距开始' : '距结束'; + var r = context.measureText(over_type_text).width; + var d = context.measureText(shareTime).width + 10; + context.drawImage(t.goodsImg, 0, 0, status.getPx(375), status.getPx(300)); + context.drawImage("../../images/shareBottomBg.png", status.getPx(0), status.getPx(225), status.getPx(375), status.getPx(75)); + if (t.data.goods.video) context.drawImage("../../images/play.png", status.getPx(127.5), status.getPx(70), status.getPx(120), status.getPx(120)); + context.save(); + + if(t.data.buy_type=='integral') { + status.drawText(context, { color: "#ffffff", size: 28, textAlign: "left" }, t.data.goods.price + "积分", + status.getPx(e), status.getPx(267), status.getPx(o)); + } else { + status.drawText(context, { color: "#ffffff", size: 28, textAlign: "left" }, "¥", status.getPx(6), status.getPx(267), status.getPx(e)); + status.drawText(context, { color: "#ffffff", size: 28, textAlign: "left" }, t.data.goods.price_front + "." + t.data.goods.price_after, + status.getPx(e), status.getPx(267), status.getPx(o)); + } + context.restore(); + context.save(); + context.restore(), + context.save(), + (0, status.drawText)(context, + { color: "#ffffff", size: 15, textAlign: "left" }, + "¥" + t.data.goods.productprice, + (0, status.getPx)(e + o + 10), + (0, status.getPx)(267), + (0, status.getPx)(s) + ), + context.restore(); + if(t.data.is_hide_details_count==0) { + context.save(), + (0, status.drawText)( + context, + { color: "#ffffff", size: 17, textAlign: "left" }, + "累计销售" + t.data.goods.seller_count, + (0, status.getPx)(10), + (0, status.getPx)(290), + (0, status.getPx)(n) + ), + context.restore(), + context.save(), + (0, status.drawText)(context, + { color: "#ffffff", size: 17, textAlign: "left" }, + "· 剩余" + t.data.goods.total, + (0, status.getPx)(n + 10), + (0, status.getPx)(290), + (0, status.getPx)(u) + ), + context.restore(); + } + context.save(), + context.beginPath(), + context.setStrokeStyle("white"), + context.moveTo((0, status.getPx)(e + o + 10), + (0, status.getPx)(261)), + context.lineTo((0, status.getPx)(e + o + s + 15), + (0, status.getPx)(261)), + context.stroke(), + context.restore(), + context.save(), + (0, status.drawText)(context, + { color: "#F8E71C", size: 18, textAlign: "center" }, + over_type_text, + (0, status.getPx)(318), + (0, status.getPx)(260), + (0, status.getPx)(r) + ), + context.restore(), + context.save(), + (0, status.drawText)(context, { color: "#F8E71C", size: 18, textAlign: "center" }, + shareTime, + (0, status.getPx)(315), + (0, status.getPx)(288), + (0, status.getPx)(d) + ), + context.restore(); + context.draw(false, t.checkCanvas()); + }).exec(); + }, + + checkCanvas: function () { + var that = this; + setTimeout(() => { + wx.canvasToTempFilePath({ + canvasId: "myCanvas", + success: function (res) { + res.tempFilePath ? that.imageUrl = res.tempFilePath : that.drawImg(); + console.log('我画完了') + }, + fail: function (a) { + that.drawImg(); + } + }) + }, 500) + }, + + drawImg1: function () { + let endtime = this.data.endtime; + let shareTime = (endtime.days > 0 ? endtime.days + '天' : '') + endtime.hours + ':' + endtime.minutes + ':' + endtime.seconds; + var t = this; + + let option = []; + let price = 0; + if(t.data.buy_type=='integral') { + price = t.data.goods.price + "积分"; + var e = context.measureText(" ").width; + var o = context.measureText(t.data.goods.price + "积分").width; + } else { + price = "¥" + t.data.goods.price_front + "." + t.data.goods.price_after; + } + // if (t.data.buy_type=='integral') { + // option.push() + // } + + this.setData({ + template: { + "width": "375px", + "height": "300px", + "background": "#fff", + "views": [ + { + "type": "image", + "url": t.goodsImg, + "css": + { + "width": "375px", + "height": "300px", + "top": "0px", + "left": "0px", + "rotate": "0", + "borderRadius": "0px", + "borderWidth": "", + "borderColor": "#000000", + "shadow": "", + "mode": "aspectFill" + } + }, + { + "type": "image", + "url": "../../images/shareBottomBg.png", + "css": + { + "width": "375px", + "height": "53px", + "bottom": "0", + "left": "0px", + "rotate": "0", + "borderRadius": "", + "borderWidth": "", + "borderColor": "#000000", + "shadow": "", + "mode": "scaleToFill" + } + }, + { + "type": "text", + "text": price, + "css": + { + "color": "#ffffff", + "background": "", + "width": "375px", + "height": "28px", + "bottom": "30px", + "left": "10px", + "rotate": "0", + "borderRadius": "", + "borderWidth": "", + "borderColor": "#000000", + "shadow": "", + "padding": "0px", + "fontSize": "28px", + "fontWeight": "normal", + "maxLines": "1", + "lineHeight": "28px", + "textStyle": "fill", + "textDecoration": "none", + "fontFamily": "Arial", + "textAlign": "left" + } + }, + ...option + ] + } + }); + }, + + onImgOK(e) { + this.imagePath = e.detail.path; + this.imageUrl = this.imagePath; + }, + + previewImg: function(e){ + if(this.show_goods_preview==1) return; + let idx = e.currentTarget.dataset.idx || 0; + let prevImgArr = this.data.prevImgArr; + wx.previewImage({ + current: prevImgArr[idx], + urls: prevImgArr + }) + }, + + /** + * 播放视频隐藏封面图 + */ + btnPlay: function () { + this.setData({ + fmShow: false + }) + this.videoContext.play(); + }, + + videEnd: function(){ + this.videoContext.exitFullScreen(); + this.setData({ + fmShow: true + }) + }, + + endPlay: function(){ + this.videoContext.pause(); + this.setData({ + fmShow: true + }) + }, + + // 显示群主二维码 + showGroupCode: function(){ + let group_share_info = this.data.group_share_info; + let imgUrl = group_share_info.share_wxcode || ''; + if(imgUrl) { + wx.previewImage({ + current: imgUrl, // 当前显示图片的http链接 + urls: [imgUrl] // 需要预览的图片http链接列表 + }) + } else { + wx.showModal({ + title: "提示", + content: "未设置联系方式,请联系管理员", + showCancel: false + }) + } + }, + + changeCommunity: function() { + if (this.data.hide_community_change_btn==0) { + var id = this.$data.id; + var scene = this.$data.scene; + var community_id = this.$data.community_id; + let url = '/eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + id + '&community_id=' + community_id + '&scene=' + scene; + app.globalData.navBackUrl = url; + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/position/community', + }) + } + }, + + changeCartNum: function (t) { + let that = this; + let e = t.detail; + (0, status.cartNum)(that.setData({ cartNum: e })); + }, + + goLink: function (event) { + if (!this.authModal()) return; + let link = event.currentTarget.dataset.link; + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: link + }) + } else { + wx.navigateTo({ + url: link + }) + } + }, + + // 输入框获得焦点 + handleFocus: function () { + this.focusFlag = true; + }, + + handleBlur: function (t) { + let a = t.detail; + let val = parseInt(a.value); + if (val == '' || isNaN(val)) { + let goods_start_count = this.data.cur_sku_arr.goods_start_count; + wx.showToast({ + title: `${goods_start_count}件起售`, + icon: 'none' + }) + this.setData({ sku_val: goods_start_count }) + } + }, + + // 监控输入框变化 + changeNumber: function (t) { + let { cur_sku_arr, sku_val } = this.data; + let max = cur_sku_arr.stock * 1; + let a = t.detail; + this.focusFlag = false; + if (a) { + let val = parseInt(a.value); + val = val < 1 ? 1 : val; + if (val > max) { + wx.showToast({ + title: `最多只能购买${max}件`, + icon: 'none' + }) + sku_val = max; + } else { + sku_val = val; + } + } + this.setData({ sku_val }) + }, + + handleHexiaoModal: function() { + this.setData({ + showHexiaoModal: !this.data.showHexiaoModal + }) + }, + + coverVideoEnd: function(){ + this.setData({ + showCoverVideo: false + }) + }, + + closeCoverVideo: function(){ + this.coverVideoContext.pause(); + this.setData({ + showCoverVideo: false + }) + }, + + handleLoadedMetaData(e) { + const { width, height } = e.detail; + let platform = app.globalData.systemInfo.platform || ''; + console.log(platform) + if (platform === 'android') { + let ww = this.data.imageSize.imageHeight; + this.setData({ + videoStyle: `width: calc(${ww * width / height})px`, + }); + } + }, + + bindimgtap: function(e, ignore) { + (this.show_goods_preview==1)&&e.detail.ignore(); + }, + + /** + * 订阅消息 + */ + subscriptionNotice: function() { + let that = this; + return new Promise((resolve, reject)=>{ + let obj = that.data.need_subscript_template; + let tmplIds = Object.keys(obj).map(key => obj[key]); // 订阅消息模版id + if (wx.requestSubscribeMessage) { + tmplIds.length && wx.requestSubscribeMessage({ + tmplIds: tmplIds, + success(res) { + let is_need_subscript = 1; + let acceptId = []; + tmplIds.forEach(item=>{ + if (res[item] == 'accept') { + //用户同意了订阅,添加进数据库 + acceptId.push(item); + } else { + //用户拒绝了订阅或当前游戏被禁用订阅消息 + is_need_subscript = 0; + } + }) + + if(acceptId.length) { + that.addAccept(acceptId); + } + that.setData({ is_need_subscript }) + resolve(); + }, + fail(err) { + console.log(err) + reject(); + } + }) + } else { + // 兼容处理 + reject(); + } + }) + }, + + // 用户点击订阅添加到数据库 + addAccept: function (acceptId) { + let token = wx.getStorageSync('token'); + let type = acceptId.join(','); + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'user.collect_subscriptmsg', + token, + type + }, + dataType: 'json', + method: 'POST', + success: function () {} + }) + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + var community = wx.getStorageSync('community'); + let { goods_id, buy_type } = this.data; + var community_id = community.communityId; + var share_title = this.data.share_title; + var share_id = wx.getStorageSync('member_id'); + var share_path = 'eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + goods_id + '&share_id=' + share_id + '&community_id=' + community_id + '&type=' + buy_type; + let shareImg = this.data.goods.goods_share_image || ''; + console.log('商品分享地址:'); + console.log(share_path); + + var that = this; + that.setData({is_share_html: true, hideModal: true, hideCommissInfo: true}) + setTimeout(()=>{ + this.setData({ + hideCommissInfo: false + }) + }, 1000) + return { + title: share_title, + path: share_path, + imageUrl: shareImg ? shareImg : that.imageUrl, + success: function(res) { + // 转发成功 + }, + fail: function(res) { + // 转发失败 + } + } + }, + + onShareTimeline: function(res) { + let shareImg = this.data.goods.goods_share_image || ''; + var share_id = wx.getStorageSync('member_id'); + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + let { goods_id, buy_type } = this.data; + var query= `id=${goods_id}&share_id=${share_id}&community_id=${community_id}&buy_type=${buy_type}`; + return { + title: this.data.share_title, + query, + imageUrl: shareImg ? shareImg : this.imageUrl, + success: function() {}, + fail: function() {} + }; + } +}) diff --git a/eaterplanet_ecommerce/pages/goods/goodsDetail.json b/eaterplanet_ecommerce/pages/goods/goodsDetail.json new file mode 100644 index 0000000..5d687f5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/goodsDetail.json @@ -0,0 +1,18 @@ +{ + "navigationBarTitleText": "商品详情", + "navigationBarBackgroundColor": "#007FAF", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "i-order-notify": "../../components/order-notify/index", + "i-relative-goods-list": "./relativeGoodsList", + "i-change-community": "../../components/changeCommunity/index", + "guess-like": "../../components/guess-like/index", + "i-vip-price": "../../components/vipPrice/vipPrice", + "parser":"../../components/parser/parser", + "i-img": "../../components/img/index", + "i-modal": "../../components/modal/index", + "advimg": "../../components/advimg/index", + "i-painter": "../../components/painter/painter" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/goodsDetail.wxml b/eaterplanet_ecommerce/pages/goods/goodsDetail.wxml new file mode 100644 index 0000000..9200a29 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/goodsDetail.wxml @@ -0,0 +1,587 @@ + + + + + + + + + + {{goods.label_info.tagcontent}} + + + {{goodsIndex}}/{{goods_image_length}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 定金:¥{{presale_goods_info.presale_ding_money}} 可抵扣:¥{{presale_goods_info.presale_deduction_money}} + 预售价:¥{{goods.price}} + + + 预售价:¥{{goods.price}} + 原价:¥{{goods.productprice}} + + + 预售{{presale_goods_info.presale_type==0?'定金':''}}截止 + 距开始预售 + 结束时间 + {{presale_goods_info.presale_ding_time_end_date}} + + {{endtime.days}}天 + {{endtime.hours}}: + {{endtime.minutes}}: + {{endtime.seconds}} + + + + + + + + {{goods.price_front}}积分 + ¥{{goods.productprice}} + + + ¥{{goods.price_front}}.{{goods.price_after}} + ¥{{goods.productprice}} + + + + 距结束 + 距开始 + 结束时间 + {{goods.end_date}} + + {{endtime.days}}天 + {{endtime.hours}}: + {{endtime.minutes}}: + {{endtime.seconds}} + + + + + + + [秒杀] + [预售] + {{goods.goodsname}} + + {{goods.subtitle}} + + 可兑换 {{virtualcard_goods_info.code_money}} 元 + + + + + 自提商品 + + 支持多点自提 + + + + + + {{groupInfo.commiss_diy_name}}预估佣金:¥{{commiss_mb_money}} + + + {{groupInfo.owner_name}}预估佣金:¥{{goods_head_money}} + + + + + + + + 现在下单,预计({{goods.pick_up_modify}})可自提 + + + + {{goods.diy_arrive_details}} + + + + + + 满减 + 满{{goods.full_money}}元减{{goods.full_reducemoney}}元 + + + 赠送 + 下单预估赠送{{goods.send_socre}}积分 + + + + 限购 + 每人限购{{goods.total_limit_count}}份 + 每单限购{{goods.one_limit_count}}份 + + + 已预订 {{goods.seller_count}} {{goods_sale_unit}} + + + 销量 + 已售 + {{goods.seller_count}} {{goods_sale_unit}},仅剩 + {{goods.total}} {{goods_sale_unit}} + + + + + + + + “{{modify_vipcard_name}}” + 会员立省{{goods.feePrice}}元 + + + + + + + + 开通“{{modify_vipcard_name}}”立省{{goods.feePrice}}元 + “{{modify_vipcard_name}}” 尊享特权·会员专享价 + + 立即开通 + + + + 已到期,立即续费 + + + + + + + + + + + + 尾款 + + + ¥{{presaleBalance}} + + ({{presale_goods_info.presale_ding_time_start_date}}-{{presale_goods_info.presale_ding_time_end_date}}) + + + + 流程 + + + 1.付定金 - 2.付尾款 - 3.商家发货 + + + {{presale_goods_info.presale_sendorder_datetime}}开始发货 + 付款成功后{{presale_goods_info.presale_sendorder_afterday}}日内发货 + + + + + + + + + + + + {{community.communityName}} + 取货地址:{{community.fullAddress}} + + + + + + + + + + + + + {{group_share_info.share_title}} + {{group_share_info.share_desc}} + + + 马上加群 + + + + + + + + + 商品评价 + ({{order_comment_count}}) + + + + + {{item.user_name}} + + {{item.content}} + + {{item.isOpen?'展开':'收起'}} + + + + + + + + 查看全部评论 + + + + + + + + + 购买记录 + + 已有 + {{buy_record_arr.count}} 人购买,商品共销售 + {{goods.seller_count}} 份 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 工商资质 + + + + + + + + + + + + + + + + + + 回首页 + + + + + + + {{cartNum}} + + 购物车 + + + + + + 即将开抢 + 已抢光 + 已结束 + 已下架 + 团长休息中 + +
+ +
+ +
+ + + + + + + + + +
+ 加入购物车 + +
+
+ +
+ +
+
+
+ + + + + + +
+ + + + 分享 + + + + 客服 + + + + + + + + + + + + + + + + + + + {{hx_len}} 个自提点 + + + + + {{item.room_name}} + {{item.room_address}} + + + + + + + + + + + + + + + + + {{goods.goodsname}} + + ¥{{goods.price_front}}.{{goods.price_after}} + + + + + + +
\ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/goodsDetail.wxss b/eaterplanet_ecommerce/pages/goods/goodsDetail.wxss new file mode 100644 index 0000000..efc425b --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/goodsDetail.wxss @@ -0,0 +1,1538 @@ +@import "/eaterplanet_ecommerce/resource/css/vip.wxss"; + +page { + background-color: linear-gradient(90deg, #e7614d 0%, #e68475 100%); +} + +.goods-wrapper { + position: relative; +} + +swiper { + height: 600rpx; +} + +swiper image { + width: 100%; + height: auto; +} +movable-view { +background-color: #fff; +width: 110rpx; +height: 110rpx; +top: 0; +left: 0; +position: absolute; + +} + +movable-area { + height: 100%; + width: 100%; + margin: 0rpx; + + +} + +.fixed-aside { + float:right; + position: fixed; + right: 20rpx; + top:110rpx; + background-color: #fff; + z-index: 100; + width: 80rpx; +} + +.fixed-service { + display: inline-block; + width: 80rpx; + height: 80rpx; + background: #e7614d93; + backdrop-filter: blur(40rpx); + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + box-sizing: border-box; + font-size: 20rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 100; + margin-bottom: 10rpx; +} + +.fixed-service::after { + border: 0; +} + +.fixed-service .iconfont { + font-size: 30rpx; +} + +.fixed-share { + display: inline-block; + transform: translateY(950rpx); + width: 80rpx; + height: 80rpx; + background: #e7614d93; + backdrop-filter: blur(40rpx); + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + box-sizing: border-box; + font-size: 20rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 100; + margin-bottom: 10rpx; +} + +.fixed-share::after { + border: 0; +} + +.fixed-share .iconfont { + font-size: 30rpx; +} + +.sticky-title { + width: 100%; + display: none; + justify-content: space-between; + background: #fff; + height: 160rpx; + position: relative; + z-index: 3; +} + +.sticky-title.sticky { + position: fixed; + display: flex; + top: 0; + left: 0; + height: 80rpx; + line-height: 80rpx; + width: 100vw; + border-bottom: 2rpx solid rgba(0, 0, 0, 0.1); + animation: opacity 0.2s ease-in-out; +} + +.sticky-title.sticky .nav { + padding-left: 30rpx; +} + +.sticky-title.sticky .nav .tab-btn { + width: 56rpx; + height: 80rpx; + line-height: 80rpx; + margin-right: 36rpx; + color: #666; + font-size: 28rpx; + font-weight: bold; + position: relative; + display: inline-block; +} + +.sticky-title.sticky .nav .tab-btn-active { + color: #4facfe; + line-height: 80rpx; +} + +.sticky-title.sticky .nav .tab-btn-active:after { + content: ''; + width: 56rpx; + height: 6rpx; + border-radius: 6rpx; + background: linear-gradient(to right,#4facfe,#00f2fe); + position: absolute; + bottom: 0; + left: 0; + box-shadow: 0 4rpx 8rpx rgba(255,89,9,0.25); +} + +.sticky-title.sticky .time { + width: 290rpx; + height: 80rpx; + font-size: 26rpx; + color: #444; + display: flex; + align-items: center; + padding-right: 30rpx; + justify-content: flex-end; +} + +.sticky-title.sticky .time text { + white-space: nowrap; +} + +.sticky-title.sticky .time .countdownTop { + font-size: 28rpx; + white-space: nowrap; + display: flex; + justify-content: center; + align-items: center; +} + +.sticky-title.sticky .time .countdownTop .itemTimeTop { + width: 38rpx; + height: 32rpx; + background: #444; + border-radius: 4rpx; + font-size: 26rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +.spuInfoImg { + width: 100%; + height: 600rpx; + background-size: 100% 100%; + position: relative; +} + +.spuInfoImg .share { + width: 160rpx; + height: 68rpx; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + border-radius: 48rpx 0 0 48rpx; + position: absolute; + top: 60rpx; + right: 0; + display: flex; + justify-content: center; + align-items: center; +} + +.spuInfoImg .share .shareImg { + width: 32rpx; + height: 28rpx; + margin-right: 14rpx; +} + +.spuInfoImg .share text { + width: 60rpx; + height: 68rpx; + line-height: 68rpx; + font-size: 26rpx; + color: #fff; +} + +.spuInfoImg .current { + width: 90rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + border-radius: 24rpx; + background-color: rgba(0, 0, 0, 0.5); + font-size: 26rpx; + color: #fff; + position: absolute; + left: 50%; + bottom: 50rpx; + margin-left: -44rpx; + z-index: 1; +} + +.spuInfoImg .slide-image { + width: 750rpx; + height: 600rpx; +} + +.spuInfo { + width: 100%; + z-index: 2; + position: relative; + margin-top: -20px; +} + +.spuInfo .spuPrice { + font-family: DIN; + position: relative; + width: 680rpx; + height: 100rpx; + padding-left: 30rpx; + margin: 0 auto; + display: flex; + align-items: center; + justify-content: space-between; +} + +.spuInfo .spuPrice .spuPriceBg { + position: absolute; + top: 0; + left: 0; + width: 710rpx; + height: 100rpx; + z-index: -1; +} + +.spuInfo .spuPrice .price { + font-size: 28rpx; + color: #fff; + margin-top: 10rpx; +} + +.spuInfo .spuPrice .price .salePrice { + font-size: 68rpx; + font-weight: bold; +} + +.spuInfo .spuPrice .price .storePrice { + text-decoration: line-through; + margin-left: 10rpx; +} + +.spuInfo .spuPrice .time { + width: 220rpx; + height: 100rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + font-size: 26rpx; + color: #fff; + white-space: nowrap; +} + +.spuInfo .spuPrice .time text { + line-height: 28rpx; + margin-top: 10rpx; +} + +.spuInfo .spuPrice .time .endAct { + color: #fff; +} + +.spuInfo .spuPrice .time .countdown { + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.spuInfo .spuPrice .time .countdown em { + margin: 0; +} + +.spuInfo .spuPrice .time .countdown .itemTime { + width: 32rpx; + text-align: center; +} + +.spuInfo .bgOne { + background: url("http://wxapp.ch871.com/attachment/images/3/2019/01/s8DBXZhrLr998t89Tg8BblqnXbNB8r.png"); + background-size: 100% 100%; +} + +.spuInfo .bgTwo { + background: url("https://image.songshupinpin.com/goods_1540374630865.png"); + background-size: 100% 100%; +} + +.spuInfo .spuDetailInfo, .spuInfo .straightInLive, .spuInfo .buyRecords { + width: 670rpx; + background: #fff; + box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.05); + border-radius: 0 0 20rpx 20rpx; + padding: 30rpx 20rpx; + margin: 0 auto; +} + +.spuInfo .spuDetailInfo .spuName, .spuInfo .straightInLive .spuName, +.spuInfo .buyRecords .spuName { + font-size: 36rpx; + color: #444; + font-weight: bold; + min-height: 48rpx; + line-height: 44rpx; + padding: 0 10rpx; + white-space: initial; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.spuInfo .spuDetailInfo .remind, .spuInfo .straightInLive .remind, +.spuInfo .buyRecords .remind { + margin-top: 20rpx; + display: flex; + align-items: center; + padding: 0 10rpx; +} + +.spuInfo .spuDetailInfo .remind .remindImg, +.spuInfo .straightInLive .remind .remindImg, +.spuInfo .buyRecords .remind .remindImg { + width: 28rpx; + height: 28rpx; + margin-right: 20rpx; +} + +.spuInfo .spuDetailInfo .remind text, .spuInfo .straightInLive .remind text, +.spuInfo .buyRecords .remind text { + font-size: 26rpx; + color: #aaa; +} + +.spuInfo .spuDetailInfo .preferential, .spuInfo .straightInLive .preferential, +.spuInfo .buyRecords .preferential { + padding: 24rpx 20rpx; + background: linear-gradient(223deg, #fff7f0 0%, #fff4ec 100%); + border-radius: 16rpx; + margin-top: 40rpx; + margin-bottom: 10rpx; + font-size: 24rpx; + color: #ca7e57; + font-weight: bold; + line-height: 40rpx; +} + +.spuInfo .spuDetailInfo .preferential .tit, +.spuInfo .straightInLive .preferential .tit, +.spuInfo .buyRecords .preferential .tit { + font-size: 20rpx; + color: #4facfe; + border: 2rpx solid #00f2fe; + border-radius: 16rpx; + padding: 0 8rpx; + margin-right: 10rpx; +} + +.spuInfo .spuDetailInfo .preferential .con, +.spuInfo .straightInLive .preferential .con, +.spuInfo .buyRecords .preferential .con { + margin-right: 20rpx; +} + +.spuInfo .spuDetailInfo .purchasing, .spuInfo .spuDetailInfo .saleNum, +.spuInfo .straightInLive .purchasing, .spuInfo .straightInLive .saleNum, +.spuInfo .buyRecords .purchasing, .spuInfo .buyRecords .saleNum { + font-size: 26rpx; + color: #666; + padding: 30rpx 0; + margin: 0 10rpx; + border-bottom: 0.1rpx solid #efefef; +} + +.spuInfo .spuDetailInfo .purchasing .purTit, +.spuInfo .spuDetailInfo .saleNum .purTit, +.spuInfo .straightInLive .purchasing .purTit, +.spuInfo .straightInLive .saleNum .purTit, +.spuInfo .buyRecords .purchasing .purTit, .spuInfo .buyRecords .saleNum .purTit { + color: #444; + font-weight: bold; + margin-right: 20rpx; +} + +.spuInfo .spuDetailInfo .purchasing .remaining, +.spuInfo .spuDetailInfo .saleNum .remaining, +.spuInfo .straightInLive .purchasing .remaining, +.spuInfo .straightInLive .saleNum .remaining, +.spuInfo .buyRecords .purchasing .remaining, +.spuInfo .buyRecords .saleNum .remaining { + font-weight: bold; + margin: 0; + color: #ff758c; +} + +.spuInfo .spuDetailInfo .purchasing .stock, +.spuInfo .spuDetailInfo .saleNum .stock, +.spuInfo .straightInLive .purchasing .stock, +.spuInfo .straightInLive .saleNum .stock, +.spuInfo .buyRecords .purchasing .stock, .spuInfo .buyRecords .saleNum .stock { + display: inline-block; + font-weight: normal; + margin: 0; +} + +.spuInfo .spuDetailInfo .saleNum, .spuInfo .straightInLive .saleNum, +.spuInfo .buyRecords .saleNum { + border: none; +} + +.spuInfo .straightInLive, .spuInfo .buyRecords { + width: 650rpx; + padding: 0 30rpx; + border-radius: 20rpx; + margin: 20rpx auto 0; +} + +.spuInfo .straightInLive .title, .spuInfo .buyRecords .title { + height: 100rpx; + font-size: 32rpx; + color: #444; + font-weight: bold; + border-bottom: 0.1rpx solid #efefef; + display: flex; + align-items: center; +} + +.spuInfo .straightInLive .title .commentsNum, +.spuInfo .buyRecords .title .commentsNum { + font-size: 26rpx; + color: #aaa; + font-weight: normal; +} + +.spuInfo .straightInLive .comments, .spuInfo .buyRecords .comments { + margin-top: 30rpx; +} + +.spuInfo .straightInLive .comments .commentsCon, +.spuInfo .buyRecords .comments .commentsCon { + font-size: 28rpx; + color: #666; + line-height: 44rpx; + margin-bottom: 10rpx; + word-wrap: break-word; +} + +.spuInfo .straightInLive .comments .doubleHidden, +.spuInfo .buyRecords .comments .doubleHidden { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.spuInfo .straightInLive .comments .commentsOpen, +.spuInfo .buyRecords .comments .commentsOpen { + height: 22rpx; + font-size: 22rpx; + color: #444; + font-weight: bold; + margin-bottom: 20rpx; + display: flex; + align-items: center; +} + +.spuInfo .straightInLive .comments .commentsOpen .commentsOpenImg, +.spuInfo .buyRecords .comments .commentsOpen .commentsOpenImg { + width: 16rpx; + height: 8rpx; + margin-left: 6rpx; +} + +.spuInfo .straightInLive .comments .commentsOpen .down, +.spuInfo .buyRecords .comments .commentsOpen .down { + transform: rotate(180deg); +} + +.spuInfo .straightInLive .comments .allImg, +.spuInfo .buyRecords .comments .allImg { + width: 650rpx; + /* height: 150rpx; */ + overflow: hidden; +} + +.spuInfo .straightInLive .comments .allImg { + display: flex; + overflow-x: auto; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.spuInfo .straightInLive .comments .allImg .commentsImg, +.spuInfo .buyRecords .comments .allImg .commentsImg { + width: 150rpx; + height: 150rpx; + margin-right: 16rpx; + display: inline-block; +} + +.spuInfo .straightInLive .comments .allImg .commentsImg .goodsImg, +.spuInfo .buyRecords .comments .allImg .commentsImg .goodsImg { + width: 150rpx; +} + +.spuInfo .straightInLive .comments .allImg .commentsImg .goodsImg .img-class, +.spuInfo .buyRecords .comments .allImg .commentsImg .goodsImg .img-class { + width: 150rpx; + height: 150rpx; + border-radius: 4rpx; + position: unset; +} + +.spuInfo .straightInLive .comments .allImg .commentsImg:last-child, +.spuInfo .buyRecords .comments .allImg .commentsImg:last-child { + margin: 0; +} + +.spuInfo .straightInLive .comments .checkComments, +.spuInfo .buyRecords .comments .checkComments { + font-size: 26rpx; + color: #aaa; + line-height: 26rpx; + padding: 40rpx 0; + text-align: center; +} + +.spuInfo .buyRecords { + width: 650rpx; +} + +.spuInfo .buyRecords .title { + display: flex; + align-items: center; + justify-content: space-between; +} + +.spuInfo .buyRecords .title .buyNum { + font-size: 24rpx; + color: #aaa; + font-weight: normal; +} + +.spuInfo .buyRecords .title .buyNum text { + color: #ff758c; + font-weight: bold; +} + +.spuInfo .buyRecords .title .buyNum .goBuyRecords { + width: 12rpx; + height: 24rpx; + display: inline-block; + margin-bottom: -4rpx; + margin-left: 10rpx; +} + +.spuInfo .buyRecords .buyerList { + padding: 30rpx 20rpx 20rpx; + display: flex; + flex-wrap: wrap; + width: 650rpx; + box-sizing: border-box; +} + +.spuInfo .buyRecords .buyerList .buyerImg { + width: 90rpx; + height: 90rpx; + margin-right: 40rpx; + margin-bottom: 24rpx; + border-radius: 100%; + display: block; +} + +.spuInfo .buyRecords .buyerList .buyerImg .img-class { + width: 90rpx; + height: 90rpx; + border-radius: 100%; +} + +.spuInfo .buyRecords .buyerList .buyerImg:nth-child(5) { + margin-right: 0; +} + +.spuInfo .buyRecords .buyerList .moreBuyer { + display: inline-block; +} + +.spuInfo .buyRecords .buyerList .moreBuyer .buyerImg { + margin-right: 0; +} + +.spuInfo .spuDetail { + width: 100%; +} + +.spuInfo .spuDetail .goodsDetailTitleImg { + width: 336rpx; + /* height: 60rpx; */ + margin: 30rpx auto; + display: block; +} + +.spuInfo .spuDetail .warmPrompt { + width: 750rpx; + overflow-x: hidden; +} + +.spuInfo .spuDetail .warmPrompt .wxParse .wxParse-p .wxParse-inline,.spuInfo .spuDetail .warmPrompt .wxParse .wxParse-inline { + margin: 0 30rpx; +} + +.spuInfo .service { + padding: 40rpx 20rpx 0; +} + +.spuInfo .service .detailLogo { + display: flex; + justify-content: center; + align-items: center; + margin-bottom: 40rpx; +} + +.spuInfo .service .detailLogo text { + width: 130rpx; + height: 2rpx; + background: #e4e4e4; +} + +.spuInfo .service .detailLogo .detailLogoImg { + width: 184rpx; + height: 48rpx; + margin: 0 40rpx; +} + +.spuInfo .service .instructions { + background: #fff; + padding: 40rpx 30rpx; + border-radius: 20rpx; + overflow: hidden; +} + +.spuInfo .service .instructions .instructionsTit { + height: 36rpx; + line-height: 36rpx; + color: #1c1819; + font-size: 28rpx; + font-weight: bold; + margin-left: 28rpx; + margin-bottom: 30rpx; +} + +.spuInfo .service .instructions .instructionsList { + line-height: 36rpx; + color: #999; + font-size: 24rpx; + margin-bottom: 20rpx; + display: flex; + justify-content: space-between; +} + +.spuInfo .service .instructions .instructionsList:last-child { + margin: 0; +} + +.spuInfo .service .instructions .instructionsList .instructionsMark { + width: 6rpx; + height: 6rpx; + background: #4facfe; + margin-top: 16rpx; +} + +.spuInfo .service .instructions .instructionsList .instructionsText { + width: 630rpx; +} + +.spuInfo .service .instructions .instructionsList .instructionsText .instructionsTextTit { + color: #666; + font-weight: bold; +} + +.spuInfo .service .instructions .instructionsList .instructionsText .instructionsUnderline { + color: #666; + text-decoration: underline; +} + +.spuInfo .service .instructions .instructionsList .instructionsText .instructionsTime { + color: #4facfe; + font-weight: bold; +} + +.spuInfo .sloganImg { + width: 250rpx; + height: 56rpx; + padding: 0rpx 0 180rpx; + margin: 0 auto; + display: block; +} + +.goTopImg { + bottom: 160rpx; + right: 30rpx; + width: 45rpx; + height: 45rpx; + position: fixed; + background: rgba(0, 0, 0, 0.5); + border-radius: 50%; + color: #fff; + text-align: center; + z-index: 3; + padding: 15rpx; +} + +@-webkit-keyframes opacity { + 0% { + opacity: 0; + } + + 25% { + opacity: 0.3; + } + + 50% { + opacity: 0.5; + } + + 75% { + opacity: 0.8; + } + + 100% { + opacity: 1; + } +} + +@keyframes opacity { + 0% { + opacity: 0; + } + + 25% { + opacity: 0.3; + } + + 50% { + opacity: 0.5; + } + + 75% { + opacity: 0.8; + } + + 100% { + opacity: 1; + } +} + +.canvas-img { + position: absolute; + top: -20000rpx; +} + +.goodsDetailSkeleton_content { + position: relative; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_img { + width: 750rpx; + height: 600rpx; + background-color: #e4e4e4; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu { + width: 710rpx; + height: 540rpx; + position: absolute; + left: 20rpx; + top: 650rpx; + background: #fff; + border-radius: 20rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list { + height: 60rpx; + margin: 10rpx 30rpx; + display: flex; + justify-content: space-between; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list text { + width: 200rpx; + background: #e4e4e4; + border-radius: 10rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list2 { + height: 60rpx; + margin: 30rpx; + background: #e4e4e4; + border-radius: 10rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list3, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list5 { + height: 60rpx; + margin: 30rpx; + display: flex; + justify-content: flex-start; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list3 .spec1, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list3 .spec2, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list5 .spec1, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list5 .spec2 { + width: 40rpx; + background: #e4e4e4; + border-radius: 10rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list3 .spec2, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list5 .spec2 { + width: 400rpx; + margin-left: 20rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list3 { + height: 36rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_list5 { + height: 44rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_listAct { + width: 670rpx; + height: 120rpx; + margin: 0 auto; + border-radius: 16rpx; + background: linear-gradient(223deg, #fff7f0 0%, #fff4ec 100%); + overflow: hidden; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_listAct .goodsDetailSkeleton_list4 { + height: 32rpx; + margin: 20rpx; + display: flex; + justify-content: flex-start; + align-items: center; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_listAct .goodsDetailSkeleton_list4 .spec1, +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_listAct .goodsDetailSkeleton_list4 .spec2 { + width: 40rpx; + height: 32rpx; + background: #e4e4e4; + border-radius: 8rpx; + margin-right: 20rpx; +} + +.goodsDetailSkeleton_content .goodsDetailSkeleton_spu .goodsDetailSkeleton_listAct .goodsDetailSkeleton_list4 .spec2 { + width: 400rpx; + height: 40rpx; +} + +button::after { + border: none; +} + +/***商品底部按钮begin **/ + +.goods-bottom-bar { + border-radius: 30rpx 30rpx 30rpx 30rpx; + height: 96rpx; + display: flex; +} + +.goods-bottom-bar .leftBtn { + height: 96rpx; + display: flex; + +} + +.goods-bottom-bar .leftBtn .bar-item { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.goods-bottom-bar .leftBtn .back-to-index { + background-color: #36362D; + border-radius: 0rpx 8rpx 8rpx 0rpx; + width: 125rpx; + height: 96rpx; + font-size: 18rpx; + color: #fff; +} + +.goods-bottom-bar .leftBtn .back-to-index image { + width: 50rpx; + height: 50rpx; +} + +.goods-bottom-bar .leftBtn .shop-cart { + border-radius: 8rpx 0rpx 0rpx 8rpx; + margin-left: 6rpx; + background-color: #36362D; + width: 125rpx; + height: 96rpx; + font-size: 18rpx; + color: #fff; + position: relative; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon { + + width: 50rpx; + height: 50rpx; + position: relative; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon image { + padding-right: 40rpx; + width: 100%; + height: 100%; +} + +.goods-bottom-bar .leftBtn .shop-cart .icon .cart-num { + position: absolute; + right: -16rpx; + top: -4rpx; + width: 36rpx; + height: 36rpx; + background: #ff758c; + border-radius: 36rpx; + color: #fff; + font-size: 22rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .goodsStatus { + width: 100%; + height: 96rpx; + background: #dcdcdc; + font-size: 30rpx; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-weight: bold; + /**background-color: #1c1819;**/ + overflow: hidden; + border-radius: 0rpx 40rpx 40rpx 0rpx; + +} +.bar-item add-to-cart { + background-color: rgb(247, 112, 98); +} + + +.goods-bottom-bar .gobuy .add-to-cart { + width: 270rpx; + height: 96rpx; + background-color: #36362D; + border-left:2rpx solid #666; + color: #fff; + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.goods-bottom-bar .gobuy .btn { + width: 270rpx; + height: 96rpx; + position: absolute; + opacity: 0; + z-index: 9; + top: 0; + padding: 0; + margin: 0; + box-shadow: 20rpx 20rpx 20rpx 0rpx rgba(0,0,0,0.8); +} + +.goods-bottom-bar .gobuy .balanceBtn { + display: flex; + flex: 1; +} + +.goods-bottom-bar .gobuy .balanceBtn .balance { + height: 96rpx; + flex: 1; + background: linear-gradient(90deg, #e7614d 0%, #E57868 100%); + color: #fff; + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0rpx 0px 0px 0rpx; +} + +.i-fixed-bottom { + background-color: rgba(0,0,0,0.3); + position: fixed; + bottom: 40rpx; + z-index: 100; + overflow: hidden; + left: 30rpx; + right:30rpx; + border-radius: 48rpx 48rpx 48rpx 48rpx; + box-shadow: 0rpx 10rpx 20rpx 10rpx rgba(0,0,0,0.4); + +} + .filter { + background-color: rgba(255, 255, 255, 0.8); + display: flex; + flex-direction: row; + justify-content: space-around; + position: fixed; + bottom: 40rpx; + left: 0; + z-index: 2; + width: 100%; + height: 96rpx; + backdrop-filter: blur(30rpx) ; + border-radius: 30rpx 30rpx 30rpx 30rpx; + margin-left: 20rpx; + margin-right: 20rpx; + overflow: hidden; +} + +.i-fixed-bottom.iphoneX-height { + padding-bottom: 48rpx; +} + +.i-fixed-bottom.pb20 { + padding-bottom: 40rpx; +} + +.ui-mask { + position: fixed; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; + background: rgba(0, 0, 0, 0.6); +} + +.model-services { + width: 100%; + position: fixed; + background-color: #fff; + bottom: 0; + z-index: 1000; + color: #333; + -webkit-transition: all 0.3s; + transition: all 0.3s; + -webkit-transform: translate(0, 100%); + transform: translate(0, 100%); + border-radius: 30rpx 30rpx 0rpx 0rpx; +} + +.model-services.show { + -webkit-transform: translate(0); + transform: translate(0); +} + +.model-services .model-services-title { + font-size: 36rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + border-bottom: 1px solid #f2f5f8; +} + +.model-services .model-services-content { + padding: 20rpx; +} + +.model-services .model-services-content .service-item { + margin-bottom: 20rpx; + width: 50%; + float: left; + text-align: center; +} + +.model-services .model-services-content .service-icon { + font-size: 80rpx; + color: #4facfe; +} + +.service-name { + padding-left: 10rpx; +} + +.cube-text { + position: relative; + width: 100%; + height: 32rpx; + line-height: 32rpx; + color: #777; + margin-top: 5rpx; + font-size: 24rpx; +} + +.none_btn { + border: none; + line-height: 1.1; + padding: 0px; +} + +button[plain] { + border: none; +} + +.share-modal { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 101; + transition: all 400ms ease-in; +} + +.share-modal-content { + position: relative; + width: 70%; + top: 50%; + left: 15%; + transform: translateY(-50%); + z-index: 110; +} + +.share-modal-img { + width: 100%; + height: 956rpx; + background: #f7f7f7; +} + +.share-modal-img image { + width: 100%; +} + +.share-modal-btn-list { + display: flex; + margin-top: 30rpx; +} + +.share-modal-btn-item { + text-align: center; + flex: 1; +} + +.share-modal .btn-icon { + font-size: 70rpx; + color: #fff; + margin: 0 auto; +} + +.share-modal .btn-text { + position: relative; + width: 100%; + height: 32rpx; + line-height: 32rpx; + color: #fff; + margin-top: 5rpx; + font-size: 24rpx; +} + +/*分享end*/ + + +.spuInfoImg .item-tag { + position: absolute; + left: 30rpx; + top: 20rpx; + width: 80rpx; + height: 92rpx; + z-index: 1; + color: #fff; + text-align: center; +} + +.item-tag-bg { + position: absolute; + left: 0; + top: 0; + width: 80rpx; + height: 92rpx; + z-index: 0; +} + +.spuInfoImg .item-tag .tag-name { + position: relative; + padding-top: 12rpx; + font-size: 28rpx; + line-height: 1; + font-weight: 600; + z-index: 1; +} + +.spuInfoImg .item-tag .tag-name.two-word { + font-size: 28rpx; + padding-top: 24rpx; +} + +/* 评论 */ + +.comment-user { + line-height: 60rpx; + display: flex; + margin-bottom: 10rpx; +} + +.comment-user image { + width: 60rpx; + height: 60rpx; + border-radius: 50%; + margin-right: 14rpx; + background-color: #f0f0f0; +} + +.comment-user text { + font-size: 26rpx; +} + + + +.cell { + display: flex; + justify-content: center; + align-items: center; + margin: 30rpx 0; + background-color: #fff; + padding: 20rpx 30rpx; + border-radius: 20rpx; +} + +.cell-left { + flex: 1; + line-height: 40rpx; +} + +.cell-left text { + display: inline-block; + vertical-align: middle; +} + +.icon-right { + width: 12rpx; + height: 22rpx; +} + +.cell-icon { + width: 40rpx; + display: inline-block; + vertical-align: middle; + margin-right: 10rpx; +} + +/* 幻灯片视频 */ + +.btn_view { + position: absolute; + left: 50%; + top: 50%; + z-index: 100; + transform: translate(-50%, -50%); +} + +.btn_view image { + width: 120rpx; + height: 120rpx; + background: rgba(0, 0, 0, 0.1); + border-radius: 50%; + animation: playScale 2s ease-in-out infinite; +} + +.video-wrap, .swiper-video { + width: 100%; + height: 100%; +} + +.end-play { + position: relative; + z-index: 1000; + background: #000; + text-align: center; + padding: 20rpx 0; +} + +.end-play .btn { + display: inline-block; + padding: 5rpx 30rpx; + background-color: #f6f6f6; + border-radius: 20rpx; + font-size: 24rpx; +} + +@keyframes playScale { + 0% { + transform: scale(1); + } + 25% { + transform: scale(1.1); + } + 50% { + transform: scale(1); + } + 75% { + transform: scale(1.1); + } +} + +/* 群 */ +.group { + background-color: #fff; + width:650rpx; + padding:20rpx 30rpx; + border-radius:20rpx; + margin:20rpx auto 0; + box-shadow:0 0 40rpx 0 rgba(0, 0, 0, 0.05); + display: flex; + align-items: center; +} + +.group-avatar image { + width: 94rpx; + height: 94rpx; + border-radius: 10rpx; +} + +.group-m { + flex: 1; + margin: 0 15rpx; + width: 0; +} + +.group-btn { + background: #4facfe; + color: #fff; + padding: 10rpx 30rpx; + border-radius: 60rpx; +} + +.group-title { + font-size: 28rpx; + color: #333; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} + +.group-desc { + font-size: 24rpx; + color: #999; + margin-top: 6rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; +} + +.group-r-icon { + width: 20rpx; + height: 36rpx; + vertical-align: middle; +} + +.guessLike { + margin-bottom: 0 !important; + margin-top: 30rpx !important; +} + +.comiss { + display: inline-block; + padding: 2rpx 8rpx; + background: #fff7f0; + border-radius: 6rpx; + margin-right: 10rpx; + font-size: 20rpx; + color: #ca7e57; + font-weight: bold; + margin-top: 20rpx; +} + +.hexiao { + margin-right: 30rpx; +} + +.coverVideo { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 1000; +} + +.coverVideo .main { + width: 750rpx; + height: 100%; + background: #000; + overflow: hidden; + z-index: 99999; +} + +.coverVideo .main .section video { + width: 750rpx; + height: 100vh; +} + +.coverVideo .goods { + width: 400rpx; + height: 150rpx; + background: #fff; + border-radius: 10rpx; + position: fixed; + bottom: 160rpx; + left: 20rpx; + z-index: 9998; + display: flex; +} + +.coverVideo .goods .good-img { + width: 150rpx; + height: 150rpx; + margin-right: 10rpx; + box-sizing: border-box; + padding: 10rpx; +} + +.coverVideo .good-img cover-image { + width: 150rpx; + height: 150rpx; + object-fit: cover; + border-radius: 10rpx; + overflow: hidden; +} + +.coverVideo .good-title { + display: inline-block; + font-size: 26rpx; + margin-top: 10rpx; + height: 60rpx; + line-height: 30rpx; + white-space: pre-wrap; +} + +.coverVideo .xqbottom { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10rpx; +} + +.coverVideo .good-price { + display: inline-block; + flex: 1; + font-size: 28rpx; + color: red; +} + +.presaleTime { + text-align: center; + padding-right: 10rpx; + flex: 3; + border-right: 1px solid #fff; +} + +.dingjin .price { + font-family: DIN; + color: ff758c; +} diff --git a/eaterplanet_ecommerce/pages/goods/industrial.js b/eaterplanet_ecommerce/pages/goods/industrial.js new file mode 100644 index 0000000..dfbe2f1 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/industrial.js @@ -0,0 +1,33 @@ +var app = getApp(); + +Page({ + data: { + goods_industrial: [] + }, + + onLoad: function (options) { + let goods_id = options.id || ''; + wx.showLoading(); + this.getData(goods_id); + }, + + getData(goods_id){ + let that = this; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'goods.get_instructions', + goods_id + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + that.setData({ + goods_industrial: res.data.data.goods_industrial || [] + }) + } + } + }) + } +}) \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/industrial.json b/eaterplanet_ecommerce/pages/goods/industrial.json new file mode 100644 index 0000000..2f7ec63 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/industrial.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "工商资质", + "usingComponents": {} +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/industrial.wxml b/eaterplanet_ecommerce/pages/goods/industrial.wxml new file mode 100644 index 0000000..de0999e --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/industrial.wxml @@ -0,0 +1,3 @@ + + + diff --git a/eaterplanet_ecommerce/pages/goods/industrial.wxss b/eaterplanet_ecommerce/pages/goods/industrial.wxss new file mode 100644 index 0000000..cf9d769 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/industrial.wxss @@ -0,0 +1,3 @@ +.img { + width: 100%; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/relativeGoodsList.js b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.js new file mode 100644 index 0000000..aea6e1d --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.js @@ -0,0 +1,45 @@ +Component({ + properties: { + list: { + type: Array, + value: [] + }, + needAuth: { + type: Boolean, + value: false + } + }, + + data: { + disabled: false + }, + + methods: { + openSku: function (e) { + if (this.data.needAuth) { + this.triggerEvent("authModal"); + return; + } + let idx = e.currentTarget.dataset.idx; + this.setData({ disabled: false }) + let spuItem = this.data.list[idx]; + this.triggerEvent("openSku", { + actId: spuItem.actId, + skuList: spuItem.skuList, + promotionDTO: spuItem.promotionDTO || '', + allData: { + spuName: spuItem.spuName, + skuImage: spuItem.skuImage, + actPrice: spuItem.actPrice, + canBuyNum: spuItem.spuCanBuyNum, + stock: spuItem.spuCanBuyNum, + marketPrice: spuItem.marketPrice, + oneday_limit_count: spuItem.oneday_limit_count, + total_limit_count: spuItem.total_limit_count, + one_limit_count: spuItem.one_limit_count, + goods_start_count: spuItem.goods_start_count + } + }) + } + } +}) diff --git a/eaterplanet_ecommerce/pages/goods/relativeGoodsList.json b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.json new file mode 100644 index 0000000..a44cda2 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "i-img": "../../components/img/index", + "i-button": "../../components/button/index", + "i-router-link": "../../components/router-link/router-link" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxml b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxml new file mode 100644 index 0000000..1b03bfc --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxml @@ -0,0 +1,22 @@ + + + 大家常买 + + + + + 已抢光 + {{item.spuName}} + + ¥{{item.actPrice[0]}}.{{item.actPrice[1]}} + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxss b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxss new file mode 100644 index 0000000..c4d4cf5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/goods/relativeGoodsList.wxss @@ -0,0 +1,98 @@ +.new-comers { + position: relative; + margin: 20rpx; + background: #fff; + border-radius: 20rpx; + padding: 30rpx 30rpx; +} + +.new-comers-title { + position: relative; + margin-bottom: 20rpx; + font-size: 30rpx; + font-weight: bold; + color: #333; + padding-left: 20rpx; +} + +.new-comers-title::before { + content: ""; + position: absolute; + top: 0; + bottom: 0; + left: 0; + border-left: 8rpx solid #e7614d; +} + +.new-comers-scroll { + max-height: 340rpx; +} + +.new-comers-wrap { + position: relative; + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + +.new-comers-item { + width: 240rpx; + box-sizing: border-box; + padding: 20rpx; + font-size: 28rpx; +} + +.new-comers-item .new-img { + width: 200rpx; + height: 180rpx; + margin-bottom: 20rpx; +} + +.new-comers-item .title { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.new-comers-item .new-bot { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.new-comers-item .add-cart { + width: 44rpx; + height: 44rpx; + padding: 0; + margin: 0; +} + +.new-comers-item .add-cart .img { + width: 44rpx; + height: 44rpx; + display: block; +} + +.new-comers-item .price { + color: #ff758c; +} + +.new-comers-item { + position: relative; +} + +.new-comers-item .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 50%; + top: 80rpx; + padding: 0 12rpx; + transform: translateX(-50%); +} diff --git a/eaterplanet_ecommerce/pages/index/advert.js b/eaterplanet_ecommerce/pages/index/advert.js new file mode 100644 index 0000000..48fe7e7 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/advert.js @@ -0,0 +1,66 @@ +var _extends = Object.assign || function(e) { + for (var t = 1; t < arguments.length; t++) { + var o = arguments[t]; + for (var a in o) Object.prototype.hasOwnProperty.call(o, a) && (e[a] = o[a]); + } + return e; +}, util = require("../../utils/util.js"), status = require("../../utils/index.js"), wcache = require("../../utils/wcache.js"), app = getApp(); + +Page({ + + + + mixins: [ require("../../mixin/globalMixin.js") ], + data: { + isIpx: true, + common_header_backgroundimage: "", + }, + + getCopyright: function() { + var C = this; + app.util.request({ + url: "entry/wxapp/user", + data: { + controller: "user.get_copyright" + }, + dataType: "json", + success: function(e) { + if (0 == e.data.code) { + var t = e.data, c = t.supply_diy_name, h = t.common_header_backgroundimage; + C.setData({ + common_header_backgroundimage: h || "" + }, ); + } + } + }); +}, + +onShow: function() { + var t = this; + t.getCopyright(); +}, + + + +onReady() { + //5s后跳转 + this.data.Time = setInterval(() => { + this.setData({ + time: --this.data.time + }) + if (this.data.time <= 0) { + clearInterval(this.data.Time) + this.goHome() + } + }, 1000) +}, +goHome() { + clearInterval(this.data.Time) + wx.reLaunch({ + url: '../index/index' + }) +}, + data: { + time: 5, + }, +}) \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/advert.json b/eaterplanet_ecommerce/pages/index/advert.json new file mode 100644 index 0000000..fdef7f6 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/advert.json @@ -0,0 +1,6 @@ +{ + "navigationBarTextStyle": "white", + "backgroundColor": "#fff", + "disableScroll": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/advert.wxml b/eaterplanet_ecommerce/pages/index/advert.wxml new file mode 100644 index 0000000..7f0115a --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/advert.wxml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + 点击跳过{{time}}S + + + + diff --git a/eaterplanet_ecommerce/pages/index/advert.wxss b/eaterplanet_ecommerce/pages/index/advert.wxss new file mode 100644 index 0000000..6058f1d --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/advert.wxss @@ -0,0 +1,122 @@ + +.pb20 { + padding-bottom: 60rpx; +} +.upimg { + width: 100%; + top:0; + overflow: hidden; + } + +.topic { + border-radius: 0!important; +} + +.topic-img { + margin-bottom: 0rpx; + position: relative; + right: 0rpx; + border-radius: 0rpx!important; + width: 100%; +} +.logohdimg .pb20 { + padding-bottom: 50rpx; + background: #fff; +} +.bottom { + width:100%; + padding-bottom: calc(env(safe-area-inset-bottom) + 30rpx) +} +.bottomimg { + width:100%; + height: 175rpx; + position: absolute; + filter: drop-shadow(0px 0px 20px rgba(0, 0, 0, 0.7)); +} +.container { + width:100%; + height:100%; + /**background:linear-gradient(90deg,#007FAF 0%,#42ADD5 100%);**/ +} +.welcome { + /**margin-top: 400rpx;**/ + width: 100%; + height:100%; + flex-direction: column; + align-items: center; +} + +.welcome .bottom{ + margin-bottom: 100rpx; +} +.welcome image { + width: 100%; + height: 100vh; + overflow: hidden; +} + +.welcome button { + background: #00AFBE; + color: #fff; + width: 260rpx; + opacity: 0; + font-size:32rpx; + animation: op 2s infinite; + line-height: 60rpx; + border:2px solid #fff; + margin:100rpx 0 + +} + +@keyframes op { + 0% { + opacity: 0.4; + } + + 25% { + opacity: 0.6; + } + + 50% { + opacity: 0.8; + } + + 75% { + opacity: 0.6; + + } + + 100% { + opacity: 0.4; + } +} +.time { + height: 60rpx; + font-size: 24rpx; + position: absolute; + bottom: 100rpx; + border-radius: 20rpx; + line-height: 60rpx; + right: 60rpx; + padding:0 20rpx; + background: rgba(255, 255, 255, 0.542); +} + +.logohdimg{ + color: #fff; + height: 100rpx; + position: absolute; + left: 50rpx; + bottom: 10rpx; + padding-bottom: 60rpx; + filter: drop-shadow(0 0rpx 5rpx rgba(0, 0, 8, 0.4)); + margin-left: 0rpx; + margin-right: 0rpx; + text-align: center; +} + +.logohdimg .logo{ + height: 80rpx; + width: 331rpx; + text-align: center; +} diff --git a/eaterplanet_ecommerce/pages/index/banner.wxml b/eaterplanet_ecommerce/pages/index/banner.wxml new file mode 100644 index 0000000..f2ea396 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/banner.wxml @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/blank.wxml b/eaterplanet_ecommerce/pages/index/blank.wxml new file mode 100644 index 0000000..e03922a --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/blank.wxml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/communityShow.wxml b/eaterplanet_ecommerce/pages/index/communityShow.wxml new file mode 100644 index 0000000..514c451 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/communityShow.wxml @@ -0,0 +1,55 @@ + diff --git a/eaterplanet_ecommerce/pages/index/coupon.wxml b/eaterplanet_ecommerce/pages/index/coupon.wxml new file mode 100644 index 0000000..d14fbdd --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/coupon.wxml @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/coupon.wxss b/eaterplanet_ecommerce/pages/index/coupon.wxss new file mode 100644 index 0000000..c49f9d9 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/coupon.wxss @@ -0,0 +1,85 @@ +.coupon-item2 { + position: relative; + width: 280rpx; + height: 126rpx; + display: flex; + align-items: center; + margin-right: 20rpx; +} + +.coupon-item2 .coupon-item2-bg { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + width: 280rpx; + height: 100%; +} + +.coupon-item2 .coupon-intro { + position: relative; + flex: 1; + padding-left: 20rpx; +} + +.coupon-item2 .coupon-btn { + position: relative; + width: 40rpx; + text-align: center; + line-height: 36rpx; + padding: 0 12rpx; +} + +.promotion.coupon-style3 { + padding: 16rpx; + margin-left: 20rpx; + margin-right: 20rpx; + background-color: transparent; + background-size: cover; + border-radius: 16rpx; +} + +.coupon-item3 { + position: relative; + width: 220rpx; + height: 268rpx; + margin-right: 20rpx; + display: flex; + flex-direction: column; + align-items: center; +} + +.coupon-item3 .coupon-item3-bg { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + width: 220rpx; + height: 100%; +} + +.coupon-item3 .coupon-intro { + position: relative; +} + +.coupon-item3 .price { + font-size: 48rpx; +} + +.coupon-item3 .coupon-desc { + color: #777777; +} + +.coupon-item3 .coupon-btn { + position: absolute; + width: 132rpx; + bottom: 20rpx; + left: 50%; + margin-left: -66rpx; + color: #FFFFFF; + line-height: 56rpx; + background-color: #FF4544; + border-radius: 60rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/cube.wxml b/eaterplanet_ecommerce/pages/index/cube.wxml new file mode 100644 index 0000000..8bd653e --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/cube.wxml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/cube.wxss b/eaterplanet_ecommerce/pages/index/cube.wxss new file mode 100644 index 0000000..3a00e20 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/cube.wxss @@ -0,0 +1,156 @@ +.rubik-cube { + overflow: hidden; + padding: 20rpx; + /* display: flex; + flex-wrap: wrap; */ +} + +.rubik-cube .item { + float: left; + text-align: center; + line-height: 0; + box-sizing: border-box; +} + +.rubik-cube .item image { + width: 100%; + max-width: 100%; + /* max-height: 388rpx; */ +} + +.rubik-cube .item.row1-of2 { + width: 50%; + padding-bottom: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row1-of2:nth-child(1) { + padding-left: 0!important; +} + +.rubik-cube .item.row1-of2:nth-child(2) { + padding-right: 0!important; +} + +.rubik-cube .item.row1-of3 { + width: 33.33%; + padding-bottom: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row1-of3:nth-child(1) { + padding-left: 0!important; +} + +.rubik-cube .item.row1-of3:nth-child(3) { + padding-right: 0!important; +} + +.rubik-cube .item.row1-of4 { + width: 25%; + padding-bottom: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row1-of4:nth-child(1) { + padding-left: 0!important; +} + +.rubik-cube .item.row1-of4:nth-child(4) { + padding-right: 0!important; +} + +.rubik-cube .item.row2-lt-of2-rt { + width: 50%; + display: inline-block; +} + +.rubik-cube .item.row2-lt-of2-rt:nth-child(1) { + padding-left: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row2-lt-of2-rt:nth-child(2) { + padding-right: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row2-lt-of2-rt:nth-child(3) { + padding-left: 0!important; + padding-bottom: 0!important; +} + +.rubik-cube .item.row2-lt-of2-rt:nth-child(4) { + padding-right: 0!important; + padding-bottom: 0!important; +} + +.rubik-cube .item.row1-lt-of2-rt { + width: 50%; +} + +.rubik-cube .item.row1-lt-of2-rt:nth-child(1) { + width: 48%; + padding-left: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row1-lt-of2-rt:nth-child(2) { + float: right; + padding-top: 0!important; + padding-right: 0!important; +} + +.rubik-cube .item.row1-lt-of2-rt:nth-child(3) { + float: right; + padding-bottom: 0!important; + padding-right: 0!important; +} + +.rubik-cube .item.row1-tp-of2-bm:nth-child(1) { + width: 100%; + padding-left: 0!important; + padding-top: 0!important; + padding-right: 0!important; +} + +.rubik-cube .item.row1-tp-of2-bm:nth-child(2) { + padding-left: 0!important; +} + +.rubik-cube .item.row1-tp-of2-bm:nth-child(3) { + padding-right: 0!important; +} + +.rubik-cube .item.row1-tp-of2-bm:nth-child(2), +.rubik-cube .item.row1-tp-of2-bm:nth-child(3) { + width: 50%; + padding-bottom: 0!important; +} + +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(1) { + width: 50%; + padding-left: 0!important; + padding-top: 0!important; + padding-bottom: 0!important; +} + +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(2) { + width: 50%; + padding-right: 0!important; + padding-top: 0!important; +} + +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(3) { + /* padding-left: 0!important; */ +} + +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(4) { + /* padding-right: 0!important; */ +} + +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(3), +.rubik-cube .item.row1-lt-of1-tp-of2-bm:nth-child(4) { + width: 25%; + padding-bottom: 0!important; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/diyCoupon.wxml b/eaterplanet_ecommerce/pages/index/diyCoupon.wxml new file mode 100644 index 0000000..4ddabd3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/diyCoupon.wxml @@ -0,0 +1,65 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/diySeckill.wxml b/eaterplanet_ecommerce/pages/index/diySeckill.wxml new file mode 100644 index 0000000..eb2c67f --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/diySeckill.wxml @@ -0,0 +1,71 @@ + diff --git a/eaterplanet_ecommerce/pages/index/diySeckill.wxss b/eaterplanet_ecommerce/pages/index/diySeckill.wxss new file mode 100644 index 0000000..e050676 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/diySeckill.wxss @@ -0,0 +1,13 @@ +.seckill-time-i { + display: inline-block; + width: 32rpx; + height: 32rpx; + border-radius: 4rpx; + background-color: #303133; + color: #FFFFFF; + text-align: center; + margin: 0 6rpx; + font-size: 24rpx; + line-height: 32rpx; + text-align: center; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/diySingleImg.wxml b/eaterplanet_ecommerce/pages/index/diySingleImg.wxml new file mode 100644 index 0000000..faf5a13 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/diySingleImg.wxml @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/floatBtn.wxml b/eaterplanet_ecommerce/pages/index/floatBtn.wxml new file mode 100644 index 0000000..e98c2f0 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/floatBtn.wxml @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/floatBtn.wxss b/eaterplanet_ecommerce/pages/index/floatBtn.wxss new file mode 100644 index 0000000..32fd60b --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/floatBtn.wxss @@ -0,0 +1,36 @@ +.diyFloatBtn { + position: fixed; + z-index: 999; + width: 80rpx; +} + +.diyFloatBtn.fixed-1, +.diyFloatBtn.fixed-3 { + left: 20rpx; +} + +.diyFloatBtn.fixed-2, +.diyFloatBtn.fixed-4 { + right: 20rpx; +} + +.diyFloatBtn-item { + display: inline-block; + width: 80rpx; + height: 80rpx; + border-radius: 50%; + text-align: center; + box-sizing: border-box; + margin-bottom: 10rpx; + line-height: 1; + padding: 0; +} + +.diyFloatBtn-item::after { + border: 0; +} + +.diyFloatBtn-img { + width: 80rpx; + height: 80rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/goodsList.wxml b/eaterplanet_ecommerce/pages/index/goodsList.wxml new file mode 100644 index 0000000..adfa33f --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/goodsList.wxml @@ -0,0 +1,86 @@ + diff --git a/eaterplanet_ecommerce/pages/index/index.js b/eaterplanet_ecommerce/pages/index/index.js new file mode 100644 index 0000000..5f5152d --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/index.js @@ -0,0 +1,2181 @@ +const height = wx.getSystemInfoSync().windowHeight +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var a = require("../../utils/public"); +var countDownInit = require("../../utils/countDown"); +var wcache = require('../../utils/wcache.js'); +var app = getApp(); +var timerOut = ''; +var globalData = getApp().globalData +const key = globalData.key +var SYSTEMINFO = globalData.systeminfo + +Page({ + mixins: [countDownInit.default, require('../../mixin/globalMixin.js'), require('../../mixin/compoentCartMixin.js')], + data: { + isIPhoneX: globalData.isIPhoneX, + isfixed: !1, + statusBarHeight: app.globalData.statusBarHeight + 44 + 'px', + searchBarHeight: app.globalData.statusBarHeight + 'px', + rushboxHeight: app.globalData.statusBarHeight + 200 + 'px', + needAuth: false, + stopClick: false, + community: {}, + rushList: [], + commingList: [], + countDownMap: [], + actEndMap: [], + skuList: [], + pageNum: 1, + notice_list: [], + slider_list: [], + shop_info: {}, + showEmpty: false, + indexBottomImage: '', + classification: { + tabs: [], + activeIndex: -1 + }, + commingClassification: { + tabs: [], + activeIndex: -1 + }, + common_header_backgroundimage: "", + isShowCommingClassification: true, + isShowClassification: true, + showChangeCommunity: false, + isTipShow: false, + isShowGuide: false, + isShowMenu: false, + index_lead_image: '', + theme: 0, + cartNum: 0, + navigat: [], + navigatSwiper: {page: 1, current:0, totnav: 0}, + tabIdx: 0, + scrollDirect: "", + isSticky: false, + showCommingEmpty: false, + stopNotify: true, + reduction: {}, + is_share_html: true, + commingNum: 0, + couponRefresh: false, + index_change_cate_btn: 0, + newComerRefresh: false, + showCouponModal: false, + copy_text_arr: [], + showCopyText: false, + totalAlertMoney: 0, + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + needPosition: true, + typeTopicList: [], + pinList: {}, + cube: [], + secRushList: [], + secKillGoodsIndex: 1, + isblack: 0, + imageSize: { + imageWidth: "100%", + imageHeight: 600 + }, + fmShow: true, + presale_index_info: '', + isDiy: 0, + diyManyGoodsList: [] + }, + isFirst: 0, + $data: { + statusBarHeight: app.globalData.statusBarHeight + 44, + top: 0, + stickyFlag: false, + scrollTop: 0, + overPageNum: 1, + loadOver: false, + hasOverGoods: false, + countDownMap: {}, + actEndMap: {}, + timer: {}, + scrollHeight: 1300, + stickyTop: 0, + hasCommingGoods: true + }, + tpage: 1, + hasRefeshin: false, + postion: {}, + options: '', + focusFlag: false, + + + /** + * 监控滚动事件 + */ + onPageScroll: function (t) { + if (!this.$data.isLoadData) { + if (t.scrollTop < this.$data.scrollHeight) { + if (t.scrollTop > this.$data.scrollTop) { + "down" !== this.data.scrollDirect && this.setData({ + scrollDirect: "down" + }) + } else { + "up" != this.data.scrollDirect && this.setData({ + scrollDirect: "up" + }) + } + } else { + "down" !== this.data.scrollDirect && this.setData({ + scrollDirect: "down" + }) + } + if (t.scrollTop > this.$data.stickyTop) { + this.data.isSticky || (this.setData({ + isSticky: true + }), this.$data.stickyFlag = true) + } else { + t.scrollTop < this.$data.stickyBackTop && this.data.isSticky && (this.setData({ + isSticky: false + }), this.$data.stickyFlag = false) + } + this.$data.scrollTop = t.scrollTop + } + }, + + onLoad: function(options) { + app.setShareConfig(); + wx.hideTabBar(); + var that = this; + var token = wx.getStorageSync('token'); + status.setNavBgColor(); + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + console.log('step1'); + let community = wx.getStorageSync('community'); + let community_id = community.communityId || ''; + + let isparse_formdata = wx.getStorageSync('isparse_formdata') || 0; + if (isparse_formdata != 1) { + // this.get_index_info(); + if (options && Object.keys(options).length != 0) { + console.log('step2'); + var scene = decodeURIComponent(options.scene); + if (scene != 'undefined') { + var opt_arr = scene.split("_"); + options.community_id = opt_arr[0]; + wcache.put('share_id', opt_arr[1]); + } + that.options = options; + + if (options.share_id != 'undefined' && options.share_id > 0) wcache.put('share_id', options.share_id); + if (options.community_id != 'undefined' && options.community_id > 0) { + console.log('step3'); + util.getCommunityById(options.community_id).then((res)=>{ + if (res.code == 0) { + console.log('step4'); + var shareCommunity = res.data; + console.log('分享community_id', options.community_id); + console.log('历史community_id', community_id); + let sdata = {}; + if (res.open_danhead_model == 1) { + console.log('开启单社区', res.default_head_info); + sdata.community = res.default_head_info; + sdata.open_danhead_model = res.open_danhead_model; + token && that.addhistory(res.default_head_info.communityId || ''); + wx.setStorageSync('community', res.default_head_info); + } else if (shareCommunity){ + if (options.community_id != community_id) { + if (community_id) { + sdata.showChangeCommunity = true; + sdata.changeCommunity = shareCommunity; + sdata.community = community; + } else { + sdata.community = shareCommunity; + sdata.shareCommunity = shareCommunity; + wcache.put('community', shareCommunity); + } + } else { + sdata.community = community; + } + } + sdata.hidetip = false; + sdata.token = token; + sdata.showEmpty = false; + sdata.needPosition = false; + that.setData(sdata, ()=>{ + that.loadPage(); + }); + } else { + console.log('step5'); + that.loadPage(); + that.setData({ + hidetip: false, + token: token, + showEmpty: false, + needPosition: false + }) + } + token && that.addhistory(); + }) + } else { + util.getCommunityById(options.community_id).then((res) => { + if (res.code == 0) { + if (res.open_danhead_model == 1) { + console.log('开启单社区step6'); + that.setData({ community: res.default_head_info, open_danhead_model: res.open_danhead_model }) + token && that.addhistory(res.default_head_info.communityId || ''); + wx.setStorageSync('community', res.default_head_info); + } + console.log('step6'); + that.loadPage(); + } + }).catch(() => { + that.loadPage(); + }) + } + } else { + util.getCommunityById(options.community_id).then((res) => { + if (res.code == 0) { + if (res.open_danhead_model == 1) { + console.log('开启单社区step7'); + that.setData({ community: res.default_head_info, open_danhead_model: res.open_danhead_model }) + token && that.addhistory(res.default_head_info.communityId || ''); + wx.setStorageSync('community', res.default_head_info); + } + that.loadPage(); + } + }).catch(()=>{ + that.loadPage(); + }) + console.log('step7'); + that.setData({ + hidetip: false, + token: token, + showEmpty: false, + community + }) + } + } + }, + + addhistory: function (id=0) { + console.log('step13'); + let community_id = 0; + if (id==0) { + var community = wx.getStorageSync('community'); + community_id = community.communityId; + } else { + community_id = id; + } + console.log('history community_id=' + community_id); + var token = wx.getStorageSync('token'); + let that = this; + community_id !==void 0 && app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.addhistory_community', + community_id: community_id, + 'token': token + }, + dataType: 'json', + success: function(res) { + if(id!=0) that.getHistoryCommunity(), console.log('addhistory+id', id); + } + }) + }, + + loadPage: function() { + wx.showLoading(); + console.log('step8'); + let that = this; + that.get_index_info(); + if(this.data.isDiy==0) { + that.get_type_topic(); + that.getNavigat(); + that.getPinList(); + } else { + this.getDiyInfo(); + } + that.getCoupon(); + + status.loadStatus().then(function() { + let appLoadStatus = app.globalData.appLoadStatus; + console.log('appLoadStatus',appLoadStatus) + if (appLoadStatus == 0) { + // wx.hideLoading(); + setTimeout(function(){ wx.hideLoading(); },1000); + that.setData({ needAuth: true, couponRefresh: false }); + that.data.isDiy==0&&that.load_goods_data(); + } else if (appLoadStatus == 2) { + console.log('step9'); + that.getHistoryCommunity(); + } else { + console.log('step12'); + let community = wx.getStorageSync('community'); + community || (community=app.globalData.community); + if (!community){ + util.getCommunityInfo().then((res) => { + that.setData({ + community: that.fliterCommunity(res) + }) + }) + } else { + that.setData({ + community: that.fliterCommunity(community) + }) + } + console.log('step18'); + that.data.isDiy==0&&that.load_goods_data(); + } + }); + }, + + // 不显示社区省份 + fliterCommunity: function (community){ + let resArr = community && community.fullAddress && community.fullAddress.split('省'); + if (resArr) { + return Object.assign({}, community, { address: resArr[1] || resArr[0] }); + } else { + return community; + } + }, + + onReady: function (res) { + this.videoContext = wx.createVideoContext('myVideo'); + }, + + onShow: function() { + // 页面显示 + let that = this; + console.log('isblack', app.globalData.isblack) + this.setData({ stopNotify: false, tabbarRefresh: true, isblack: app.globalData.isblack || 0 }) + + util.check_login_new().then((res) => { + if(res) { + that.setData({ needAuth: false }) + } else { + this.setData({ needAuth: true, couponRefresh: false }); + return; + } + }) + + app.globalData.timer.start(); + var token = wx.getStorageSync('token'); + token&&(0, status.cartNum)('', true).then((res)=>{ + res.code == 0 && that.setData({ cartNum: res.data }) + }); + + if (app.globalData.changedCommunity) { + console.log('change') + app.globalData.goodsListCarCount = []; + let community = app.globalData.community; + this.setData({ + community: that.fliterCommunity(community), + newComerRefresh: false + }); + this.getCommunityPos(community.communityId); + this.hasRefeshin = false; + this.setData({ + newComerRefresh: true, + rushList: [], + pageNum: 1, + classificationId: null, + "classification.activeIndex": -1 + }, () => { + this.setData({ + "classification.activeIndex": 0 + }) + }) + this.$data = { + ...this.$data, ...{ + overPageNum: 1, + loadOver: false, + hasOverGoods: false, + countDownMap: {}, + actEndMap: {}, + timer: {}, + stickyFlag: false, + hasCommingGoods: true + } + } + app.globalData.changedCommunity = false, this.get_index_info(), this.addhistory(); + this.load_goods_data(), this.get_type_topic(),this.getPinList(); + } else { + console.log('nochange') + if (that.isFirst>=1){ + this.setData({ loadOver: true }) + this.changeRushListNum(); + } + } + + if (that.isFirst==0) { + this.setData({ couponRefresh: true }); + } else { + this.getCoupon(); + let cid = app.globalData.indexCateId || ''; + cid && this.goIndexType(cid); + app.globalData.indexCateId = ''; + } + + that.isFirst++; + }, + + /** + * 动态变化列表购物车数量 + */ + changeRushListNum: function(){ + let that = this; + let goodsListCarCount = app.globalData.goodsListCarCount; + let rushList = this.data.rushList; + let changeCarCount = false; + this.setData({ changeCarCount }) + if (goodsListCarCount.length > 0 && rushList.length > 0) { + goodsListCarCount.forEach(function (item) { + let k = that.arrayHasElement(rushList, item.actId); + if (k[0] != -1 && rushList[k[0]][k[1]].skuList.length === 0) { + let newNum = item.num * 1; + rushList[k[0]][k[1]].car_count = newNum >= 0 ? newNum : 0; + changeCarCount = true; + } + }) + // goodsListCarCount.forEach(function (item) { + // let k = rushList.findIndex((n) => n.actId == item.actId); + // if (k != -1 && rushList[k].skuList.length === 0) { + // let newNum = item.num * 1; + // rushList[k].car_count = newNum >= 0 ? newNum : 0; + // changeCarCount = true; + // } + // }) + this.setData({ rushList, changeCarCount }) + } + }, + + arrayHasElement: function(array, element) { + let el=array; + for(let number in el){ + if (el[number].length > 0) { + for (var index in el[number]) { + if (el[number][index].actId == element) { + return [number, index] + } + } + } + } + return [-1, -1]; + }, + + changeNotListCartNum: function (t) { + let that = this; + let e = t.detail; + (0, status.cartNum)(that.setData({ cartNum: e })); + this.changeRushListNum(); + }, + + onHide: function() { + this.setData({ stopNotify: true, tabbarRefresh: false, changeCarCount: false }) + console.log('详情页', this.data.stopNotify) + app.globalData.timer.stop(); + console.log('onHide') + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + console.log('authSuccess'); + let that = this; + this.tpage = 1; + this.hasRefeshin = false; + this.setData({ + rushList: [], + pageNum: 1, + needAuth: false, + newComerRefresh: false, + couponRefresh: true, + isblack: app.globalData.isblack || 0, + diyLoaded: false + }) + this.$data = { + ...this.$data, ...{ + overPageNum: 1, + loadOver: false, + hasOverGoods: false, + countDownMap: {}, + actEndMap: {}, + timer: {}, + hasCommingGoods: true + } + } + status.getInNum().then((isCan) => { + if (isCan) { + that.setData({ isTipShow: true }) + timerOut = setTimeout(() => { that.setData({ isTipShow: false }) }, 7000); + } + }) + this.loadPage(); + this.data.isTipShow && (timerOut = setTimeout(() => { that.setData({ isTipShow: false }) }, 7000)); + }, + + authModal: function (e = {}) { + let needAuth = (e && e.detail) || this.data.needAuth; + if (this.data.needAuth || e.detail) { + this.setData({ + showAuthModal: !this.data.showAuthModal, + needAuth + }); + return false; + } + return true; + }, + + //获取历史社区 + getHistoryCommunity: function () { + let that = this; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_history_community', + token: token + }, + dataType: 'json', + success: function (res) { + console.log('step14'); + if (res.data.code == 0) { + console.log('getHistoryCommunity'); + let history_communities = res.data.list; + let isNotHistory = false; + if (Object.keys(history_communities).length == 0 || history_communities.communityId == 0) isNotHistory = true; + + let resArr = history_communities && history_communities.fullAddress && history_communities.fullAddress.split('省'); + history_communities = Object.assign({}, history_communities, { address: resArr[1] }) + + that.setData({ + community: history_communities + }) + wcache.put('community', history_communities); + app.globalData.community = history_communities; + + if (token && !isNotHistory) { + let lastCommunity = wx.getStorageSync('lastCommunity'); + let lastCommunityId = lastCommunity.communityId || ''; + if (lastCommunityId != '' && lastCommunityId != history_communities.communityId) { + that.setData({ + showChangeCommunity: true, + changeCommunity: lastCommunity + }, ()=> { + wx.removeStorageSync('lastCommunity'); + }) + } + } + + that.setData({ + community: app.globalData.community + }) + that.load_goods_data(); + } else { + let options = that.options; + if (options !== void 0 && options.community_id) { + console.log('新人加入分享进来的社区id:', that.options); + that.addhistory(options.community_id); + } else if (res.data.code == 1) { + console.log('获取历史社区'); + wx.redirectTo({ + url: "/eaterplanet_ecommerce/pages/position/community" + }) + } else { + that.setData({ needAuth: true }) + } + } + } + }) + }, + + getScrollHeight: function () { + wx.createSelectorQuery().select('.rush-list-box').boundingClientRect((rect) => { + rect && rect.height && (this.$data.scrollHeight = rect.height || 1300); + console.log(this.$data.scrollHeight) + }).exec() + }, + + /** + * 引导页切换 + */ + handleProxy: function(){ + clearTimeout(timerOut); + this.setData({ + isTipShow: false, + isShowGuide: true + }) + wcache.put('inNum', 4); + }, + + handleHideProxy: function(){ + this.setData({ + isTipShow: false, + isShowGuide: false + }) + }, + + /** + * 获取首页信息 + */ + get_index_info: function() { + let that = this; + let community = wx.getStorageSync('community'); + let communityId = community && community.communityId || ''; + let token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.index_info', + communityId, + token + }, + dataType: 'json', + success: function(res) { + let rdata = res.data; + let groupInfo = that.data.groupInfo; + if (rdata.code == 0) { + if (!res.data.is_community && communityId && !that.data.needAuth) { + let changeCommunity = that.data.changeCommunity || {}; + let changeCommunityId = changeCommunity.communityId || ''; + if (changeCommunityId) { + wcache.put('community', changeCommunity); + that.addhistory(changeCommunity.community_id); + that.setData({ + community: changeCommunity, + showChangeCommunity: false + }) + that.loadPage(); + } else { + wx.showModal({ + title: '提示', + content: `该${groupInfo.group_name}不在,请重新选择${groupInfo.group_name}`, + showCancel: false, + confirmColor: '#4facfe', + success(res) { + if (res.confirm) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/position/community', + }) + } + } + }) + } + } + let notice_list = rdata.notice_list; + let slider_list = rdata.slider_list; + let index_lead_image = rdata.index_lead_image; + if(index_lead_image){ + status.getInNum().then((isCan)=>{ + if (isCan) { + that.setData({ isTipShow: true },()=>{ + timerOut = setTimeout(() => { that.setData({ isTipShow: false }) }, 9000); + }) + } + }) + } else { + that.setData({ isTipShow: false }) + } + + let common_header_backgroundimage = rdata.common_header_backgroundimage; + app.globalData.common_header_backgroundimage = common_header_backgroundimage; + let order_notify_switch = rdata.order_notify_switch; + let index_list_top_image_on = rdata.index_list_top_image_on; + let index_change_cate_btn = rdata.index_change_cate_btn || 0; + let default_img = '../../images/rush-title.png'; + // if (index_list_top_image_on == 1) default_img=''; + let index_list_top_image = rdata.index_list_top_image ? rdata.index_list_top_image : default_img; + let shop_info = { + shoname: rdata.shoname, + shop_index_share_image: rdata.shop_index_share_image, + index_list_top_image: index_list_top_image, + title: rdata.title, + common_header_backgroundimage, + order_notify_switch, + index_top_img_bg_open: rdata.index_top_img_bg_open || 0, + index_top_font_color: rdata.index_top_font_color || '#fff', + index_communityinfo_showtype: rdata.index_communityinfo_showtype || 0, + index_list_top_image_on + } + app.globalData.placeholdeImg = rdata.index_loading_image || ''; + let placeholdeImg = rdata.index_loading_image || ''; + + wcache.put('shopname', rdata.shoname); + wx.setNavigationBarTitle({ title: rdata.shoname }); + + let category_list = rdata.category_list || []; + let index_type_first_name = rdata.index_type_first_name || '全部'; + if (category_list.length > 0) { + category_list.unshift({ + name: index_type_first_name, + id: 0 + }) + that.setData({ + isShowClassification: true, + "classification.tabs": category_list + }) + } else { + that.setData({ + isShowClassification: false + }) + } + let theme = rdata.theme || 0; + let rushEndTime = rdata.rushtime*1000 || 0; + let isShowShareBtn = rdata.index_share_switch || 0; + let isShowListCount = rdata.is_show_list_count || 0; + let isShowListTimer = rdata.is_show_list_timer || 0; + let isShowContactBtn = rdata.index_service_switch || 0; + let index_switch_search = rdata.index_switch_search || 0; + let ishow_index_gotop = rdata.ishow_index_gotop || 0; + + if (rdata.is_comunity_rest == 1 && !that.data.needAuth) { + wx.showModal({ + title: '温馨提示', + content: `${groupInfo.owner_name}休息中,欢迎下次光临!`, + showCancel: false, + confirmColor: '#4facfe', + confirmText: '好的', + success(res) { } + }) + } + + that.postion = rdata.postion; + + //秒杀 + let { scekill_time_arr, seckill_bg_color, seckill_is_open, seckill_is_show_index, hide_community_change_word,index_qgtab_counttime, hide_index_type } = rdata; + let myDate = new Date(); + let curHour = myDate.getHours(); // 当前时间 + console.log('当前时间:', curHour); + let curSeckillIdx = 0; //当前时间索引 + let scekillTimeArr = []; //显示的时间段 + if (scekill_time_arr.length > 3) { + let timeLen = scekill_time_arr.length; + curSeckillIdx = scekill_time_arr.findIndex(item => { + return item >= curHour; + }); + console.log('当前时间索引:', curSeckillIdx) + //取三个时间段 + if (curSeckillIdx === -1) { + //没有进行或者未开始 取最后三个 + scekillTimeArr = scekill_time_arr.slice(-3); + } else if (curSeckillIdx === 0) { + //全部未开始 取最前三个 + scekillTimeArr = scekill_time_arr.slice(0, 3); + } else if ((curSeckillIdx + 1) == timeLen) { + //剩最后一个 取最后三个 + scekillTimeArr = scekill_time_arr.slice(-3); + } else { + scekillTimeArr = scekill_time_arr.slice(curSeckillIdx - 1, curSeckillIdx + 2); + } + } else { + scekillTimeArr = scekill_time_arr; + } + //判断各个时段状态 + let scekillTimeList = []; + let secKillActiveIdx = 0; + if(scekillTimeArr.length){ + scekillTimeArr.forEach((item, idx) => { + let secObj = {}; + //state: 0已开抢 1疯抢中 2即将开抢 + if (item == curHour) { + secObj.state = 1; + secObj.desc = '疯抢中'; + secKillActiveIdx = idx; + } else if (item < curHour) { + secObj.state = 0; + secObj.desc = '已开抢'; + } else { + secObj.state = 2; + secObj.desc = '即将开抢'; + } + secObj.timeStr = (item < 10 ? '0' + item : item) + ':00'; + secObj.timeArr = [item < 10 ? '0' + item : item, '00']; + secObj.seckillTime = item; + scekillTimeList.push(secObj); + }) + //获取当前秒杀商品 + that.getSecKillGoods(scekillTimeArr[secKillActiveIdx]); + } + + let index_video_arr = rdata.index_video_arr; + + // 预售信息 + let presale_index_info = rdata.presale_index_info || ''; + if(presale_index_info&&presale_index_info.goods_list) { + let goods_list = presale_index_info.goods_list; + let nowtime = Date.parse(new Date())/1000; + goods_list.forEach((item, idx)=>{ + let { presale_ding_money, actPrice, presale_deduction_money, presale_type, presale_ding_time_start_int, presale_ding_time_end_int } = item; + if(presale_type==0) { + presale_deduction_money = presale_deduction_money>0?presale_deduction_money:presale_ding_money; + let goodsPrice = (actPrice[0]+'.'+actPrice[1])*1; + presale_index_info.goods_list[idx].weikuan = (goodsPrice - presale_deduction_money*1).toFixed(2); + presale_ding_money = presale_ding_money.toFixed(2); + presale_index_info.goods_list[idx].dingArr = (presale_ding_money+'').split('.'); + presale_index_info.goods_list[idx].presale_deduction_money = presale_deduction_money; + } + let saleStatus = 1; //客付定金 0未开始 2已结束 + if(nowtimepresale_ding_time_end_int) { + saleStatus = 2; + } + presale_index_info.goods_list[idx].saleStatus = saleStatus; + }) + } + let isDiy = rdata.open_diy_index_page || 0; + wx.setStorageSync('is_diy', isDiy); + (isDiy==1)&&that.getDiyInfo(); + + // 礼品卡 + let virtualcard_info = rdata.virtualcard_info || ''; + if(virtualcard_info&&virtualcard_info.goods_list) { + var timestamp = Date.parse(new Date())/1000; + let newList = []; + if(Object.keys(virtualcard_info.goods_list).length) { + virtualcard_info.goods_list.forEach(item=>{ + (item.end_time { + this.loadPage(); + this.addhistory(); + }) + }, + + /** + * 关闭切换社区 + */ + closeChangeCommunity: function(){ + this.setData({ + showChangeCommunity: false + }) + }, + + /** + * 获取商品列表 + */ + load_goods_data: function() { + var token = wx.getStorageSync('token'); + var that = this; + var cur_community = wx.getStorageSync('community'); + var gid = that.data.classificationId; + this.$data.isLoadData = true; + console.log('load_goods_begin '); + + if (!that.hasRefeshin && !that.$data.loadOver) { + console.log('load_goods_in '); + this.hasRefeshin = true; + that.setData({ + loadMore: true + }); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_gps_goodslist', + token: token, + pageNum: that.data.pageNum, + head_id: cur_community.communityId, + gid, + per_page: 12 + }, + dataType: 'json', + success: function(res) { + if (that.data.pageNum == 1) { + that.setData({ cate_info: res.data.cate_info || {} }) + } + if (res.data.code == 0) { + let rushList = []; + if (res.data.is_show_list_timer==1) { + rushList = that.transTime(res.data.list); + for (let s in that.$data.countDownMap) that.initCountDown(that.$data.countDownMap[s]); + } else { + rushList = that.data.rushList; + rushList[that.data.pageNum-1] = res.data.list; + } + let rdata = res.data; + let { full_money, full_reducemoney, is_open_fullreduction, is_open_vipcard_buy, is_vip_card_member, is_member_level_buy } = rdata; + let reduction = { full_money, full_reducemoney, is_open_fullreduction } + + // 是否可以会员折扣购买 + let canLevelBuy = false; + if (is_open_vipcard_buy == 1) { + if (is_vip_card_member != 1 && is_member_level_buy == 1) canLevelBuy = true; + } else { + (is_member_level_buy == 1) && (canLevelBuy = true); + } + + if (that.data.pageNum==1) that.setData({ copy_text_arr: rdata.copy_text_arr || [] }) + that.hasRefeshin = false; + that.setData({ + rushList: rushList, + pageNum: that.data.pageNum + 1, + loadMore: false, + reduction, + tip: '', + is_open_vipcard_buy: is_open_vipcard_buy || 0, + is_vip_card_member, + is_member_level_buy, + canLevelBuy + }, ()=>{ + if (that.isFirst == 1) { + that.isFirst++; + } + if (rushList.length && !that.$data.stickyTop) { + wx.createSelectorQuery().select(".tab-nav-query").boundingClientRect(function (t) { + if (t && t.top){ + wcache.put('tabPos', t); + that.$data.stickyTop = t.top + t.height, that.$data.stickyBackTop = t.top; + } else { + let tabpos = wcache.get('tabPos', false); + if (tabpos) that.$data.stickyTop = tabpos.top + tabpos.height, that.$data.stickyBackTop = tabpos.top; + } + }).exec(); + that.$data.scrollTop > that.$data.stickyTop && wx.pageScrollTo({ + duration: 0, + scrollTop: that.$data.stickyTop + 4 + }); + } + that.getScrollHeight(); + + if (that.data.pageNum == 2 && res.data.list.length < 10) { + console.log('load_over_goods_list_begin') + that.$data.loadOver = true; + that.hasRefeshin = true; + that.setData({ + loadMore: true + }, () => { + that.load_over_gps_goodslist(); + }); + } + }); + } else if (res.data.code == 1) { + that.$data.loadOver = true; + that.load_over_gps_goodslist(); + } else if (res.data.code == 2) { + //no login + that.setData({ needAuth: true, couponRefresh: false }) + } + }, + complete: function() { + that.$data.isLoadData = false; + // wx.hideLoading(); + setTimeout(function(){ wx.hideLoading(); },1000); + } + }) + } else { + that.load_over_gps_goodslist(); + } + }, + + /** + * 组合倒计时时间 + */ + transTime: function(list) { + let that = this; + let e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; + e === 0 && list.map(function(t) { + t.end_time *= 1000; + that.$data.countDownMap[t.end_time] = t.end_time, that.$data.actEndMap[t.end_time] = t.end_time <= new Date().getTime() || t.spuCanBuyNum == 0; + }) + let rushList = that.data.rushList; + let idx = that.data.pageNum+that.$data.overPageNum-2; + rushList[idx] = list; + return rushList; + // return that.data.rushList.concat(list); + }, + + /** + * 获取售罄商品 + */ + load_over_gps_goodslist: function() { + var token = wx.getStorageSync('token'); + var that = this; + var cur_community = wx.getStorageSync('community'); + var gid = that.data.classificationId; + + if (!that.$data.hasOverGoods && that.$data.loadOver) { + that.$data.hasOverGoods = true; + that.setData({ + loadMore: true + }); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_over_gps_goodslist', + token: token, + pageNum: that.$data.overPageNum, + head_id: cur_community.communityId, + gid, + is_index_show: 1 + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let rushList = that.transTime(res.data.list); + for (let s in that.$data.countDownMap) that.initCountDown(that.$data.countDownMap[s]); + + that.$data.hasOverGoods = false; + that.$data.overPageNum += 1; + that.setData({ + rushList: rushList, + loadMore: false, + tip: '' + }, ()=>{ + if (that.isFirst == 1) { + that.isFirst++; + if (rushList.length && !that.$data.stickyTop) { + wx.createSelectorQuery().select(".tab-nav-query").boundingClientRect(function (t) { + if (t && t.top) { + wcache.put('tabPos', t); + that.$data.stickyTop = t.top + t.height, that.$data.stickyBackTop = t.top; + } else { + let tabpos = wcache.get('tabPos', false); + if (tabpos) that.$data.stickyTop = tabpos.top + tabpos.height, that.$data.stickyBackTop = tabpos.top; + } + }).exec(); + that.$data.scrollTop > that.$data.stickyTop && wx.pageScrollTo({ + duration: 0, + scrollTop: that.$data.stickyTop + 4 + }); + } + that.getScrollHeight(); + } + }); + } else if (res.data.code == 1) { + if (that.$data.overPageNum == 1 && that.data.rushList.length == 0) that.setData({ + showEmpty: true + }) + that.setData({ + loadMore: false, + tip: '^_^已经到底了' + }) + } else if (res.data.code == 2) { + that.setData({ needAuth: true, couponRefresh: false }) + } + that.$data.isLoadData = false; + } + }) + } else { + that.$data.isLoadData = false; + } + }, + + /** + * 监控分类导航 + */ + classificationChange: function(t, autoScroll=0) { + console.log(t.detail.e) + wx.showLoading(); + var that = this; + this.$data = {...this.$data, ...{ + overPageNum: 1, + loadOver: false, + hasOverGoods: false, + countDownMap: {}, + actEndMap: {}, + timer: {} + } + }, this.hasRefeshin = false, this.setData({ + rushList: [], + showEmpty: false, + pageNum: 1, + "classification.activeIndex": t.detail.e, + classificationId: t.detail.a + }, function() { + if ((this.$data.stickyFlag && (that.$data.scrollTop != that.$data.stickyTop+5)) || autoScroll){ + console.log('滚动了') + let windowWidth = app.globalData.systemInfo && app.globalData.systemInfo.windowWidth || 375; + let taBH = windowWidth/750*72; + wx.pageScrollTo({ scrollTop: that.$data.stickyTop - taBH, duration: 0 }) + } + that.load_goods_data(); + }); + }, + + /** + * 监控即将抢购分类导航 + */ + commingClassificationChange: function (t) { + wx.showLoading(); + var that = this; + that.tpage = 1; + this.$data = {...this.$data, ...{hasCommingGoods: true} }, + this.setData({ + showCommingEmpty: false, + commingList: [], + "commingClassification.activeIndex": t.detail.e, + commingClassificationId: t.detail.a + }, function () { + if (this.$data.stickyFlag && (that.$data.scrollTop != that.$data.stickyTop + 5)) { + wx.pageScrollTo({ scrollTop: that.$data.stickyTop + 5, duration: 0 }) + } + that.getCommingList(); + }); + }, + + // 抢购切换 + tabSwitch: function (t) { + var that = this; + var tabIdx = 1 * t.currentTarget.dataset.idx; + this.setData({ tabIdx: tabIdx }, ()=>{ + if (tabIdx == 1) { + if (that.$data.stickyFlag && (that.$data.scrollTop != that.$data.stickyTop + 5)) { + wx.pageScrollTo({ scrollTop: that.$data.stickyTop + 5, duration: 0 }) + } + if (that.tpage == 1) { + that.getCommingList(); + } + } + }) + }, + + /** + * 即将开抢列表 + */ + getCommingList: function(){ + this.data.commigLoadMore && wx.showLoading(); + var token = wx.getStorageSync('token'); + var that = this; + var cur_community = wx.getStorageSync('community'); + var gid = this.data.commingClassificationId || 0; + that.$data.isLoadData = true; + + if (that.$data.hasCommingGoods) { + that.$data.hasCommingGoods = false; + that.setData({ commigLoadMore: true }); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_comming_goodslist', + token: token, + pageNum: that.tpage, + head_id: cur_community.communityId, + gid + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + let commingList = res.data.list; + commingList = that.data.commingList.concat(commingList); + that.$data.hasCommingGoods = true; + that.tpage += 1; + that.setData({ + commingList: commingList, + commigLoadMore: false, + commigTip: '' + },()=>{ + that.getScrollHeight(); + }); + } else if (res.data.code == 1) { + if (that.tpage == 1 && that.data.commingList.length == 0) that.setData({ + showCommingEmpty: true + }) + that.setData({ + commigLoadMore: false, + commigTip: '^_^已经到底了' + }) + } else if (res.data.code == 2) { + that.setData({ needAuth: true, couponRefresh: false }) + } + that.$data.isLoadData = false; + } + }) + } else{ + that.$data.isLoadData = false; + !that.data.commigLoadMore && wx.hideLoading(); + } + }, + + /** + * 返回顶部 + */ + backTop: function() { + this.stickyFlag = false, wx.pageScrollTo({ + scrollTop: 0, + duration: 500 + }); + }, + + goLink: function(event) { + let url = event.currentTarget.dataset.link; + let needauth = event.currentTarget.dataset.needauth || ''; + console.log(needauth) + if(needauth){ if (!this.authModal()) return; } + url && wx.navigateTo({ url }) + }, + + /** + * 导航小图标 + */ + getNavigat: function(){ + let that = this; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_navigat' + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let navigat = res.data.data || []; + let navigatEmpty = []; + let navigatSwiper = {page: 1, current:0, totnav: 0}; + let chunks = []; + if (navigat.length>0) { + let len = (5-navigat.length%5) || 0; + if(len<5&&len>0) navigatEmpty = new Array(len); + for(let i=0;i 0) { + let url = navigat[idx].link; + let type = navigat[idx].type; + if(util.checkRedirectTo(url, needAuth)){ + this.authModal(); + return; + } + if (type== 0){ + // 跳转webview + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/web-view?url=' + encodeURIComponent(url), + }) + } else if (type==1) { + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + wx.switchTab({ url: url }) + } else { + wx.navigateTo({ url: url }) + } + } else if (type==2){ + // 跳转小程序 + let appid = navigat[idx].appid; + appid && wx.navigateToMiniProgram({ + appId: navigat[idx].appid, + path: url, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if (type == 3){ + //首页分类 + // t.detail.e 选中索引 + // t.detail.a 选中id + let classification = this.data.classification; + let tabs = classification && classification.tabs; + let cid = url; + let activeIdx = tabs.findIndex((p) => { return p.id == cid }); + if (activeIdx!=-1) { + let cateInfo = { + detail: { e: activeIdx, a: cid } + }; + this.classificationChange(cateInfo, 1); + } else { + wx.showToast({ + title: '分类不存在或已关闭', + icon: 'none' + }) + } + } else if (type == 4) { + //独立分类 + app.globalData.typeCateId = url; + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/type/index' + }) + } else if (type == 6) { + //领券 + let url = navigat[idx].link; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/moduleA/coupon/getCoupon?id='+url + }) + } + } + }, + + /** + * 幻灯片跳转 + */ + goBannerUrl: function (t) { + let idx = t.currentTarget.dataset.idx; + let { slider_list, needAuth } = this.data; + if (slider_list.length > 0) { + let url = slider_list[idx].link; + let type = slider_list[idx].linktype; + if (util.checkRedirectTo(url, needAuth)) { + this.authModal(); + return; + } + if (type == 0) { + // 跳转webview + url && wx.navigateTo({ url: '/eaterplanet_ecommerce/pages/web-view?url=' + encodeURIComponent(url) }) + } else if (type == 1) { + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + url && wx.switchTab({ url: url }) + } else { + url && wx.navigateTo({ url: url }) + } + } else if (type == 2) { + // 跳转小程序 + let appid = slider_list[idx].appid; + appid && wx.navigateToMiniProgram({ + appId: slider_list[idx].appid, + path: url, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if (type == 6) { + //领券 + wx.navigateTo({ + url: '/eaterplanet_ecommerce/moduleA/coupon/getCoupon?id='+url + }) + } + } + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.setData({ couponRefresh: false, newComerRefresh: false, stopNotify: true }); + this.tpage = 1; + this.$data = { + ...this.$data, ...{ + overPageNum: 1, + loadOver: false, + hasOverGoods: false, + countDownMap: {}, + actEndMap: {}, + timer: {}, + stickyFlag: false, + hasCommingGoods: true + } + } + this.hasRefeshin = false; + this.setData({ + rushList: [], + commingList: [], + tabIdx: 0, + pageNum: 1, + couponRefresh: true, + newComerRefresh: true, + stopNotify: false, + rushEndTime: 0, + diyLoaded: false + }, ()=>{ + this.loadPage(); + }) + wx.stopPullDownRefresh(); + }, + + onReachBottom: function(e) { + if(this.data.ishide_index_goodslist==1||this.data.isDiy==1) return; + if (this.data.tabIdx==0){ + this.load_goods_data(); + } else { + this.getCommingList(); + } + }, + + /** + * 获取团长位置 + */ + getCommunityPos: function (community_id){ + let that = this; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'index.get_community_position', + communityId: community_id + }, + dataType: 'json', + method: 'POST', + success: function (res) { + if (res.data.code == 0) { + that.postion = res.data.postion; + } + } + }) + }, + + /** + * 查看地图 + */ + gotoMap: function () { + let community = this.data.community; + let postion = this.postion || {lat: 0, lon: 0}; + let longitude = parseFloat(postion.lon), + latitude = parseFloat(postion.lat), + name = community.disUserName, + address = `${community.fullAddress}(${community.communityName})`; + wx.openLocation({ + latitude: latitude, + longitude: longitude, + name: name, + address: address, + scale: 28 + }) + }, + + share_handler: function () { + this.setData({ + is_share_html: false + }) + }, + + hide_share_handler: function () { + this.setData({ + is_share_html: true + }) + }, + + // 搜索 + goResult: function (e) { + let value = e.detail.value.keyword ? e.detail.value.keyword : e.detail.value; + let keyword = value.replace(/\s+/g, ''); + if (!keyword) { + wx.showToast({ + title: '请输入关键词', + icon: 'none' + }) + return; + } + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?keyword=' + keyword, + }) + }, + + /** + * 新人优惠券显示开关 + */ + toggleCoupon: function(e){ + let auth = e.currentTarget.dataset.auth || ''; + let needAuth = this.data.needAuth || ''; + if(needAuth && auth) { + this.setData({ + showAuthModal: true, + showCouponModal: false + }) + } else { + this.setData({ + showCouponModal: !this.data.showCouponModal, + hasAlertCoupon: false + }) + } + }, + + changeCartNum: function(t) { + let that = this; + let e = t.detail; + (0, status.cartNum)(that.setData({ cartNum: e })); + }, + + /** + * 一键复制文本 + */ + copyText: function (e) { + let copy_text_arr = this.data.copy_text_arr; + let community = this.data.community; + let communityName = community.communityName; + let disUserName = community.disUserName; + let communityAddress = community.address || community.communityAddress || community.fullAddress; + let data = '-团长信息-\r\n小区:' + communityName + '\r\n团长:' + disUserName + '\r\n自提点:' + communityAddress + '\r\n\r\n今日推荐\r\n'; + if (copy_text_arr.length) { + copy_text_arr.forEach(function(item, index){ + data += (index + 1) + '.【' + item.goods_name + '】 团购价' + item.price + '\r\n'; + data += '~~~~~~~~~~~~~~~~~~~~\r\n'; + }) + } + let that = this; + wx.setClipboardData({ + data: data, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + that.setData({ showCopyText: false }) + wx.showToast({ + title: '复制成功' + }) + } + }) + } + }) + }, + + /** + * 显示关闭复制文本 + */ + showCopyTextHandle: function(e){ + if (!this.authModal()) return; + let showCopyText = e.currentTarget.dataset.status; + this.setData({ showCopyText }) + }, + + /** + * 优惠券获取 + */ + getCoupon: function () { + let that = this; + let token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { controller: 'goods.get_seller_quan', token }, + dataType: 'json', + success: function (res) { + let list = res.data.quan_list; + let hasCoupon = false; + let hasAlertCoupon = false; + if (Object.prototype.toString.call(list) == '[object Object]' && Object.keys(list).length > 0) hasCoupon = true; + if (Object.prototype.toString.call(list) == '[object Array]' && list.length > 0) hasCoupon = true; + + let alert_quan_list = res.data.alert_quan_list || []; + if (Object.prototype.toString.call(alert_quan_list) == '[object Object]' && Object.keys(alert_quan_list).length > 0) hasAlertCoupon = true; + if (Object.prototype.toString.call(alert_quan_list) == '[object Array]' && alert_quan_list.length > 0) hasAlertCoupon = true; + + let totalAlertMoney = 0; + if (Object.prototype.toString.call(alert_quan_list) == '[object Object]' && Object.keys(alert_quan_list).length > 0) { + Object.keys(alert_quan_list).forEach(function(item){ + totalAlertMoney += alert_quan_list[item].credit*1; + }) + } else if (Object.prototype.toString.call(alert_quan_list) == '[object Array]' && alert_quan_list.length > 0) { + alert_quan_list.forEach(function (item) { + totalAlertMoney += item.credit * 1; + }) + } + + that.setData({ + quan: res.data.quan_list || [], + alert_quan_list, + hasCoupon, + hasAlertCoupon, + showCouponModal: hasAlertCoupon, + totalAlertMoney: totalAlertMoney.toFixed(2) + }) + } + }); + }, + + receiveCoupon: function (event) { + if (!this.authModal()) return; + let quan_id = event.currentTarget.dataset.quan_id; + let type = event.currentTarget.dataset.type || 0; + var token = wx.getStorageSync('token'); + var quan_list = []; + if(type==1) { + quan_list = this.data.alert_quan_list; + } else { + quan_list = this.data.quan; + } + var that = this; + + app.util.request({ + url: 'entry/wxapp/index', + data: { controller: 'goods.getQuan', token, quan_id }, + dataType: 'json', + success: function (msg) { + //1 被抢光了 2 已领过 3 领取成功 + if (msg.data.code == 0) { + wx.showToast({ + title: msg.data.msg || '被抢光了', + icon: 'none' + }) + } else if (msg.data.code == 1) { + wx.showToast({ + title: '被抢光了', + icon: 'none' + }) + } else if (msg.data.code == 2) { + wx.showToast({ + title: '已领取', + icon: 'none' + }) + var new_quan = []; + for (var i in quan_list) { + if (quan_list[i].id == quan_id) quan_list[i].is_get = 1; + new_quan.push(quan_list[i]); + } + that.setData({ quan: new_quan }) + } + else if (msg.data.code == 4) { + wx.showToast({ + title: '新人专享', + icon: 'none' + }) + } + else if (msg.data.code == 3) { + var new_quan = []; + for (var i in quan_list) { + if (quan_list[i].id == quan_id){ + quan_list[i].is_get = 1; + quan_list[i].is_hide = msg.data.is_hide; + } + new_quan.push(quan_list[i]); + } + if(type==1) { + that.setData({ alert_quan_list: new_quan }) + } else { + that.setData({ quan: new_quan }) + } + wx.showToast({ + title: '领取成功', + }) + } else if (msg.data.code == 4) { + // 未登录 + } + } + }) + }, + + goUse: function (e) { + this.setData({ showCouponModal: false, hasAlertCoupon: false }) + let idx = e.currentTarget.dataset.idx; + let quan = this.data.alert_quan_list || []; + console.log(Object.keys(quan).length) + if (Object.keys(quan).length >= idx) { + if (quan[idx].is_limit_goods_buy == 0) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } else if (quan[idx].is_limit_goods_buy == 1) { + let id = quan[idx].limit_goods_list; + let ids = id.split(','); + let url = ''; + if (ids.length > 1) { + url = '/eaterplanet_ecommerce/pages/type/result?type=2&good_ids=' + id; + } else { + url = '/eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + id; + } + wx.navigateTo({ url: url }) + } else if (quan[idx].is_limit_goods_buy == 2) { + let gid = quan[idx].goodscates || 0; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?type=1&gid=' + gid, + }) + } + } + }, + + /** + * 分类专题 + */ + get_type_topic: function () { + let that = this; + var cur_community = wx.getStorageSync('community'); + var token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'goods.get_category_col_list', + head_id: cur_community.communityId, + token + }, + dataType: 'json', + success: function (res) { + if(res.data.code == 0) { + let typeTopicList = res.data.data || []; + that.setData({ typeTopicList }) + } + } + }) + }, + + /** + * 拼团列表 + */ + getPinList: function () { + let that = this; + var community = wx.getStorageSync('community'); + let head_id = community.communityId || ''; + var token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'group.get_pintuan_list', + is_index: 1, + head_id, + token + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let pinList = {}; + let { list, pintuan_index_coming_img, pintuan_index_show } = res.data; + pinList.list = list || []; + pinList.img = pintuan_index_coming_img || ''; + pinList.show = pintuan_index_show || 0; + that.setData({ pinList }) + } + } + }) + }, + + /** + * 魔方图标跳转 + */ + goCube: function (t) { + let idx = t.currentTarget.dataset.idx; // 当前链接索引 + let index = t.currentTarget.dataset.index; // 当前魔方索引 + let { cube, needAuth } = this.data; + console.log(cube) + if (cube.length > 0) { + let url = cube[index].thumb.link[idx]; + let url2 = cube[index].thumb.outlink[idx]; + let type = (cube[index].thumb.linktype && cube[index].thumb.linktype[idx]); + (type === (void 0)) && (type = 1); + if (util.checkRedirectTo(url, needAuth)) { + this.authModal(); + return; + } + if (type == 0) { + // 跳转webview + url = cube[index].thumb.webview[idx]; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/web-view?url=' + encodeURIComponent(url) + }) + } else if (type == 1) { + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + url && wx.switchTab({ + url, + fail: (err)=>{ + wx.showToast({ + title: err.errMsg, + icon: 'none' + }) + } + }) + } else { + url && wx.navigateTo({ + url, + fail: (err)=>{ + wx.showToast({ + title: err.errMsg, + icon: 'none' + }) + } + }) + } + } else if (type == 2) { + // 跳转小程序 + let appid = navigat[idx].appid; + appid && wx.navigateToMiniProgram({ + appId: navigat[idx].appid, + path: url, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if (type == 3) { + let cid = cube[index].thumb.cateid[idx]; + this.goIndexType(cid); + } else if (type == 4) { + //独立分类 + let url = cube[index].thumb.cateid[idx]; + app.globalData.typeCateId = url; + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/type/index' + }) + }else if (type==5){ + // 跳转小程序 + let appid = cube[index].thumb.appid[idx]; + appid && wx.navigateToMiniProgram({ + appId: appid, + path: url2, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if (type == 6) { + //领券 + wx.navigateTo({ + url: '/eaterplanet_ecommerce/moduleA/coupon/getCoupon?id='+url + }) + } + } + }, + + goIndexType: function(cid){ + if(cid.detail) { + cid = cid.detail; + } + let classification = this.data.classification; + let tabs = classification && classification.tabs; + let activeIdx = tabs.findIndex((p) => { return p.id == cid }); + if (activeIdx != -1) { + let cateInfo = { + detail: { e: activeIdx, a: cid } + }; + this.classificationChange(cateInfo, 1); + } + }, + + getSecKillGoods: function (seckill_time){ + var that = this; + var cur_community = wx.getStorageSync('community'); + var token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_gps_goodslist', + token: token, + pageNum: 1, + head_id: cur_community.communityId, + seckill_time, + is_seckill: 1, + per_page: 10000 + }, + dataType: 'json', + success: function (res) { + if(res.data.code==0) { + let secRushList = res.data.list || []; + that.setData({ secRushList }) + } + } + }) + }, + + scrollSecKillGoodsChange: function (t) { + this.setData({ + secKillGoodsIndex: t.detail.current + 1 + }); + }, + + /** + * 显示秒杀时间切换 + */ + changeSecKillTime(t){ + let that = this; + let seckill_time = t.currentTarget.dataset.time; + let secKillActiveIdx = t.currentTarget.dataset.idx; + this.setData({ + secRushList: [], + secKillActiveIdx + }, ()=>{ + that.getSecKillGoods(seckill_time); + }) + }, + + /** + * 图片信息 + */ + imageLoad: function (e) { + var imageSize = util.imageUtil(e) + this.setData({ + imageSize + }) + }, + + /** + * 播放视频隐藏封面图 + */ + btnPlay: function () { + this.setData({ + fmShow: false + }) + this.videoContext.play(); + }, + + videEnd: function () { + this.setData({ + fmShow: true + }) + }, + + bindload: function(t){ + console.log(t.detail) + }, + + binderror: function(t){ + this.setData({ hideMpAccount: true }) + console.log(t.detail) + }, + + closeMpaccount: function(){ + this.setData({ show_index_wechat_oa: 0 }) + }, + + showNoticeTextHandle: function(e){ + if(this.data.can_index_notice_alert==1) { + let showNoticeText = e.currentTarget.dataset.status; + let noticeIdx = e.currentTarget.dataset.idx; + this.setData({ showNoticeText, noticeIdx }) + } + }, + + /** + * DIY公用链接跳转 + */ + goDiysliderUrl: function(t) { + let link = t.currentTarget.dataset.link; + let needAuth = this.data.needAuth; + + if (Object.keys(link).length > 0) { + let type = link.parents; + if (util.checkRedirectTo(link.wap_url, needAuth)) { + this.authModal(); + return; + } + switch(type) { + case "WEBVIEW": + let url = link.wap_url; + url && wx.navigateTo({ url: '/eaterplanet_ecommerce/pages/web-view?url=' + encodeURIComponent(url) }); + break; + case "MALL_LINK": + url = link.wap_url; + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + url && wx.switchTab({ url }) + } else { + url && wx.navigateTo({ url }) + } + break; + case "OTHER_APPLET": + // 跳转小程序 + let appId = link.appid; + let path = link.wap_url; + appId && wx.navigateToMiniProgram({ + appId, + path, + extraData: {}, + envVersion: 'release', + success(res) {}, + fail(error) { wx.showModal({ title: "提示", content: error.errMsg, showCancel: false }) } + }) + break; + case "CUSTOM_LINK": + url = link.wap_url; + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + url && wx.switchTab({ url }) + } else { + url && wx.navigateTo({ url }) + } + break; + case "GOODS_CATEGORY": + //独立分类 + let cateId = link.id; + app.globalData.typeCateId = cateId; + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/type/index' + }) + break; + default: + url = link.wap_url; + url && wx.navigateTo({ url }) + break; + } + } + }, + + /** + * DIY商品列表组获取 + */ + getDiyGoodsList(res) { + console.log('getDiyGoodsList', res) + let data = res.detail.data; + let idx = res.detail.id; + let diyGoodsList = []; + let is_open_vipcard_buy = 0; + if(data.code==0) { + let resGoodsList = data.list; + if (data.is_show_list_timer==1&&resGoodsList.length>0) { + diyGoodsList = this.transTime(resGoodsList); + for (let s in this.$data.countDownMap) this.initCountDown(this.$data.countDownMap[s]); + } else { + diyGoodsList[0] = resGoodsList; + } + is_open_vipcard_buy = data.is_open_vipcard_buy; + } + let list = this.data.diyGoodsList; + list[idx] = diyGoodsList; + this.setData({ diyGoodsList: list, is_open_vipcard_buy }) + }, + + getDiyManyGoodsList(res) { + let data = res.detail.data; + let list = []; + if(data.code==0) { + let resGoodsList = data.list; + if (data.is_show_list_timer==1&&resGoodsList.length>0) { + list = this.transTime(resGoodsList); + for (let s in this.$data.countDownMap) this.initCountDown(this.$data.countDownMap[s]); + } else { + list[0] = resGoodsList; + } + } + + this.setData({ diyManyGoodsList: list }) + }, + + /** + * DIY数据 + */ + getDiyInfo: function() { + app.util.ProReq('index.get_diy_info').then(res => { + console.log(res.global) + let { diyJson, global } = res; + global.title && wx.setNavigationBarTitle({ title: global.title }); + wx.setNavigationBarColor({ + backgroundColor: global.topNavColor, + frontColor: global.textNavColor, + }) + let diyGoodsList = Array.from(Array(diyJson.length), () => ''); + this.setData({ + diyJson, globalDiyData: global, diyGoodsList, diyLoaded: true + }) + }) + }, + + onShareAppMessage: function(res) { + this.setData({ is_share_html: true }); + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + var member_id = wx.getStorageSync('member_id'); + console.log('首页分享地址:'); + console.log(community_id, member_id); + return { + title: this.data.shop_info.title, + path: "eaterplanet_ecommerce/pages/index/index?community_id=" + community_id + '&share_id=' + member_id, + imageUrl: this.data.shop_info.shop_index_share_image, + success: function() {}, + fail: function() {} + }; + }, + + onShareTimeline: function(res) { + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + var share_id = wx.getStorageSync('member_id'); + var query= `share_id=${share_id}&community_id=${community_id}`; + return { + title: this.data.shop_info.title, + query, + imageUrl: this.data.shop_info.shop_index_share_image, + success: function() {}, + fail: function() {} + }; + } +}) diff --git a/eaterplanet_ecommerce/pages/index/index.json b/eaterplanet_ecommerce/pages/index/index.json new file mode 100644 index 0000000..3a34378 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/index.json @@ -0,0 +1,41 @@ +{ + "enablePullDownRefresh": true, + "backgroundTextStyle": "light", + "navigationBarTextStyle": "white", + "backgroundColor": "#4d9ee9", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-tabbar": "../../components/tabbar/index", + "i-router-link": "../../components/router-link/router-link", + "i-rush-spu-big": "../../components/rush-spu-big/index", + "i-comming-spu": "../../components/comming-spu-disabled/index", + "i-img": "../../components/img/index", + "i-sku": "../../components/sku/index", + "i-count-down": "../../components/count-down/index", + "i-load-more": "../../components/load-more/index", + "i-tabs": "../../components/tabs/index", + "i-modal": "../../components/modal/index", + "i-order-notify": "../../components/order-notify/index", + "i-new-rush-spu": "../../components/new-rush-spu/index", + "i-new-comer": "../../components/new-comer/index", + "i-spike": "../../components/spike/index", + "i-topic": "../../components/topic/topic", + "i-new-auth": "../../components/new-auth/index", + "i-change-community": "../../components/changeCommunity/index", + "i-rush-spu": "../../components/rush-spu-col/index", + "i-seckill-spu": "../../components/seckillItem/seckillItem", + "i-vip-price": "../../components/vipPrice/vipPrice", + "i-vip-modal": "../../components/vipModal/index", + "i-tworow": "../../components/tworow/index", + "skeleton": "../../components/skeleton/skeleton", + "ad-alert": "../../components/ad-alert/index", + "advimg": "../../components/advimg/index", + "form-apply": "../../components/form/apply", + "parser":"../../components/parser/parser", + "diy-goods-list":"../../components/diy-goods-list/index", + "diy-many-goods-list":"../../components/diy-many-goods-list/index", + "diy-pintuan":"../../components/diy-pintuan/index", + "i-empty":"../../components/empty/index", + "diy-nav":"../../components/diy-nav/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/index.wxml b/eaterplanet_ecommerce/pages/index/index.wxml new file mode 100644 index 0000000..0e22325 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/index.wxml @@ -0,0 +1,553 @@ + + + + + + + + + + + + + + + + + + + + 添加到「我的小程序」团购更方便 + + + + + + + + + + + + + + + + + + {{community.communityName}} + 切换 + + + + + + {{community.communityName}} + + + + {{community.address||community.communityAddress||community.fullAddress}} + + + + + 您还没有选择{{groupInfo.owner_name}},轻触去选择 + + + + + {{community.disUserName}} + + + + + + + {{community.communityName}} 切换 + + {{community.communityName}} + + + + + + + 您还没有选择{{groupInfo.owner_name}},轻触去选择 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 查看全部 + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + {{index_qgtab_text[0]?index_qgtab_text[0]:'正在抢购'}} + + + + + {{index_qgtab_text[1]?index_qgtab_text[1]:'即将开抢'}} + + + + + 仅剩 + + + + + + + + + + + + + + + + + + + + + + 仅剩 + {{countDownMap[item.end_time].day}}天 + {{countDownMap[item.end_time].hour}}: + {{countDownMap[item.end_time].minute}}: + {{countDownMap[item.end_time].second}} + + + + + + + + + + + + + + 仅剩 + {{countDownMap[item.end_time].day}}天 + {{countDownMap[item.end_time].hour}}: + {{countDownMap[item.end_time].minute}}: + {{countDownMap[item.end_time].second}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 本类商品暂时没有了哦 + 我们正在为您加紧准备中 + + + + + + + + + 本类商品暂时没有了哦 + 我们正在为您加紧准备中 + + + + + + + + + + +
+ + + + + + + 一键复制 + + + + + 分享 + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 暂无商品~ + + + + + + + + + + + + + + + + + + + + 恭喜你获得{{totalAlertMoney}}元红包券 + + + + + ¥{{item.credit}} + + + {{item.voucher_title}} + 满{{item.limit_money}}元可用 + 使用范围:所有商品 + 使用范围:指定商品 + 使用范围:指定分类 + + + 去使用 + + + + + + 立即使用 + + + + + + + + + + +
+ + + + + 您已被禁止访问 + 请联系管理员 + + + + + + + + + + + + + + + + + + + + + + - {{groupInfo.owner_name}}信息 - + + + 小区:{{community.communityName}} + {{groupInfo.owner_name}}:{{community.disUserName}} + 自提点:{{community.address||community.communityAddress||community.fullAddress}} + 今日推荐 + + + {{index+1}}. 【{{item.goods_name}}】 团购价{{item.price}}元 + + + 一键复制 + + + + + + + + + + + + + + + + - 公告 - + + + + + {{notice_list[noticeIdx].content}} + + + + + +
+
\ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/index.wxss b/eaterplanet_ecommerce/pages/index/index.wxss new file mode 100644 index 0000000..be0dcf8 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/index.wxss @@ -0,0 +1,2075 @@ +@charset "UTF-8"; +@import "template/pinrow.wxss"; +@import "template/pin.wxss"; +@import "template/cube.wxss"; +@import "template/seckill.wxss"; +@import "template/video.wxss"; +@import "template/navlist.wxss"; +@import "template/presalerow.wxss"; +@import "floatBtn.wxss"; +@import "cube.wxss"; +@import "search.wxss"; +@import "coupon.wxss"; +@import "diySeckill.wxss"; + +page { + background-color: #f6f6f6!important; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +window { + background: #4d9ee9; +} + +.header-bg{ + position: absolute; + width: 100vw; + height: 100vh; + z-index: 2; +} +movable-view { + +width: 110rpx; +height: 110rpx; +top: 0; +left: 0; +position: absolute; + +} + +movable-area { + height: 100%; + width: 100%; + margin: 0rpx; + + +} + +.mt120 { + margin-top: 120rpx; +} + +.swipe { + background-color: linear-gradient(90deg,#007FAF 0%,#42ADD5 100%); + height: 240rpx; + margin-bottom: 0rpx; + margin-top: -20rpx; + z-index: 3; + position: relative; +} + +.swiper-content { + width: 750rpx; + height: 260rpx; + margin-top: 0rpx; + padding-top:0rpx; + padding-bottom: 20rpx; + +} + +.swiper-content swiper-item { + border-radius: 20rpx; + margin-right: 20rpx; + + display: flex; + justify-content: flex-start; + padding-top: 20rpx; + padding-bottom: 0rpx; +} + +.swiper-content swiper-item:last-child { + margin: 0; +} + +.swiper-content .banner { + width: 710rpx; + height: 200rpx; + margin: 0 20rpx; + display: block; + border-radius: 20rpx; + position: relative; + overflow: hidden; + /**box-shadow: 0 10rpx 20rpx rgba(0,0,0,0.3);**/ + filter: drop-shadow(0 10rpx 15rpx rgb(0, 0, 0, 0.3)); + + +} + +.swiper-content .banner .banner-img { + width: 710rpx; + height: 200rpx; + border-radius: 20rpx; + display: block; + overflow: hidden; + + +} + +.active-item { + position: relative; + width: 750rpx; + min-height: 288rpx; + margin-bottom: 10rpx; +} + +.active-item .list-item-tag-content { + position: absolute; + left: 300rpx; + top: 0; + z-index: 9; + display: flex; + flex-direction: column; + align-items: flex-start; + padding-top: 20rpx; + pointer-events: none; +} + +.active-item .list-item-tag-content .empty-1 { + height: 32rpx; + width: 400rpx; + margin-bottom: 12rpx; + margin-top: 10rpx; +} + +.active-item .list-item-tag-content .empty-2 { + font-size: 20rpx; + width: 400rpx; + height: 26rpx; + margin-bottom: 12rpx; +} + +.active-item .list-item-tag-content .list-item-count-down { + white-space: nowrap; + height: 16rpx; + border-radius: 28rpx; + color: #ff758c; + text-align: center; + font-size: 20rpx; + line-height: 24rpx; + padding-left: 20rpx; + display: flex; + justify-content: center; + align-items: center; + margin-right: 8rpx; + font-weight: 500; +} + +.active-item .list-item-tag-content .list-item-count-down em { + margin: 0 4rpx 0 0; +} + +.active-item .list-item-tag-content .list-item-count-down span { + margin: 0; +} + +.active-item .list-item-tag-content .tag { + width: 52rpx; + height: 22rpx; + font-size: 20rpx; + border: 1rpx solid #4facfe; + color: #4facfe; + margin-right: 8rpx; + line-height: 22rpx; + border-radius: 22rpx; + white-space: nowrap; + display: flex; + justify-content: center; + align-items: center; + vertical-align: middle; +} + +.active-item .list-item-tag-content .tag.hidden { + display: none; +} + +.active-item .list-item-tag-content .tag-green { + color: #4ab089; + border-color: #4ab089; +} + +.goods-skeleton-content { + position: relative; + z-index: 1; +} + +.goods-skeleton-content .goods-skeleton-slogan-top-msg { + width: 690rpx; + height: 80rpx; + border-radius: 80rpx; + padding: 0 30rpx; + display: flex; + align-items: center; + margin: 0 auto 40rpx; + background: #fff9f4; +} + +.goods-skeleton-content .goods-skeleton-slogan-top-msg view { + width: 300rpx; + height: 24rpx; + background: #e4e4e4; +} + +.goods-skeleton-content .goods-skeleton-slogan { + height: 32rpx; + width: 336rpx; + margin: 0 auto 50rpx; + background: #f7f7f7; +} + +.goods-skeleton-content .goods-skeleton-swipe-box { + width: 750rpx; + height: 240rpx; + margin-bottom: 40rpx; +} + +.goods-skeleton-content .goods-skeleton-swipe-item { + width: 670rpx; + height: 240rpx; + border-radius: 12rpx; + background: #f7f7f7; + margin: 0 auto; +} + +.goods-skeleton-content .goods-skeleton { + width: 710rpx; + border-radius: 20rpx; + background: #fff; + box-shadow: 0 10rpx 60rpx rgba(0, 0, 0, 0.1); + margin: 0 auto 40rpx; + overflow: hidden; +} + +.goods-skeleton-content .goods-skeleton .goods-img { + width: 710rpx; + height: 352rpx; + display: block; +} + +.goods-skeleton-content .goods-skeleton .goods-img image { + width: 100%; + height: 100%; +} + +.goods-skeleton-content .goods-skeleton .text-content { + box-sizing: border-box; + padding: 24rpx 30rpx; + height: 176rpx; +} + +.goods-skeleton-content .goods-skeleton .text-content .title { + width: 400rpx; + height: 32rpx; + background: #f7f7f7; + margin-bottom: 16rpx; +} + +.goods-skeleton-content .goods-skeleton .text-content .desc { + width: 600rpx; + height: 24rpx; + background: #f7f7f7; + margin-bottom: 16rpx; +} + +.goods-skeleton-content .goods-skeleton .text-content .desc2 { + width: 560rpx; + height: 44rpx; + background: #f7f7f7; +} + +.router-hover { + opacity: 1; +} + +.list-content { + background: #94cefe; + position: relative; + border-radius: 0px 0px 0px 0px; + overflow: hidden; +} + +.blur { + + filter: blur(20rpx); +} + +.list-content .rush-list-title { + width: 336rpx; + height: 88rpx; + display: block; + margin: 0 auto 20rpx; +} + +.rush-list-box { + background: #e7f4ff; + position: relative; + min-height: 1300rpx; + padding-top: 80rpx; +} + +.first-screen { + background: #fff; + padding-bottom: 48rpx; +} + +.header-content { + height: 120rpx; + width: 750rpx; + position: relative; + margin-bottom: 0rpx; + z-index: 3; +} + +.header-content .header-bg { + /**background: linear-gradient(90deg,#007FAF 0%,#42ADD5 100%);**/ + width: 100%; + height: 340rpx; + position: absolute; + left: 0; + top: 0; +} + +.header-content .header-logoimg { + float: left; + margin-left: 20rpx; + position: relative; + display: flex; + align-items: center; + justify-content: space-between; + padding: 20rpx 0rpx 0; +} + +.header-content .header-logoimg .header-logoimage{ + margin-top: 5rpx; + width: 210rpx; + height: 65rpx; + vertical-align: baseline; +} + +.header-content .location { + display: flex; + justify-content: space-around; + padding: 10rpx 0rpx 0 20rpx; + color: #fff; + position: relative; + box-sizing: border-box; + width: 470rpx; + margin-right: 20rpx; + float: right; +} + +.header-content .location .community-title { + width: 400rpx; + font-size: 28rpx; + line-height: 40rpx; + height: 30rpx; + display: flex; + align-items: center; + font-weight: 500; + position: relative; + justify-content: flex-end; +} + +.header-content .location .community-title span { + line-height: 56rpx; + position: absolute; + max-width: 100%; + left: 0; + top: -8rpx; + display: flex; + align-items: baseline; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.header-content .location .community-title image { + width: 10rpx; + height: 18rpx; + margin-left: 4rpx; +} + +.header-content .location .community-change { + font-size: 24rpx; + margin-left: 20rpx; +} + +.header-content .location .iconfont { + font-size: 22rpx; + margin-right: 5rpx; +} + +.header-content .location .community-address { + font-size: 22rpx; + line-height: 30rpx; + width: 400rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin-top: -10rpx; +} + +.header-content .location .location-right { + width: 72rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top: -10rpx; + margin-right: 20rpx; +} + +.header-content .location .location-right .img { + width: 70rpx; + height: 70rpx; + border-radius: 70rpx; + margin-bottom: 5rpx; +} + +.header-content .location .location-right text { + font-size: 20rpx; + width: 70rpx; + text-align: center; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.bg-ff { + background: linear-gradient(180deg,#4d9ee9 0%,rgb(148, 206, 254) 100%); + +} + +.top-msg { + width: 705rpx; + height: 60rpx; + display: flex; + align-items: center; + padding: 0 30rpx; + box-sizing: border-box; + color: #ff758c; + font-size: 26rpx; + line-height: 26rpx; + margin: 0 auto 20rpx; + background: #fff9f4; + border-radius: 20rpx; +} + +.top-msg image { + width: 32rpx; + height: 26rpx; + margin-right: 20rpx; + margin-top: 0rpx; + line-height: 80rpx; +} + +.top-msg .iconfont { + margin-right: 20rpx; + margin-top: 4rpx; +} + +.notice-swipe { + flex: 1; + height: 80rpx; +} + +.notice-swipe-item { + line-height: 80rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.list-title { + display: block; + margin: 0 auto 12rpx; + width: 336rpx; + height: 116rpx; +} + +.comming-list { + padding: 20rpx 24rpx; +} + +.comming-list .comming-spu-item { + width: 340rpx; + height: 460rpx; + margin-bottom: 20rpx; + display: inline-block; + overflow: hidden; +} + +.themeTwo.comming-list .comming-spu-item { + height: 526rpx; + border-radius: 20rpx; + box-shadow: -10rpx -10rpx 30rpx 5rpx #ffffff,10rpx 10rpx 20rpx 0rpx #4571a1a1; +} + +.comming-list .comming-spu-item:nth-child(odd) { + margin-right: 20rpx; +} + +.sticky-title { + display: flex; + justify-content: center; + background: #fff; + height: 160rpx; + position: relative; + z-index: 20; +} + +.sticky-title.sticky { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 80rpx; + line-height: 80rpx; + border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.sticky-title.sticky .tab-btn { + margin-top: 0; +} + +.sticky-title .tab-btn { + width: 112rpx; + height: 80rpx; + line-height: 80rpx; + margin: 0 30rpx; + color: #666; + font-size: 28rpx; + position: relative; +} + +.sticky-title .tab-btn-active { + color: #4facfe; + line-height: 80rpx; +} + +.sticky-title .tab-btn-active:after { + content: ''; + width: 112rpx; + height: 6rpx; + border-radius: 6rpx; + background: linear-gradient(to right,#4facfe,#00f2fe); + position: absolute; + bottom: 0; + left: 0; + box-shadow: 0 4rpx 8rpx rgba(9, 46, 255, 0.25); +} + +.none-rush-list { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding-bottom: 140rpx; + padding-top: 140rpx; +} + +.none-rush-list .img-block { + width: 240rpx; + height: 240rpx; + margin-bottom: 30rpx; +} + +.none-rush-list .h1 { + font-size: 32rpx; + line-height: 32rpx; + color: #4facfe; + margin-bottom: 20rpx; +} + +.none-rush-list .h2 { + font-size: 24rpx; + line-height: 24rpx; + color: #4facfe; +} + +.slogan { + height: 120rpx; + padding-bottom: 40rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.slogan image { + width: 250rpx; + height: 56rpx; +} + +.back-top { + bottom: 150rpx; + right: 30rpx; + width: 80rpx; + height: 80rpx; + position: fixed; + background: rgba(0, 0, 0, 0.5); + border-radius: 50%; + color: #fff; + text-align: center; + transform: translate3d(0, 100%, 0); + opacity: 0; + transition: all 0.3s; +} + +.back-top image { + margin-top: 22%; + width: 60%; + height: 60%; +} + +.back-top.show-icon { + transform: translate3d(0, 0, 0); + opacity: 1; +} + +.i-router-hover { + opacity: 1; +} + +.spu { + width: 100%; + display: block; +} + +.spu .img-class { + width: 240rpx; + height: 240rpx; + border-radius: 10rpx; +} + +.spu .mask { + background: rgba(255, 255, 255, 0.5); + width: 240rpx; + height: 240rpx; + position: absolute; + left: 20rpx; + top: 20rpx; +} + +.spu .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 70rpx; + top: 112rpx; + padding: 0 12rpx; +} + +.spu .spu-content { + background: #fff; + width: 710rpx; + border-radius: 20rpx; + overflow: hidden; + position: relative; + box-shadow: 0 0 40rpx rgba(0, 0, 0, 0.05); + margin: 0 auto 20rpx; + display: flex; + padding: 20rpx; + box-sizing: border-box; +} + +.spu .spu-content.disabled { + opacity: 0.6; +} + +.spu .spu-content .item-left { + width: 240rpx; + height: 240rpx; + position: relative; +} + +.spu .spu-content .item-right { + box-sizing: border-box; + margin-left: 20rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.spu .spu-content .item-right .spu-title { + color: #222; + font-size: 30rpx; + height: 32rpx; + width: 400rpx; + margin-bottom: 12rpx; + margin-top: 10rpx; + font-weight: 500; + position: relative; +} + +.spu .spu-content .item-right .spu-title span { + width: 100%; + height: 40rpx; + position: absolute; + left: 0; + top: -4rpx; + line-height: 40rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: #000; + font-weight: 500; +} + +.spu .spu-content .item-right .spu-tag { + padding-left: 196rpx; + margin-bottom: 16rpx; + display: flex; + height: 22rpx; +} + +.spu .spu-content .item-right .spu-desc { + font-size: 26rpx; + line-height: 26rpx; + color: #999; + position: relative; + width: 400rpx; + height: 26rpx; + margin-bottom: 12rpx; +} + +.spu .spu-content .item-right .spu-desc em { + width: 100%; + height: 32rpx; + position: absolute; + left: 0; + top: -2rpx; + line-height: 32rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.spu .spu-content .item-right .spu-price { + display: flex; + align-items: flex-end; + font-size: 24rpx; + line-height: 24rpx; + overflow: hidden; + margin-bottom: 10rpx; +} + +.spu .spu-content .item-right .spu-price .sale-price { + color: #ff758c; + margin-right: 12rpx; +} + +.spu .spu-content .item-right .spu-price .sale-price span { + font-size: 44rpx; + line-height: 40rpx; + margin: 0; + font-weight: bold; +} + +.spu .spu-content .item-right .spu-price .market-price { + text-decoration: line-through; + color: #999; + margin-right: 30rpx; +} + +.spu .spu-content .item-right .spu-count { + font-size: 20rpx; + line-height: 20rpx; + color: #999; + margin-bottom: 32rpx; +} + +.spu .spu-content .add-cart { + width: 68rpx; + height: 68rpx; + padding: 0; + margin: 0; + position: absolute; + right: 28rpx; + bottom: 20rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.spu .spu-content .add-cart image { + width: 54rpx; + height: 54rpx; + display: block; +} + +.spu .spu-content .spu-active { + position: absolute; + left: 0; + bottom: 16rpx; + z-index: 9; + display: flex; + flex-direction: column-reverse; + align-items: flex-start; +} + +.spu .spu-content .spu-active .tag { + background: linear-gradient(to right,#4facfe,#00f2fe); + border-radius: 0 14rpx 14rpx 0; + padding: 0 12rpx; + height: 24rpx; + font-size: 18rpx; + line-height: 24rpx; + color: #fff; + display: inline-block; + align-items: center; + justify-content: center; + margin-bottom: 8rpx; + width: auto; +} + +.spu .spu-content .spu-active .tag-green { + background: linear-gradient(to left, #46c8d0, #29ba9a); +} + +.img-content { + position: relative; +} + +.img-def { + position: absolute !important; + transition: opacity 0.6s; +} + +.opacity { + opacity: 0; +} + +.show-img { + opacity: 1; +} + +.auth-box { + position: absolute; + top: 0; + left: 0; +} + +.tabs { + margin-bottom: 20rpx; + background-color: #fff; +} + +.tabs.sticky { + position: fixed; + display: flex; + top: 0; + left: 0; + height: 80rpx; + line-height: 80rpx; + width: 100vw; + border-bottom: 2rpx solid rgba(0, 0, 0, 0.1); + z-index: 99; +} + +@keyframes opacity { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +/* 添加我的小程序提示 S */ + +.miniAppTip { + position: relative; + z-index: 100; +} + +.add-myapp { + position: fixed; + right: 10rpx; + + color: #fff; + font-size: 22rpx; + background-color: rgba(0, 0, 0, 0.452); + border:2rpx dashed #fff; + padding: 15rpx 20rpx; + border-radius: 30rpx; + transition: all 1s ease-in; +} + +.add-myapp:after { + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 7px solid #fff; + content: ""; + position: absolute; + width: 0; + height: 0; + top: -8px; + right: 120rpx; +} + +.guide { + position: fixed; + left: 0; + right: 0; + top: 200rpx; + bottom: 0; + background: rgba(0,0,0,0.5); + z-index: 5020; +} + +.guide image { + width: 100%; +} + +/* 添加我的小程序提示 E */ + +/* 列表类型二 S */ + +.active-item-two { + position: relative; + width: 750rpx; + margin-bottom: 10rpx; +} + +.list-item-count-down.type-two { + position: absolute; + z-index: 10; + top: 351rpx; + right: 20rpx; + color: #fff; + font-size: 26rpx; + background: #4facfe; + height: 50rpx; + line-height: 50rpx; + border-radius: 10rpx 0 0 0; + padding: 0 20rpx; +} + +.nav-list { + /**background: rgba(255, 255, 255, 0.4);**/ + position: relative; + z-index: 3; + margin: 20rpx 20rpx 0rpx 20rpx; + display: flex; + border-radius: 20rpx; + + padding: 0; + flex-wrap: wrap; + justify-content: space-between; +} + +.nav-list-item { + width: 20%; + color: #fff; + margin-bottom: 10rpx; + margin-top: 20rpx; +} + +.nav-list-item .nav-list-img { + width: 90rpx; + height: 90rpx; + margin: 0 auto; + filter: drop-shadow(2rpx 5rpx 5rpx rgba(0,0,0,0.3)); + +} + +.nav-list-item .nav-list-text { + font-size: 24rpx; + text-align: center; + margin-top: 8rpx; + /**color: rgb(19, 73, 143);**/ +} + +.nav-contact { + font-size: inherit; + line-height: inherit; + border-radius: 0; + background: transparent; + color: inherit; + padding: 0; +} + +.nav-contact::after { + content: none; +} + +.nav-list-item.nav-contact .nav-list-img { + left: 0; +} +/* 列表类型二 E */ + +/* sticky-content 20190115 Start */ + +.sticky-content { + background: #fff; + padding-bottom: 14rpx; + position: sticky; + position: -webkit-sticky; + z-index: 99; + top: -80rpx; + transition: top 0.3s; + border-radius: 20px 20px 0px 0px; +} + +.sticky-content.tab-nav-sticky { + top: 0; +} + +.sticky-content .tab-nav { + height: 70rpx; + display: flex; + margin: 0 30rpx; + border-bottom: 4rpx solid #4facfe; + transition: all 0.3s linear; +} + +.sticky-content .tab-nav .count-down-content { + flex: 1; + display: flex; + justify-content: flex-end; + align-items: center; + color: #444; +} + +.sticky-content .tab-nav .count-down-content em { + font-size: 26rpx; +} + +.sticky-content .tab-nav .count-down-content .count-down-left-text { + font-size: 26rpx; +} + +.sticky-content .tab-nav .count-down-content .count-down { + height: 68rpx; + line-height: 68rpx; + color: #444; + font-size: 26rpx; + display: flex; + align-items: center; + flex: 1; +} + +.sticky-content .tab-nav .count-down-content .count-down .item-time { + width: 34rpx; + height: 32rpx; + line-height: 32rpx; + color: #fff; + text-align: center; + background: #444; + border-radius: 4rpx; + padding: 0 2rpx; +} + +.sticky-content .tab-nav .tab-nav-item { + color: #6c6c6c; + font-size: 26rpx; + font-weight: bold; + position: relative; + z-index: 1; + width: 190rpx; + height: 70rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.sticky-content .tab-nav .tab-nav-item image { + width: 190rpx; + height: 70rpx; + position: absolute; + left: 0; + top: 0; +} + +.sticky-content .tab-nav .tab-nav-item span { + position: relative; +} + +.sticky-content .tab-nav .tab-nav-item.active { + color: #fff; + z-index: 2; +} + +.sticky-content .tab-nav .tab-nav-item:nth-child(1) span { + margin-left: -10rpx; +} + +.sticky-content .tab-nav .tab-nav-item:nth-child(2) { + margin-left: -20rpx; +} + +.sticky-content .tab-nav .tab-nav-item:nth-child(2) span { + margin-left: 30rpx; +} + +.sticky-content .category-list { + margin-top: 20rpx; + background-color: #fff; +} + +.sticky-cate { + background:#4d9ee9; + padding-bottom: 0rpx; + margin-bottom: 0rpx; + position: sticky; + top: 0px; + box-sizing: border-box; + z-index: 99; + border-radius: 0px 0px 0px 0px; + box-shadow: 0 10rpx 10rpx 0rpx rgba(143, 192, 230, 0.81); + /**background: linear-gradient(90deg,#007FAF 0%,#42ADD5 100%); + backdrop-filter: blur(30rpx) ; **/ + overflow: visible; +} + +.sticky-cate .category-list { + margin-top: 0rpx; + + /**background-color: linear-gradient(90deg,#007FAF 0%,#42ADD5 100%)**/ + /**border-radius: 20px 20px 0px 0px;**/ +} + +/* sticky-content End */ + +/*分享begin*/ + +.ui-mask { + position: fixed; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; + background: rgba(0, 0, 0, 0.6); +} + +.model-services { + width: 100%; + position: fixed; + background-color: #fff; + bottom: 0; + z-index: 1000; + color: #333; + -webkit-transition: all 0.3s; + transition: all 0.3s; + -webkit-transform: translate(0, 100%); + transform: translate(0, 100%); + border-radius: 30rpx 30rpx 0rpx 0rpx; +} + +.model-services.show { + -webkit-transform: translate(0); + transform: translate(0); +} + +.model-services .model-services-title { + font-size: 36rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + border-bottom: 1px solid #f2f5f8; +} + +.model-services .model-services-content { + padding: 20rpx; +} + +.model-services .model-services-content .service-item { + margin-bottom: 20rpx; + width: 50%; + float: left; + text-align: center; +} + +.model-services .model-services-content .service-icon { + font-size: 80rpx; + color: #4facfe; +} + +.service-name { + padding-left: 10rpx; +} + +.cube-text { + position: relative; + width: 100%; + height: 32rpx; + line-height: 32rpx; + color: #777; + margin-top: 5rpx; + font-size: 24rpx; +} + +.none_btn { + border: none; + line-height: 1.1; + padding: 0px; +} + +button[plain] { + border: none; +} + +.share-modal { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 101; + transition: all 400ms ease-in; +} + +.share-modal-content { + position: relative; + width: 70%; + top: 50%; + left: 15%; + transform: translateY(-50%); + z-index: 110; +} + +.share-modal-img { + width: 100%; + height: 956rpx; + background: #f7f7f7; +} + +.share-modal-img image { + width: 100%; +} + +.share-modal-btn-list { + display: flex; + margin-top: 30rpx; +} + +.share-modal-btn-item { + text-align: center; + flex: 1; +} + +.share-modal .btn-icon { + width: 70rpx; + margin: 0 auto; +} + +.share-modal .btn-text { + position: relative; + width: 100%; + height: 32rpx; + line-height: 32rpx; + color: #fff; + margin-top: 5rpx; + font-size: 24rpx; +} + +/*分享end*/ + +/* 联系客服 */ +.fixed-aside { + float:right; + position: fixed; + right: 20rpx; + top:110rpx; + background-color: #fff; + z-index: 94; + width: 80rpx; +} +.fixed-copytext { + display: inline-block; + transform: translateY(770rpx); + width: 80rpx; + height: 80rpx; + background: #fe94c5c4; + backdrop-filter: blur(40rpx); + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + box-sizing: border-box; + font-size: 24rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 94; + margin-bottom: 10rpx; +} + + +.fixed-service { + transform: translateY(860rpx); + width: 80rpx; + height: 80rpx; + display: inline-block; + z-index: 94; + margin-bottom: 10rpx; +} + +.fixed-service .iconfont { + font-size: 30rpx; +} + +.contact-service { + display: inline-block; + width: 80rpx; + height: 80rpx; + background-color: #94cefec4; + backdrop-filter: blur(40rpx); + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + font-size: 20rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 94; + margin-bottom: 10rpx; +} + +.contact-service::after { + border: 0; + } + +.fixed-share { + display: inline-block; + transform: translateY(950rpx); + width: 80rpx; + height: 80rpx; + background: #94cefec4; + backdrop-filter: blur(40rpx); + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + box-sizing: border-box; + font-size: 20rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 94; + margin-bottom: 10rpx; +} + +.fixed-share::after { + border: 0; +} + +.fixed-share .iconfont { + font-size: 30rpx; +} + +.fixed-top { + display: inline-block; + transform: translateY(1040rpx); + width: 80rpx; + height: 80rpx; + background: #94cefec4; + border-radius: 20rpx 20rpx 20rpx 20rpx; + text-align: center; + color: #fff; + box-sizing: border-box; + font-size: 20rpx; + padding: 10rpx; + line-height: 1.2; + z-index: 94; + margin-bottom: 10rpx; +} + +.fixed-top::after { + border: 0; +} + +.fixed-top .iconfont { + font-size: 30rpx; +} + +.search-bar { + margin-left: 0rpx; + margin-right: 0rpx; + padding: 12rpx 20rpx 0rpx 20rpx; + background: linear-gradient(180deg,#94cefe 0%, #4d9ee9 100%); + +} + +.search-bar::cue { + margin-right: 20rpx; + padding: 0rpx 0rpx 0rpx 0rpx; + margin-bottom: 16rpx; + transform: translate(-150rpx,0); +} + +.search-box { + background-color: #ffffff; + height: 56rpx; + line-height: 56rpx; + border-radius: 20rpx 20rpx 20rpx 20rpx; + color: rgb(99, 99, 99); + display: flex; + align-content: center; + box-shadow: -5rpx -5rpx 20rpx 5rpx rgba(255, 255, 255, 1),5rpx 5rpx 20rpx 5rpx rgb(69, 114, 161); + +} + +.search-btn { + padding-left: 20rpx; + padding-right: 10rpx; + background: transparent; + line-height: 56rpx; + font-size: 32rpx; + padding-right: 5rpx; + width: 95rpx; +} + +button.search-btn::after { + content: none; +} + +.search-icon { + color: rgb(99, 99, 99); + position: absolute; + right: 20rpx; + margin-left: 12rpx; + margin-right: 25rpx; +} + +.search-icon .iconfont { + font-size: 22rpx; + padding-top: 10rpx; +} + +.search-box .ipt { + text-align:center; + padding: 0 0rpx 0 0rpx; + line-height: 56rpx; + height: 56rpx; + width: 100%; + box-sizing: border-box; +} + +/* 搜索 E */ + +.location-left { + display: flex; + flex-direction: column; + justify-content: space-around; + float: right; +} + +/* 新人优惠券 S */ + +.new-coupou { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.3); + z-index: 999; + transition: all 400ms ease-in; +} + +.new-coupou-content { + position: absolute; + left: 50%; + top: 50%; + width: 600rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + transform: translate(-50%, -50%); +} + +.new-coupou-body { + flex: 1; + width: 100%; + background: linear-gradient(to right,#4facfe,#00f2fe); + border-radius: 20rpx; + box-sizing: border-box; + padding: 0 30rpx; +} + +.new-coupou-foot { + padding: 40rpx 0; +} + +.new-coupou-foot .iconfont { + font-size: 60rpx; + color: #fff; +} + +.new-coupou-body-head { + height: 108rpx; + line-height: 108rpx; + text-align: center; + color: #fff; + font-size: 40rpx; + font-weight: bold; +} + +.new-coupou-body-foot { + height: 122rpx; +} + +.new-coupou-body-btn { + background:linear-gradient(100deg, #ff758c 0%, #ff7eb3 100%); + width: 100%; + text-align: center; + color: #fff; + font-size: 34rpx; + font-weight: bold; + line-height: 78rpx; + border-radius: 39rpx; + margin-top: 20rpx; +} + +.preventTouchMove { + top: 0px; + left: 0px; + width: 100%; + height: 100%; + overflow: hidden; + position: fixed; + z-index: 0; +} + +.new-coupou-item { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + border-radius: 10rpx; + padding: 20rpx; + margin-bottom: 20rpx; +} + +.new-coupou-title { + font-size: 32rpx; + color: #000; +} + +.new-coupou-time { + font-size: 24rpx; + color: #ff758c; + margin-top: 10rpx; +} + +.new-coupou-r { + text-align: center; +} + +.new-coupou-price { + color: #ff758c; + font-size: 48rpx; + font-weight: bold; +} + +.new-coupou-price text { + font-size: 24rpx; + font-weight: normal; + display: inline-block; + vertical-align: middle; +} + +.new-coupou-use { + background: #4facfe; + border-radius: 20rpx; + color: #fff; + font-size: 22rpx; + padding: 10rpx 20rpx; + line-height: 1; +} + +/* 新人优惠券 E */ + +.blank10 { + margin-bottom: 10rpx; +} + +/* 复制信息 */ +.copytext { + width: 640rpx; + background: #fff; + border-radius: 24rpx; + position: relative; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; + margin: 0 auto; + overflow: hidden; + z-index: 1001; +} + +.copytext-title { + width: 100%; + background-color: #4facfe; + text-align: center; + color: #fff; + font-weight: bold; + font-size: 34rpx; + line-height: 100rpx; + margin-bottom: 30rpx; +} + +.copytext-p { + width: 100%; + box-sizing: border-box; + padding: 5rpx 30rpx; + font-size: 30rpx; +} + +.copytext-h3 { + width: 100%; + box-sizing: border-box; + padding: 5rpx 30rpx; + font-size: 32rpx; + font-weight: bold; + margin-top: 24rpx; +} + +.copytext-content { + box-sizing: border-box; + height: 400rpx; + padding: 20rpx 30rpx 0; +} + +.copytext-item { + line-height: 1.8; +} + +.copytext-item text{ + margin-left: 5px; +} + +.copytext-close { + position: absolute; + font-size: 50rpx; + top: 25rpx; + right: 30rpx; + color: #fff; + line-height: 1; +} + +.copytext-btn { + position: fixed; + right: 0; + bottom: 32%; + font-size: 20rpx; + color: #999; + z-index: 100; + width: 80rpx; + line-height: 1.2; + border: 1px solid #999; + border-right: 0; + padding: 5rpx 15rpx 5rpx 20rpx; + border-radius: 40rpx 0 0 40rpx; +} + +.community-content-btn { + text-align: center; + width: 432rpx; + height: 72rpx; + color: #fff; + background: #4facfe; + font-size: 36rpx; + line-height: 72rpx; + border-radius: 12rpx; + margin: 40rpx 0 30rpx; +} + +/* 优惠券 20190713 */ +.promotion { + box-sizing: border-box; + /* height: 126rpx; */ + padding: 0 20rpx 20rpx; + z-index: 3; +} + +.promotion .head { + font-size: 24rpx; + color: #999; + margin-bottom: 16rpx; +} + +.promotion .slider { + position: relative; + overflow: hidden; +} + +.promotion .slider-wraper { + position: relative; + width: 100%; + height: 100%; + display: flex; + overflow-y: auto; + -webkit-overflow-scrolling: touch; +} + +.promotion .list { + display: flex; + flex-flow: row nowrap; +} + +.promotion .list-item { + margin-right: 10rpx; +} + +.promotion .list-item:last-child { + margin-right: 0px; +} + +.promotion .card-content { + height: 106rpx; + border-radius: 10rpx; + position: relative; + overflow: hidden; + background-color: #ff758c; +} + +.promotion .card { + position: relative; + overflow: hidden; + display: flex; + flex-flow: column nowrap; + align-items: center; + justify-content: center; + color: #fff; + border-radius: 4rpx; + height: 88rpx; + width: 180rpx; + padding: 8rpx; +} + +.promotion .card-price { + flex-flow: row nowrap; + align-items: flex-start; +} + +.promotion .card-price--unit, .card-price { + display: flex; +} + +.promotion .card-price--unit { + font-size: 18rpx; +} + +.promotion .card-price--num { + font-size: 48rpx; + line-height: 48rpx; +} + +.promotion .card-desc, .card-price--num { + display: flex; +} + +.promotion .card-desc { + font-size: 20rpx; +} + +.promotion .card-tag { + display: none; + justify-content: center; + align-items: center; + width: 64rpx; + height: 64rpx; + position: absolute; + bottom: -16rpx; + right: -10rpx; + transform: rotate(-20deg); + border: 1px solid #666; + border-radius: 50%; +} + +.promotion .card-tag--text { + font-size: 20rpx; + color: #666; + margin-bottom: 10rpx; + text-align: center; +} + +.promotion .card-tag--get { + display: flex; +} + +.promotion .card-content.get { + background-image: none!important; + background-color: #c7c7c7!important; +} + +.m-coupou-m { + flex: 1; + margin: 0 20rpx; + width: 0; +} + +.m-coupou-price { + color: #ff758c; + font-size: 48rpx; + font-weight: bold; +} + +.m-coupou-price text { + font-size: 24rpx; + font-weight: normal; +} + +.m-coupou-name { + width: 100%; + font-size: 28rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} + +.m-coupou-title { + font-size: 22rpx; +} + +.m-coupou-r .new-coupou-use.kong { + background: transparent; + border: 1rpx solid #4facfe; + color: #4facfe; +} +/* 优惠券 20190713 End */ + +.theme3 { + position: relative; + display: flex; + flex-wrap: wrap; + margin: 20rpx; + border-radius: 30rpx; + overflow: hidden; +} + +.theme3-list { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.theme3-list::after { + content:''; + width: 33.33%; +} + +.theme3 .topic-img { + width: 100%; +} + +.theme3-more { + text-align: center; + border-top: 0.1rpx solid #efefef; + padding: 20rpx 0; + width: 100%; + font-size: 24rpx; + margin: 20rpx 20rpx 0; + display: flex; + align-items: center; + justify-content: center; +} + +.theme3-more .iconfont { + font-size: 20rpx; + color: #999; + margin-top: 1rpx; +} + +.location-theme2 { + /**text-align:right;**/ + float:right; + margin-right: 20rpx; + margin-top: 5rpx; + margin-bottom: 5rpx; + position: relative; + display: flex; + align-items: center; + justify-content: space-between; +} + +.location-theme2 .loc-m { + flex: 1; + margin: 0 10rpx; + font-size: 28rpx; + font-weight: bold; +} + +.location-theme2 .loc-l { + margin-top: 15rpx; + +} + +.location-theme2 .loc-m .iconfont { + font-size: 26rpx; +} + +.location-theme2 .loc-l .img { + width: 70rpx; + height: 70rpx; + border-radius: 50%; + vertical-align: baseline; + box-shadow: 0 0rpx 10rpx rgba(0,0,0,0.1); +} + +.location-theme2 .top-search { + background-color: #fff; + border-radius: 28rpx 0rpx 0rpx 28rpx; + padding: 10rpx 20rpx; + color: rgb(99, 99, 99); + box-shadow: 0 0rpx 20rpx rgba(0,0,0,0.1); + font-size: 28rpx; +} + +.location-theme2 .top-search .iconfont { + color: rgb(99, 99, 99); + font-size: 22rpx; + margin-right: 20rpx; +} + +.forbid { + position: relative; + height: 100vh; + color: #999; + z-index: 9999; + background: #fff; +} + +.forbid .iconfont { + font-size: 120rpx; + color: #c7c7c7; + margin-bottom: 30rpx; +} + +.diy-box { + min-height: 100vh; +} + +.mp-account { + position: fixed; + left: 20rpx; + right: 20rpx; + border: 1rpx solid #ccc; + border-radius: 8rpx; + overflow: hidden; + bottom: calc(98rpx + env(safe-area-inset-bottom)); + z-index: 99998; +} +.mp-account .iconfont { + position: absolute; + right: 10rpx; + top: -10rpx; + z-index: 99999; +} +.forbid .h1 { + font-size: 32rpx; + margin-top: 30rpx; + font-weight: bold; +} + +.forbid .h2 { + font-size: 28rpx; + margin-top: 10rpx; +} +.topic { + + padding-bottom: 10rpx; +} + +.topic-img { + margin-bottom: 0rpx; + position: relative; + right: 0rpx; + border-radius: 30rpx 30rpx 30rpx 30rpx; + width: 100%; + box-shadow: 0 0 20rpx rgba(0,0,0,0.3); +} + +.blank10 { + margin-top: -20rpx; + height: 5rpx; + /** background-color: #4facfe;**/ +} + +.group{ + width: 100%; + display: block; + position: fixed; + top: 0; + left: 0; + z-index: 1000; + } + + +.bigIcon { + width: 60rpx; + height: 60rpx; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + + } + .bigIcon1 { + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + + } + .containermini { + display: flex; + flex-direction: column; + height: 40rpx; + color: #fff; + font-size: 15rpx; + z-index: 8999; + position: fixed; + } + .temp { + position: relative; + + + flex-direction: row; + justify-content: center; + align-items: center; + + } + + .num { + + font-size: 18rpx; + } + .weather { + + align-items: center; + text-align: center; + justify-content: space-between; + font-size: 18rpx; + } + .city { + display: flex; + align-items: center; + justify-content: space-between; + position: relative; + padding: 0 5rpx; + font-size: 28rpx; + } + .info { + padding: 10rpx 0 50rpx; + display: flex; + /* border-bottom: 1rpx solid rgba(240, 240, 240, .4); */ + } \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/line.wxml b/eaterplanet_ecommerce/pages/index/line.wxml new file mode 100644 index 0000000..989cb64 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/line.wxml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/notice.wxml b/eaterplanet_ecommerce/pages/index/notice.wxml new file mode 100644 index 0000000..0afc7cf --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/notice.wxml @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/richtext.wxml b/eaterplanet_ecommerce/pages/index/richtext.wxml new file mode 100644 index 0000000..bb874d5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/richtext.wxml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/search.wxml b/eaterplanet_ecommerce/pages/index/search.wxml new file mode 100644 index 0000000..b63363c --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/search.wxml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/search.wxss b/eaterplanet_ecommerce/pages/index/search.wxss new file mode 100644 index 0000000..188120e --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/search.wxss @@ -0,0 +1,42 @@ +.diy-search-bar { + background-color: transparent; + width: 94%; + box-sizing: border-box; + display: flex; + align-items: center; + margin:0 auto; + border-radius: 10rpx; +} + +.diy-search-bar .search-box { + position: relative; + background-color: #f0f0f0; + height: 76rpx; + line-height: 76rpx; + border-radius: 76rpx; + color: #acacac; + display: flex; + align-content: center; + flex: 1; +} + +.diy-search-bar .search-box .ipt { + padding: 0 30rpx; + line-height: 76rpx; + height: 76rpx; + width: 100%; + box-sizing: border-box; +} + +.diy-search-bar .search-box .ipt.radius { + border-radius: 76rpx; +} + +.diy-search-bar .diy-search-icon { + position: absolute; + right: 12px; + top: 50%; + margin-top: -30rpx; + text-align: center; + line-height: 60rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/share.js b/eaterplanet_ecommerce/pages/index/share.js new file mode 100644 index 0000000..769e3e4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/share.js @@ -0,0 +1,128 @@ +var app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + goodShareImg: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let type = options.type || ''; + if (type == 'commiss'){ + this.getCommissShareImage(); + }else { + this.getShareImage(); + } + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 商品列表分享图 + */ + getShareImage: function () { + wx.showLoading({ title: '获取中' }) + var that = this; + var token = wx.getStorageSync('token'); + var community_id = wx.getStorageSync('community').communityId; + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'user.user_index_shareqrcode', + community_id, + token: token + }, + dataType: 'json', + method: 'POST', + success: function (res) { + if (res.data.code == 0) { + let goodShareImg = res.data.image_path; + that.setData({ goodShareImg }); + wx.hideLoading(); + // var image_path = res.data.image_path; + // wx.getImageInfo({ + // src: image_path, + // success: function (res) { + // var real_path = res.path; + // wx.saveImageToPhotosAlbum({ + // filePath: real_path, + // success(res) { + // wx.showToast({ + // title: '图片保存成功,可以分享了', + // icon: 'none', + // duration: 2000 + // }) + // that.setData({ + // is_share_html: true + // }); + // } + // }) + // } + // }) + } + } + }) + }, + + /** + * 会员分销分享图 + */ + getCommissShareImage: function () { + wx.showLoading({ title: '获取中' }) + var that = this; + var token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'distribution.get_haibao', + token: token + }, + dataType: 'json', + method: 'POST', + success: function (res) { + if (res.data.code == 0) { + let goodShareImg = res.data.commiss_qrcode; + that.setData({ goodShareImg }); + wx.hideLoading(); + } + } + }) + }, + + //图片点击事件 + preImg: function (event) { + var src = event.currentTarget.dataset.src;//获取data-src + var goodShareImg = this.data.goodShareImg;//获取data-list + //图片预览 + wx.previewImage({ + current: src, // 当前显示图片的http链接 + urls: [goodShareImg] // 需要预览的图片http链接列表 + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + } +}) \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/share.json b/eaterplanet_ecommerce/pages/index/share.json new file mode 100644 index 0000000..b06409f --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/share.json @@ -0,0 +1,8 @@ +{ + "navigationBarBackgroundColor": "#FFF", + "navigationBarTitleText": "分享图片", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/share.wxml b/eaterplanet_ecommerce/pages/index/share.wxml new file mode 100644 index 0000000..132d143 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/share.wxml @@ -0,0 +1,5 @@ + + diff --git a/eaterplanet_ecommerce/pages/index/share.wxss b/eaterplanet_ecommerce/pages/index/share.wxss new file mode 100644 index 0000000..e19e510 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/share.wxss @@ -0,0 +1,18 @@ +/* eaterplanet_ecommerce/pages/index/share.wxss */ +page { + background: #fff; +} + +.share-box { + padding: 0 30rpx 10rpx; +} + +.share-box .tip { + line-height: 2.4; +} + +.share-box .img { + width: 100%; + border-radius: 30rpx 30rpx 30rpx 30rpx; + box-shadow: 0 0 20rpx rgba(0,0,0,0.3); +} diff --git a/eaterplanet_ecommerce/pages/index/template/cube.wxml b/eaterplanet_ecommerce/pages/index/template/cube.wxml new file mode 100644 index 0000000..0da4c37 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/cube.wxml @@ -0,0 +1,102 @@ + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/cube.wxss b/eaterplanet_ecommerce/pages/index/template/cube.wxss new file mode 100644 index 0000000..3619c3d --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/cube.wxss @@ -0,0 +1,89 @@ +.cube { + position: relative; + padding: 0 20rpx 20rpx; + margin-top: 20rpx; + overflow: hidden; + z-index: 3; + +} + +.cube-item { + display: flex; + justify-content: space-between; + margin-bottom: 10rpx; + +} + +.cube-item:last-child { + margin-bottom: 0; +} + +.cube-one { + border-radius: 20rpx; + width: 710rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-left { + border-radius: 20rpx; + width: 273rpx; + height: 371rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-two { + border-radius: 20rpx; + width: 430rpx; + height: 370rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-three { + border-radius: 20rpx; + width: 430rpx; + height: 181rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-four { + border-radius: 20rpx; + width: 211rpx; + height: 182rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-w { + border-radius: 20rpx; + width: 353rpx; + height: 212rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.cube-w4 { + border-radius: 20rpx; + width: 173rpx; + height: 173rpx; + box-shadow: 0rpx 5rpx 15rpx 0rpx rgb(79, 129, 182); +} + +.w450 { + width: 430rpx; +} + +.cube-item.two-row { + flex-wrap: wrap; +} + + + +.cube-item.two-row .cube-w { + flex: initial; + width: 355rpx; + height: 355rpx; +} + +.cube-item.two-row .cube-w4 { + flex: initial; + width: 355rpx; + height: 355rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/navlist.wxml b/eaterplanet_ecommerce/pages/index/template/navlist.wxml new file mode 100644 index 0000000..5d80b83 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/navlist.wxml @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/navlist.wxss b/eaterplanet_ecommerce/pages/index/template/navlist.wxss new file mode 100644 index 0000000..a0c4267 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/navlist.wxss @@ -0,0 +1,63 @@ +/* 导航列表 S */ +.navswiper { + margin: 30rpx 0 10rpx; +} + +.nav-list { + position: relative; + z-index: 1; + display: flex; + padding: 0 20rpx; + flex-wrap: wrap; + justify-content: space-between; +} + +.nav-list-item { + width: 20%; + color: #333; + margin-bottom: 20rpx; +} + +.nav-list-item .nav-list-img { + width: 86rpx; + height: 86rpx; + margin: 0 auto; +} + +.nav-list-item .nav-list-text { + text-align: center; + margin-top: 8rpx; +} + +.nav-contact { + font-size: inherit; + line-height: inherit; + border-radius: 0; + background: transparent; + color: inherit; + padding: 0; +} + +.nav-contact::after { + content: none; +} + +.nav-list-item.nav-contact .nav-list-img { + left: 0; +} + +.navpage { + line-height: 6rpx; + padding-bottom: 10rpx; +} + +.navpage .item{ + display: inline-block; + width: 30rpx; + height: 6rpx; + background-color: #e5e5e5; + margin: 0 5rpx; + line-height: 6rpx; +} + +/* 导航列表 E */ \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/pin.wxml b/eaterplanet_ecommerce/pages/index/template/pin.wxml new file mode 100644 index 0000000..9b4a151 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/pin.wxml @@ -0,0 +1,28 @@ + diff --git a/eaterplanet_ecommerce/pages/index/template/pin.wxss b/eaterplanet_ecommerce/pages/index/template/pin.wxss new file mode 100644 index 0000000..65424ed --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/pin.wxss @@ -0,0 +1,123 @@ +.pin-spec { + position: relative; + background: #fff; + margin: 20rpx; + border-radius: 20rpx; + overflow: hidden; +} + +.pin-spec-img { + width: 100%; + vertical-align: top; + border-radius: 10rpx 10rpx 0 0; +} + +.pin-spec-scroll { + max-height: 380rpx; +} + +.pin-spec-wrap { + position: relative; + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + +.pin-spec-item { + position: relative; + width: 240rpx; + box-sizing: border-box; + padding: 20rpx; + font-size: 28rpx; +} + +.pin-spec-item .pin-img { + width: 200rpx; + height: 200rpx; + margin-bottom: 20rpx; +} + +.pin-spec-item .title { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.pin-spec-item .new-bot { + margin-top: 10rpx; + display: flex; + align-items: center; +} + +.pin-spec-item .price { + color: #ff5041; +} + +.pin-spec-item .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 50%; + top: 80rpx; + padding: 0 12rpx; + transform: translateX(-50%); +} + +.pin-spec-item .market-price { + text-decoration: line-through; + color: #999; + font-size: 22rpx; + margin-left: 10rpx; +} + +.pin-spec-item .pin-tag { + display: inline-block; + font-size: 22rpx; + padding: 0 6rpx; + margin-right: 10rpx; + border: 0.1rpx solid #ff758c; + vertical-align: middle; + color: #ff758c; + border-radius: 4rpx; +} + +/* 标签 */ + +.pin-spec .item-tag { + position: absolute; + left: 20rpx; + top: 20rpx; + width: 54rpx; + height: 62rpx; + z-index: 1; + color: #fff; + text-align: center; +} + +.item-tag-bg { + position: absolute; + left: 0; + top: 0; + width: 54rpx; + height: 62rpx; + z-index: 0; +} + +.pin-spec .item-tag .tag-name { + position: relative; + padding-top: 6rpx; + font-size: 20rpx; + line-height: 1; + font-weight: 600; + z-index: 1; +} + +.pin-spec .item-tag .tag-name.two-word { + font-size: 22rpx; + padding-top: 14rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/pinrow.wxml b/eaterplanet_ecommerce/pages/index/template/pinrow.wxml new file mode 100644 index 0000000..f214a13 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/pinrow.wxml @@ -0,0 +1,47 @@ + diff --git a/eaterplanet_ecommerce/pages/index/template/pinrow.wxss b/eaterplanet_ecommerce/pages/index/template/pinrow.wxss new file mode 100644 index 0000000..3ae6877 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/pinrow.wxss @@ -0,0 +1,190 @@ +.pinrow-wrap .spu-content { + display: block; + overflow: hidden; + margin: 20rpx auto; + padding: 20rpx 20rpx 30rpx; + box-sizing: border-box; + position: relative; + display: flex; +} + +.pinrow-wrap .spu-img { + width: 240rpx; + height: 240rpx; + border-radius: 10rpx; +} + +.pinrow-wrap .item-top { + position: relative; +} + +.pinrow-wrap .spu-content .item-bottom { + flex: 1; + box-sizing: border-box; + margin-left: 20rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.pinrow-wrap .spu-content .spu-title { + color: #333; + font-size: 30rpx; + height: 32rpx; + width: 400rpx; + margin-bottom: 12rpx; + font-weight: bold; + position: relative; +} + +.pinrow-wrap .spu-content .spu-title .span { + width: 100%; + height: 40rpx; + position: absolute; + left: 0; + top: -4rpx; + line-height: 40rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 0; +} + +.pinrow-wrap .spu-content .spu-desc { + font-size: 26rpx; + line-height: 26rpx; + color: #999; + position: relative; + width: 400rpx; + height: 26rpx; + margin-bottom: 12rpx; +} + +.pinrow-wrap .spu-content .spu-desc .em { + width: 100%; + height: 32rpx; + position: absolute; + left: 0; + top: -2rpx; + line-height: 32rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.pinrow-wrap .spu-content .spu-price { + display: flex; + align-items: flex-end; + font-size: 26rpx; + line-height: 26rpx; + overflow: hidden; + margin-top: 10rpx; +} + +.pinrow-wrap .spu-content .spu-price .sale-price { + font-family: 'DIN'; + color: #ff758c; + margin-right: 12rpx; +} + +.pinrow-wrap .spu-content .spu-price .sale-price .span { + font-size: 46rpx; + line-height: 42rpx; + margin: 0; + font-weight: bold; +} + +.pinrow-wrap .spu-content .spu-price .market-price { + font-family: DIN; + text-decoration: line-through; + color: #999; + margin-right: 20rpx; +} + +.pinrow-wrap .spu-content .spu-count { + margin-top: auto; + font-size: 24rpx; + color: #999; + margin-bottom: 10rpx; +} + +.pinrow-wrap .spu-content .spu-count .pin-tag { + display: inline-block; + font-size: 22rpx; + padding: 0 6rpx; + margin-bottom: 10rpx; + border: 0.1rpx solid #ff5344; + vertical-align: middle; + color: #ff5344; + border-radius: 4rpx; +} + +.pinrow-wrap .spu-content .add-cart, +.pinrow-wrap .spu-content .add-cart-disabled { + width: 160rpx; + height: 60rpx; + padding: 0; + margin: 0; + position: absolute; + right: 20rpx; + bottom: 20rpx; + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(90deg, #ff5041 0%, #ff695c 100%); + color: #fff; + border-radius: 30rpx; + font-size: 26rpx; + font-weight: bold; +} + +.pinrow-wrap .spu-content .add-cart-disabled { + background: #ccc; +} + +.pinrow-wrap .spu-play { + position: absolute; + left: 120rpx; + top: 95rpx; + width: 100rpx; + height: 100rpx; + margin-left: -50rpx; +} + +.pinrow-wrap .spu-play .img { + width: 100%; + height: 100%; +} + +.pinrow-wrap .mask { + background: rgba(255, 255, 255, 0.5); + width: 300rpx; + height: 240rpx; + position: absolute; + left: 25rpx; + top: 30rpx; +} + +.pinrow-wrap .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 130rpx; + top: 120rpx; + padding: 0 12rpx; + margin-left: -45rpx; +} + +.pin-more { + text-align: center; + padding-bottom: 20rpx; + font-size: 24rpx; + display: flex; + align-items: center; + justify-content: center; +} diff --git a/eaterplanet_ecommerce/pages/index/template/presalerow.wxml b/eaterplanet_ecommerce/pages/index/template/presalerow.wxml new file mode 100644 index 0000000..0d4f099 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/presalerow.wxml @@ -0,0 +1,67 @@ + diff --git a/eaterplanet_ecommerce/pages/index/template/presalerow.wxss b/eaterplanet_ecommerce/pages/index/template/presalerow.wxss new file mode 100644 index 0000000..84c7cd3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/presalerow.wxss @@ -0,0 +1,47 @@ +.presalerow.pinrow-wrap .mask { + width: 240rpx; + height: 240rpx; + left: 20rpx; + top: 20rpx; +} + +.presalerow.pinrow-wrap .act-end { + z-index: 100; + top: 95rpx; +} + +/* 标签 */ + +.presalerow .item-tag { + position: absolute; + left: 10rpx; + top: 20rpx; + width: 54rpx; + height: 62rpx; + z-index: 1; + color: #fff; + text-align: center; +} + +.presalerow .item-tag-bg { + position: absolute; + left: 0; + top: 0; + width: 54rpx; + height: 62rpx; + z-index: 0; +} + +.presalerow .item-tag .tag-name { + position: relative; + padding-top: 6rpx; + font-size: 20rpx; + line-height: 1; + font-weight: 600; + z-index: 1; +} + +.presalerow .item-tag .tag-name.two-word { + font-size: 22rpx; + padding-top: 14rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/seckill.wxml b/eaterplanet_ecommerce/pages/index/template/seckill.wxml new file mode 100644 index 0000000..fcfdfdb --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/seckill.wxml @@ -0,0 +1,29 @@ + diff --git a/eaterplanet_ecommerce/pages/index/template/seckill.wxss b/eaterplanet_ecommerce/pages/index/template/seckill.wxss new file mode 100644 index 0000000..b7ae28f --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/seckill.wxss @@ -0,0 +1,81 @@ +.seckill-bg { + background: #94cefe; +} +.seckill { + position: relative; + padding: 20rpx 20rpx 20rpx 20rpx; + z-index: 3; + overflow: hidden; +} + +.seckill-head { + color: #fff; + border-radius: 20rpx; + padding: 0 30rpx; + align-items: center; + height: 100rpx; + background: linear-gradient(90deg, #ea404b 0%, #ed745d 100%); + line-height: 1.2; +} + +.seckill-head .tit { + font-size: 30rpx; + font-weight: bold; + padding-right: 20rpx; + border-right: 1px solid #fff; + margin-right: 20rpx; +} + +.seckill .more { + font-size: 26rpx; +} + +.seckill .more .iconfont { + font-size: 28rpx; +} + +.seckill-list { + position: relative; +} + +.sec-swiper-content { + width: 100%; + height: 290rpx; +} + +.seckill-head-item { + margin: 0 19rpx; + text-align: center; +} + +.seckill-head-item .time{ + font-size: 26rpx; + font-weight: bold; + margin-bottom: 10rpx; +} + +.seckill-head-item .desc{ + font-size: 22rpx; +} + +.seckill-head-item.active .desc { + color: #ea474e; + padding: 2rpx 10rpx; + background-color: #fff; + border-radius: 20rpx; +} + +.seckill .current { + height: 32rpx; + line-height: 32rpx; + text-align: center; + border-radius: 24rpx; + background-color: #f8f8f8; + font-size: 24rpx; + color: #c8c8c8; + position: absolute; + right: 20rpx; + top: 20rpx; + z-index: 1; + padding: 0 10rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/video.wxml b/eaterplanet_ecommerce/pages/index/template/video.wxml new file mode 100644 index 0000000..61d8a22 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/video.wxml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/video.wxss b/eaterplanet_ecommerce/pages/index/template/video.wxss new file mode 100644 index 0000000..954bec0 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/video.wxss @@ -0,0 +1,21 @@ +.index-video { + margin: 20rpx; + position: relative; + overflow: hidden; +} + +.index-video .poster .img { + width: 100%; + border-radius: 20rpx; +} + +.index-video .poster .play-img { + width: 200rpx; + height: 200rpx; + position: absolute; + top: 50%; + left: 50%; + margin-top: -100rpx; + margin-left: -100rpx; + z-index: 1; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/template/virtualcardrow.wxml b/eaterplanet_ecommerce/pages/index/template/virtualcardrow.wxml new file mode 100644 index 0000000..d68f210 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/template/virtualcardrow.wxml @@ -0,0 +1,66 @@ + diff --git a/eaterplanet_ecommerce/pages/index/test.wxs b/eaterplanet_ecommerce/pages/index/test.wxs new file mode 100644 index 0000000..1b31f5b --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/test.wxs @@ -0,0 +1,16 @@ +var funcA = function (e, ins) { + // console.log('source is', JSON.stringify(e)) + var scrollTop = e.detail.scrollTop + if (scrollTop > 600) { + ins.selectComponent('.group').setStyle({ + "background-color": 'rgba(77, 158, 233, 1)' + }) + } else { + ins.selectComponent('.group').setStyle({ + "background-color": 'rgba(77, 158, 233, ' + Math.max(0, (scrollTop) / 600) + ')' + }) + } +} +module.exports = { + funcA: funcA +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/text.wxml b/eaterplanet_ecommerce/pages/index/text.wxml new file mode 100644 index 0000000..cf5bb16 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/text.wxml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/index/video.wxml b/eaterplanet_ecommerce/pages/index/video.wxml new file mode 100644 index 0000000..166c756 --- /dev/null +++ b/eaterplanet_ecommerce/pages/index/video.wxml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/evaluate.js b/eaterplanet_ecommerce/pages/order/evaluate.js new file mode 100644 index 0000000..97d2d1c --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/evaluate.js @@ -0,0 +1,265 @@ +// eaterplanet_ecommerce/pages/order/evaluate.js +var util = require('../../utils/util.js'); +var app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + order_id: 0, + goods_id: 0, + miaoshu_no: 0, + price_no: 0, + zhiliang_no: 0, + is_jifen: 0, + pinjia_text: '', + thumb_img: [], + image: [], + placeholder: "亲,您对这个商品满意吗?您的评价会帮助我们选择更好的商品哦~", + evaluate: "", + imgGroup: [], + imgMax: 4, + isIpx: false, + focus: false, + progressList: [] + }, +handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + //id=' + id + '&goods_id' + goods_id + var that = this; + var token = wx.getStorageSync('token'); + + var order_id = options.id; + var goods_id = options.goods_id; + + this.setData({ + order_id: order_id, + goods_id: goods_id + }) + + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.order_comment', + 'token': token, + order_id: order_id, + goods_id: goods_id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 3) { + //un login + } else if (res.data.code == 0) { + //code goods_image + that.setData({ + goods_id: res.data.goods_id, + order_goods: res.data.order_goods, + goods_image: res.data.goods_image, + open_comment_gift: res.data.open_comment_gift, + comment_gift_publish: res.data.comment_gift_publish + }) + } + } + }) + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + addImg: function() { + var that = this, + imgGroup = this.data.imgGroup; + wx.chooseMedia({ + count: this.data.imgMax - imgGroup.length, + success: function(res) { + const tempFiles = res.tempFiles; + var new_thumb_img = that.data.thumb_img; + for (var i = 0; i < tempFiles.length; i++) { + wx.showLoading({ + title: '上传中' + }) + if (new_thumb_img.length >= 4) { + that.setData({ + thumb_img: new_thumb_img + }); + return false; + } else { + wx.uploadFile({ + url: app.util.url('entry/wxapp/index', { + 'm': 'eaterplanet_ecommerce', + 'controller': 'goods.doPageUpload' + }), + filePath: tempFiles[i].tempFilePath, + name: 'upfile', + formData: { + 'name': tempFiles[i].tempFilePath + }, + header: { + 'content-type': 'multipart/form-data' + }, + success: function(res) { + + wx.hideLoading(); + var data = JSON.parse(res.data); + + var image_thumb = data.image_thumb; + var image_o_full = data.image_o_full; + var orign_image = data.image_o; + var new_img = that.data.image; + + var new_thumb_img = that.data.thumb_img; + new_img.push(orign_image); + new_thumb_img.push(image_thumb); + imgGroup.push(image_thumb); + + that.setData({ + thumb_img: new_thumb_img, + image: new_img, + imgGroup: imgGroup + }) + } + }) + } + } + } + }); + }, + textinput: function(event) { + var content = event.detail.value; + //pinjia_text + this.setData({ + pinjia_text: content + }) + + }, + /** + * 删除图片 + */ + choseImg: function(e) { + var idx = e.currentTarget.dataset.idx; + var imgGroup = this.data.imgGroup; + var new_img = this.data.image; + new_img.splice(idx, 1); + imgGroup.splice(idx, 1); + this.setData({ + imgGroup: imgGroup, + image: new_img + }) + }, + + sub_comment: function() { + var order_id = this.data.order_id; + var goods_id = this.data.goods_id; + + var pinjia_text = this.data.pinjia_text; + var image = this.data.image; + var that = this; + + if (pinjia_text == '') { + wx.showToast({ + title: '请填写评价内容', + icon: 'success', + duration: 1000 + }) + return false; + } + wx.showLoading({ + title: '评论中', + }) + var token = wx.getStorageSync('token'); + console.log(image); + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.sub_comment', + 'token': token, + order_id: order_id, + goods_id: goods_id, + comment_content: pinjia_text, + imgs: image + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + wx.hideLoading(); + if (msg.data.code == 3) { + wx.showToast({ + title: '未登录', + icon: 'loading', + duration: 1000 + }) + } else { + wx.showToast({ + title: '评价成功', + icon: 'success', + duration: 1000, + success: function(res) { + //是否跳到积分 + wx.redirectTo({ + url: "/eaterplanet_ecommerce/pages/order/order?id=" + order_id + }) + } + }) + } + } + }) + }, + + /** + * 预览大图 + */ + bigImg: function(e) { + var t = e.currentTarget.dataset.src, + list = e.currentTarget.dataset.list; + wx.previewImage({ + current: t, + urls: list + }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + } +}) diff --git a/eaterplanet_ecommerce/pages/order/evaluate.json b/eaterplanet_ecommerce/pages/order/evaluate.json new file mode 100644 index 0000000..a903098 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/evaluate.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "评价", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "parser":"../../components/parser/parser" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/evaluate.wxml b/eaterplanet_ecommerce/pages/order/evaluate.wxml new file mode 100644 index 0000000..495b488 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/evaluate.wxml @@ -0,0 +1,38 @@ + + + + + + {{order_goods.name+' '+order_goods.option_str}} + + + + + + + + + + + + + + {{imgGroup.length?imgGroup.length+'/'+imgMax:'上传图片'}} + + + + + + + 说明: + + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/evaluate.wxss b/eaterplanet_ecommerce/pages/order/evaluate.wxss new file mode 100644 index 0000000..6ee560b --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/evaluate.wxss @@ -0,0 +1,156 @@ +.good-card { + height: 678rpx; + width: 710rpx; + border-radius: 20rpx; + background: #fff; + margin: 30rpx 20rpx; + padding-top: 20rpx; + z-index: 5; + box-shadow: 0 0 40rpx rgba(0, 0, 0, 0.1); +} + +.good-card .good { + font-size: 28rpx; + height: 102rpx; + display: flex; + align-items: center; + padding: 0rpx 20rpx 20rpx 20rpx; + background: #fff; + border-bottom: 0.1rpx solid #efefef; +} + +.good-card .good image { + width: 80rpx; + height: 80rpx; + margin-right: 20rpx; +} + +.good-card .good text { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.good-card .evaluate-content { + min-height: 452rpx; + margin-bottom: 40rpx; + padding: 10rpx 26rpx; + background: #fff; +} + +.good-card .evaluate-content textarea { + width: 660rpx; + height: 320rpx; + margin-top: 10rpx; + font-size: 28rpx; +} + +.good-card .evaluate-content .placeholder-class { + color: #999; + font-size: 28rpx; +} + +.submit { + color: #fff; + font-size: 28rpx; + line-height: 96rpx; + width: 750rpx; + background: #4facfe; + text-align: center; + display: block; + position: fixed; + bottom: 0; + padding-bottom: env(safe-area-inset-bottom); +} + +.img-group { + display: flex; + flex-wrap: wrap; + font-size: 24rpx; +} + +.img-group .img-item { + margin: 0 6rpx; + width: 150rpx; + height: 150rpx; + position: relative; + box-sizing: border-box; +} + +.img-group .img-item .progress { + position: absolute; + left: 16rpx; + bottom: 20rpx; + width: 120rpx; + height: 16rpx; + border-radius: 20rpx; + border: 2rpx solid #ddd; + display: flex; + align-items: center; +} + +.img-group .img-item .progress span { + height: 8rpx; + width: 0; + max-width: 112rpx; + border-radius: 12rpx; + position: absolute; + left: 4rpx; + top: 4rpx; + background: #f5f5f5; +} + +.img-group .img-item .hide-progress { + opacity: 0; +} + +.img-group .img-item .close { + width: 32rpx; + height: 32rpx; + position: absolute; + right: -8rpx; + top: -8rpx; + z-index: 2; +} + +.img-group .img-item image { + height: 100%; + width: 100%; +} + +.img-group .img-item .closeImg { + font-size: 40rpx; + color: #a0a0a0; +} + +.img-group .img-add { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + border: 2rpx dashed #dedede; + color: #bcbcbc; +} + +.img-group .img-add .cameraImg { + width: 44rpx; + height: 44rpx; + color: #cdcdcd; + margin-bottom: 8rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.desc { + padding: 0 30rpx; + line-height: 1.6; + font-size: 26rpx; + color: #666; +} + +.desc .h2 { + font-size: 30rpx; + margin-bottom: 10rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/goods_express.js b/eaterplanet_ecommerce/pages/order/goods_express.js new file mode 100644 index 0000000..45c8a06 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/goods_express.js @@ -0,0 +1,69 @@ +// pages/order/goods_express.js +var app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, +handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + var token = wx.getStorageSync('token'); + var order_id = options.id; + wx.showLoading(); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'user.goods_express', + token: token, + order_id: order_id + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 2) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } else if (res.data.code == 0) { + let order_info = res.data.order_info; + let shipping_traces = order_info.shipping_traces; + if(shipping_traces) { + shipping_traces = shipping_traces.reverse(); + } + + that.setData({ + seller_express: res.data.seller_express, + goods_info: res.data.goods_info, + order_info, + shipping_traces + }) + + } + } + }) + + } +}) diff --git a/eaterplanet_ecommerce/pages/order/goods_express.json b/eaterplanet_ecommerce/pages/order/goods_express.json new file mode 100644 index 0000000..da8def3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/goods_express.json @@ -0,0 +1,8 @@ +{ + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTitleText": "查看物流", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/goods_express.wxml b/eaterplanet_ecommerce/pages/order/goods_express.wxml new file mode 100644 index 0000000..480fd0c --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/goods_express.wxml @@ -0,0 +1,35 @@ + + + + + + + + + 物流公司: {{seller_express.name}} + + + 运单编号: {{order_info.shipping_no}} + + + + + + + + 订单跟踪 + + + + + + + {{item.AcceptStation}} + {{item.AcceptTime}} + + + + + 暂无记录 + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/goods_express.wxss b/eaterplanet_ecommerce/pages/order/goods_express.wxss new file mode 100644 index 0000000..6c0dc58 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/goods_express.wxss @@ -0,0 +1,158 @@ +.dialog-content { + background-color: #f2f2f2; + width: 100%; +} + +.express-title { + background-color: white; + padding: 20rpx; + display: flex; +} + +.goods-express-icon { + float: left; + width: 120rpx; + height: 120rpx; +} + +.goods-express-icon image { + width: 104rpx; + height: 104rpx; +} + +.express-header { + color: #151516; + font-size: 28rpx; +} + +.express-header .span { + color: #4facfe; + margin-left: 10rpx; +} + +.express-shipper, .express-tel { + color: #9c9c9c; + font-size: 28rpx; +} + +.express-shipper .span, .express-tel .span { + margin-left: 10rpx; +} + +.express-main { + margin-top: 16rpx; + padding-top: 24rpx; + width: 100%; + overflow: hidden; + background-color: white; + position: relative; +} + +.express-main-title { + padding-left: 20rpx; + padding-bottom: 24rpx; + margin-bottom: 74rpx; + font-size: 28rpx; + color: #111; + border-bottom: 1px solid #ededed; +} + +.express-ui { + font-size: 28rpx; + position: relative; + margin: 0 0 0 40rpx; +} + +.express-ui { + list-style-type: none; +} + +.express-ui:before { + position: absolute; + line-height: 200%; + content: ""; + width: 200%; + height: 200%; + transform-origin: 0 0; + transform: scale(0.5, 0.5); + box-sizing: border-box; + -webkit-transform-origin: 0 0; + -webkit-transform: scale(0.5, 0.5); + -webkit-box-sizing: border-box; +} + +.one-expre { + position: relative; + margin: 0; + padding-left: 46rpx; + border-left: 1px solid #ddd; +} + +.express-trace-info-dot { + width: 10px; + height: 10px; + position: absolute; + border-radius: 50%; + -webkit-border-radius: 50%; + top: -5px; + left: -5px; + background-color: #ddd; +} + +.express-trace-info-dot-green { + background-color: #4facfe; + box-shadow: rgba(37, 174, 95, 0.3) 0 0 0 3px; + -webkit-box-shadow: rgba(37, 174, 95, 0.3) 0 0 0 3px; + -webkit-transform: translate(0, -0.08rem); +} + +.express-trace-info { + width: 100%; + display: inline-block; + height: 100%; + margin-top: 0; + padding-bottom: 44rpx; +} + +.express-trace-info ._trace-info { + position: relative; + display: inline-block; + margin-top: -18rpx; + padding-bottom: 30rpx; + width: 100%; + border-bottom: 1px solid #ededed; +} + +.one-expre:first-child .express-trace-info ._trace-info { + margin-top: -34rpx; +} + +.express-trace-info ._trace-info .trace-detail { + color: #9c9c9c; + line-height: 48rpx; + margin-right: 22rpx; +} + +.one-expre:first-child .express-trace-info ._trace-info .trace-detail { + color: #4facfe!important; +} + +.express-trace-info ._trace-info .trace-time { + color: #9c9c9c; + font-size: 24rpx; + line-height: 24rpx; + margin-top: 12rpx; + margin-right: 20rpx; +} + +.one-expre:first-child .express-trace-info ._trace-info .trace-time { + color: #4facfe!important; +} + +page { + background-color: #fff; +} + +.one-expre:last-child { + border-left: none !important; +} diff --git a/eaterplanet_ecommerce/pages/order/index.js b/eaterplanet_ecommerce/pages/order/index.js new file mode 100644 index 0000000..2fc7dc3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/index.js @@ -0,0 +1,322 @@ +var app = getApp(); +var util = require('../../utils/util.js'); +var canpay = true; + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + tablebar: 4, + page: 1, + theme_type: '', + order_status: -1, + no_order: 0, + hide_tip: true, + order: [], + tip: '正在加载', + is_empty: false, + tabs: [ + { id: -1, name: '全部' }, + { id: 3, name: '待付款' }, + { id: 1, name: '待配送' }, + { id: 14, name: '配送中' }, + { id: 4, name: '待提货' }, + { id: 6, name: '已提货' } + ], + hexiaoStatus: ['','','','待付款','待使用','','','','','','','已完成'] + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + onLoad: function(options) { + let { order_status, is_show_tip, isfail } = options; + + wx.showLoading(); + + if (order_status == undefined) { + order_status = -1; + } + this.setData({ + order_status: order_status, + }) + + if (is_show_tip != undefined && is_show_tip == 1) { + wx.showToast({ + title: '支付成功', + }) + } else if (isfail != undefined && isfail == 1) { + wx.showToast({ + title: '支付失败', + icon: 'none' + }) + } + this.getData(); + }, + + getData: function() { + this.setData({ isHideLoadMore: true }) + this.data.no_order = 1 + let that = this; + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.orderlist', + token: token, + page: that.data.page, + order_status: that.data.order_status + }, + dataType: 'json', + success: function(res) { + wx.hideLoading(); + if (res.data.code == 0) { + let rushList = that.data.order.concat(res.data.data); + that.setData({ + order: rushList, + hide_tip: true, + no_order: 0 + }); + } else { + if(that.data.page == 1 && that.data.order.length <= 0) that.setData({is_empty: true}); + that.setData({ + isHideLoadMore: true + }) + return false; + } + } + }) + + }, + + goOrder: function(event) { + let id = event.currentTarget.dataset.type; + var pages_all = getCurrentPages(); + let delivery = event.currentTarget.dataset.delivery || ''; + let url = `/eaterplanet_ecommerce/pages/order/order?id=${id}&delivery=${delivery}`; + if (pages_all.length > 3) { + wx.redirectTo({ url }) + } else { + wx.navigateTo({ url }) + } + }, + + receivOrder: function(event) { + let id = event.currentTarget.dataset.type; + let delivery = event.currentTarget.dataset.delivery; + var token = wx.getStorageSync('token'); + if (delivery == "pickup") content = "确认提货"; + var that = this; + wx.showModal({ + title: '提示', + content: '确认收货', + confirmColor: "#4facfe", + success(res) { + if (res.confirm) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.receive_order', + token: token, + order_id: id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + wx.showToast({ + title: '收货成功', + icon: 'success', + duration: 1000 + }) + that.order(that.data.order_status); + } + } + }) + } + } + }) + + }, + cancelOrder: function(event) { + let id = event.currentTarget.dataset.type; + var token = wx.getStorageSync('token'); + var that = this; + wx.showModal({ + title: '取消支付', + content: '好不容易挑出来,确定要取消吗?', + confirmColor: "#4facfe", + success(res) { + if (res.confirm) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.cancel_order', + token: token, + order_id: id + }, + dataType: 'json', + success: function (res) { + wx.showToast({ + title: '取消成功', + icon: 'success', + duration: 1000 + }) + that.order(that.data.order_status); + } + }) + } + } + }) + }, + + getOrder: function(event) { + this.setData({ is_empty: false }) + wx.showLoading(); + let starus = event.currentTarget.dataset.type; + this.order(starus); + }, + + order: function(starus) { + var that = this; + that.setData({ + order_status: starus, + order: [], + no_order: 0, + page: 1 + }) + this.getData(); + }, + + /** + * 支付防抖 + */ + preOrderPay: util.debounce(function(event) { + canpay&&this.orderPay(event); + }), + + orderPay: function(event) { + canpay = false; + let that = this; + var token = wx.getStorageSync('token'); + let id = event[0].currentTarget.dataset.type; + let delivery = event[0].currentTarget.dataset.delivery; + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.wxpay', + token: token, + order_id: id, + scene: app.globalData.scene + }, + dataType: 'json', + method: 'POST', + success: function(res) { + if(res.data.code ==0) + { + var is_pin = res.data.is_pin; + // 交易组件 + if(res.data.isRequestOrderPayment==1) { + wx.requestOrderPayment({ + orderInfo: res.data.order_info, + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: res.data.signType, + paySign: res.data.paySign, + success: function (wxres) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + id + '&is_show=1&delivery='+delivery + }) + }, + fail: function (res) { + console.log(res); + }, + complete: ()=>{ + canpay = true; + } + }) + } else { + wx.requestPayment({ + appId: res.data.appId, + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: res.data.signType, + paySign: res.data.paySign, + success: function (wxres) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + id + '&is_show=1&delivery='+delivery + }) + }, + fail: function (res) { + console.log(res); + }, + complete: ()=>{ + canpay = true; + } + }) + } + } else if (res.data.code == 1) { + wx.showToast({ + title: res.data.RETURN_MSG || '支付错误', + icon: 'none' + }) + canpay = true; + } else if (res.data.code == 2) { + wx.showToast({ + title: res.data.msg, + icon:'none' + }) + canpay = true; + setTimeout(() => { + that.setData({ + page: 1, + no_order: 0, + order: [], + tip: '正在加载', + is_empty: false + }, ()=>{ + that.getData(); + }) + }, 1500); + } + }, + fail: ()=>{ + canpay = true; + } + }) + }, + + onReachBottom: function() { + if (this.data.no_order == 1) return false; + this.data.page += 1; + this.getData(); + this.setData({ + isHideLoadMore: false + }) + }, + + onPullDownRefresh: function () { + this.setData({ + is_empty: false, + page: 1, + order: [] + }) + wx.showLoading(); + this.getData(); + wx.stopPullDownRefresh(); + } +}) diff --git a/eaterplanet_ecommerce/pages/order/index.json b/eaterplanet_ecommerce/pages/order/index.json new file mode 100644 index 0000000..72d99d6 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/index.json @@ -0,0 +1,12 @@ +{ + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "我的订单", + "navigationBarTextStyle": "black", + "enablePullDownRefresh": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-card": "../../components/card/index", + "i-loadMore": "../../components/load-more/index", + "i-img": "../../components/img/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/index.wxml b/eaterplanet_ecommerce/pages/order/index.wxml new file mode 100644 index 0000000..c540921 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/index.wxml @@ -0,0 +1,86 @@ + + + + + + {{item.name}} + + + + + + + + + + 下单时间: + {{item.createTime}} + + + {{hexiaoStatus[item.order_status_id]}} + {{item.status_name}} + + + + + + + + 拼团 + {{item.goods_list[0].name}} + + {{item.goods_list[0].option_str}} x {{item.goods_list[0].quantity}} + ¥{{item.goods_list[0].price}} ¥{{item.goods_list[0].orign_price}} + + + + + + + + + + + + + + + 共 + {{item.goods_list.length}} 件商品 + 实付: + + ¥{{item.shipping_fare}} + {{item.score}}积分 + + + ¥{{item.total}} + + + + + 取消订单 + + 立即支付 + + + + 去使用 + + {{item.delivery=="pickup"?"确认提货":"确认收货"}} + + + + + 查看详情 + + + + + + + + 暂无任何订单记录~ + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/index.wxss b/eaterplanet_ecommerce/pages/order/index.wxss new file mode 100644 index 0000000..e928d50 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/index.wxss @@ -0,0 +1,724 @@ +.tabs { + box-sizing: border-box; + position: relative; + overflow: hidden; + zoom: 1; + color: #666; +} + +.tabs-bar, .tabs-link-bar { + box-sizing: border-box; +} + +.tabs-bar { + outline: none; + width: 100%; + background-color: #fff; +} + +.tabs-nav--container { + overflow: hidden; + font-size: 0.75rem; + line-height: 1.5rem; + box-sizing: border-box; + position: relative; + white-space: nowrap; + margin-bottom: -1px; + zoom: 1; +} + +.tabs-nav--container:after, .tabs-nav--container:before { + content: " "; + display: table; +} + +.tabs-nav--container:after { + clear: both; + visibility: hidden; + font-size: 0; + height: 0; +} + +.tabs.tabs-card>.tabs-bar .tabs-nav--wrap { + margin-bottom: 0; +} + +.tabs-nav--wrap { + overflow: hidden; + margin-bottom: -.01rem; +} + +.tabs-nav { + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding-left: 0; + -webkit-transition: -webkit-transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: -webkit-transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1), + -webkit-transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); + position: relative; + margin: 0; + list-style: none; + justify-content: space-around; +} + +.tabs-nav:after, .tabs-nav:before { + display: table; + content: " "; +} + +.tabs-nav:after { + clear: both; +} + +.tabs-nav .tabs-tab { + display: block; + height: 2.2rem; + line-height: 2.2rem; + margin: 0 5px; + -moz-box-sizing: border-box; + box-sizing: border-box; + position: relative; + -webkit-transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + cursor: pointer; + text-decoration: none; + text-align: center; + font-size: 28rpx; + color: #333; +} + +.tabs-nav .tabs-tab-active { + color: #4facfe; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab { + margin: 0; + border: 1px solid #d9d9d9; + border-bottom: 0; + border-radius: 0.06rem 0.06rem 0 0; + transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + background: #f9f9f9; + margin-right: 0.02rem; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab-active { + background: #fff; + color: #4facfe; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab-active { + color: #4facfe; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab.list-line { + border: 0; + background: #fff; +} + +.tabs:not(.tabs-vertical) .tabs-content-animated { + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + -moz-box-orient: horizontal; + -moz-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + will-change: transform; + transition: -webkit-transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), + -webkit-transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); +} + +.tabs:not(.tabs-vertical) .tabs-tabpane { + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + width: 100%; +} + +.meili-all-vue-base-goodswall .module-list-wrap { + display: block !important; +} + +.meili-all-vue-base-goodswall .module-list-wrap[data-v-498b2138] { + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + overflow: hidden; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-flow: row wrap; + -moz-box-orient: horizontal; + -moz-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; +} + +.meili-all-vue-base-goodswall .show { + height: auto !important; +} + +.meili-all-vue-base-goodswall .module-item-wrap { + width: 100%; + margin-bottom: 10rpx; +} + +.order { + width: 100%; + background: #fff; +} + +.order-panel { + padding: 0 10px; +} + +.shop-product, .shop-title { + padding: 0 10px; + margin: 0 -10px; +} + +.shop-title image { + width: 40rpx; + height: 40rpx; + border-radius: 100%; + display: inline-block; + vertical-align: top; + margin-top: 20rpx; + margin-right: 10rpx; +} + +.no_order { + margin-top: 30%; + text-align: center; +} + +.shop-title { + border: 1px solid #e5e5e5; + border-right: none; + border-left: none; + font-size: 28rpx; + height: 90rpx; + line-height: 90rpx; +} + +.shop:first-child .shop-title { + border-top: none; +} + +.shop-title--name { + color: #333; + display: inline-block; + max-width: 10rem; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.shop-title--status { + float: right; + margin-left: 0.2rem; + color: #4facfe; + white-space: nowrap; +} + +.shop-product, .shop-title { + padding: 0 10px; + margin: 0 -10px; +} + +.product { + border-bottom: 1px solid #ddd; + min-height: 1.8rem; +} + +.product-list { + padding: 10px 0; +} + +.product.is-noborder { + border: none; +} + +.product-wrap { + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; +} + +.product-pic { + width: 150rpx; + height: 150rpx; + display: inline-block; +} + +.product-pic image { + width: 150rpx; + height: 150rpx; + visibility: inherit; + display: inherit; +} + +.product-des { + -webkit-box-flex: 1; + -webkit-flex: 1; + -moz-box-flex: 1; + -ms-flex: 1; + flex: 1; + margin: 0 10px; + position: relative; +} + +.red { + color: #4facfe; + padding-right: 5rpx; +} + +.product-des--name { + color: #333; + font-size: 28rpx; + height: 46px; + text-overflow: ellipsis; + overflow: hidden; + display: block; + margin-bottom: 14px; + font-weight: 400; +} + +.product-des--sku { + margin-bottom: 5px; + font-size: 24rpx; + color: #999; +} + +.meili-all-order-list-order-shop .product-des--sku view { + display: inline-block; + margin-right: 5px; +} + +.product-price { + text-align: right; + line-height: 1rem; + font-size: 24rpx; +} + +.product-price--origin { + text-decoration: line-through; + color: #999; +} + +.product-price--number { + color: #999; +} + +.order-panel--operate { + border-top: 1px solid #e5e5e5; + margin: 0 -10px; + vertical-align: middle; + text-align: right; +} + +.operate-button { + overflow: hidden; +} + +.meili-all-vue-base-button { + display: inline-block; + -moz-box-sizing: border-box; + box-sizing: border-box; + font-size: 0.75rem; + padding: 5px 10px; + border-radius: 5px; + vertical-align: middle; + margin: 10px 5px; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + min-width: 5rem; + text-align: center; +} + +.primary { + color: #fff; + background: #4facfe; +} + +.operate-button .meili-all-vue-base-button { + width: 6rem; + height: 1.8rem; + line-height: 1.8rem; + font-size: 0.75rem; + padding: 0; + margin: 10px; + border-radius: 5px; +} + +.operate-button--white.primary { + color: #666; + border: 1px solid #999; + background: #fdfdfd; +} + +.buy { + margin-bottom: 116rpxpx; +} + +.order-panel--price { + margin: 0 -10px; + padding: 10px; + border-top: 1px solid #e5e5e5; + text-align: right; + color: #999; +} + +.pay { + color: #333; +} + +.pay-delivery { + margin-right: -5px; + font-size: 0.75rem; +} + +.pay-price { + line-height: 1rem; + font-size: 0.75rem; +} + +.pay-price--content { + font-size: 0.75rem; + color: #4facfe; +} + +.weui-loading { + margin: 0 5px; + width: 20px; + height: 20px; + display: inline-block; + vertical-align: middle; + -webkit-animation: weuiLoading 1s steps(12, end) infinite; + animation: weuiLoading 1s steps(12, end) infinite; + background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat; + background-size: 100%; +} + +.weui-loadmore { + width: 65%; + margin: 1.5em auto; + line-height: 1.6em; + font-size: 14px; + text-align: center; +} + +.weui-loadmore__tips { + display: inline-block; + vertical-align: middle; +} + +/* lottery begin */ + +.orders-lottery-status { + z-index: 99; + position: absolute; + width: 67px; + height: 67px; + right: 12px; + top: 7px; +} + +.order-lottery-lucky,.order-lottery-not,.order-lottery-wait { + background-image: url(https://wxapp.ch871.com/Common/image/sprites_stamps-02e13e88f3.png); + background-repeat: no-repeat; + background-size: 299.83425px 299.83425px; + background-position: -199.8895px -99.94475px; +} + +.order-lottery-lucky { + background-position: -99.94475px 0; +} + +.order-lottery-not { + background-position: -199.8895px 0; +} + +.order-lottery-wait { + background-position: -199.8895px -99.94475px; +} + +/* lottery end */ + +/* 20181206 */ + +.nav-bar { + width: 100%; + position: fixed; + left: 0; + top: 0; + z-index: 10; +} + +.nav-bar .nav-bar-inner { + display: flex; + justify-content: space-between; + padding: 0 40rpx; + background-color: white; +} + +.nav-bar .nav-bar-item { + position: relative; + word-break: keep-all; + font-size: 28rpx; + font-weight: 500; + color: #666; + padding: 20rpx 0; + +} + +.nav-bar .current.nav-bar-item::after { + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 3px; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(255,89,0,0.25); + border-radius: 24rpx; +} + +.nav-bar-content { + margin-top:49px; + padding-bottom: 30rpx; +} + +.mar-right-10 { + margin-right: 20rpx; +} + +.card { + margin-bottom: 20rpx; + margin-left: 20rpx; + color: #444; +} + +.card .card-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx; + font-size: 24rpx; +} + +.card .card-content { + padding: 30rpx; + border-top: 0.1rpx solid #efefef; + border-bottom: 0.1rpx solid #efefef; +} + +.card .card-content .content-wrap { + display: flex; + align-items: center; + justify-content: space-between; +} + +.card .card-content .show-img { + float: left; + width: 120rpx !important; + height: 120rpx !important; +} + +.clearfix:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; +} + +.card .card-content .dot { + display: flex; + align-items: center; + justify-content: space-between; +} + +.card .card-content .dot .dot-item { + width: 12rpx; + height: 12rpx; + border-radius: 50%; + background: #d8d8d8; +} + +.card .card-content .dot .dot-middle { + margin: 0 10rpx; +} + +.card .card-footer { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx; + font-size: 24rpx; +} + +.card .card-footer .money { + font-family: DIN; + font-size: 32rpx; + font-weight: bold; + display: inline-block; +} + +.card .card-footer .accual-pay { + display: inline-block; +} + +.empty-wrap { + padding-top: 300rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.empty-wrap .empty-img { + width: 218rpx; + height: 218rpx; +} + +.empty-wrap .empty-txt { + font-size: 30rpx; + font-weight: 400; + color: #777; + margin-top: 32rpx; +} + +.padding-15 { + margin-left: 16rpx; +} + +.button-group { + display: flex; + justify-content: space-between; +} + +.my-button { + position: relative; + color: #666; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + text-align: center; +} + +.my-button::after { + box-sizing: border-box; + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + transform: scale(0.5); + transform-origin: 0 0; + border: 2rpx solid #b6b6b6; + border-radius: 52rpx; + pointer-events: none; +} + +.get-goods { + display: flex; + justify-content: space-between; + align-items: center; +} + +.get-goods .sure-get { + color: #aaa; +} + +.my-button-pay { + position: relative; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + text-align: center; + color: white; + border: none; + border-radius: 26rpx; + background: linear-gradient(100deg, #ff758c 0%, #ff7eb3 100%); +} + +.right-arrow { + width: 12rpx; + height: 22rpx; + margin-left: 10rpx; +} + +.bold { + font-weight: 500; +} + +.red { + color: #4facfe; + font-size: 24rpx; +} + +.gray { + color: #aaa; +} + +.name { + width: 510rpx; + font-size: 26rpx; + color: #444; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.pintag { + background: linear-gradient(to right, #ff5041, #ff695c); + color: #fff; + font-size: 20rpx; + padding: 1rpx 8rpx; + border-radius: 6rpx; + font-weight: bold; + margin-right: 10rpx; +} + +.mount { + font-size: 22rpx; + color: #aaa; + margin-top: 10rpx; +} + +.bottom-info { + justify-content: space-between; + font-size: 28rpx; + color: #444; + margin-top: 18rpx; +} + +.bottom-info text { + text-decoration: line-through; + color: #999; + font-size: 22rpx; +} diff --git a/eaterplanet_ecommerce/pages/order/order.js b/eaterplanet_ecommerce/pages/order/order.js new file mode 100644 index 0000000..db50177 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/order.js @@ -0,0 +1,862 @@ +var util = require('../../utils/util.js'); +var app = getApp(); +var status = require('../../utils/index.js'); +var location = require("../../utils/Location"); +var canpay = true; + +function count_down(that, total_micro_second) { + var second = Math.floor(total_micro_second / 1000); + var days = second / 3600 / 24; + var daysRound = Math.floor(days); + var hours = second / 3600 - (24 * daysRound); + var hoursRound = Math.floor(hours); + var minutes = second / 60 - (24 * 60 * daysRound) - (60 * hoursRound); + var minutesRound = Math.floor(minutes); + var seconds = second - (24 * 3600 * daysRound) - (3600 * hoursRound) - (60 * minutesRound); + + that.setData({ + endtime: { + days: daysRound, + hours: fill_zero_prefix(hoursRound), + minutes: fill_zero_prefix(minutesRound), + seconds: fill_zero_prefix(seconds), + show_detail: 1 + } + }); + + if (total_micro_second <= 0) { + that.setData({ + changeState: 1, + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + } + }); + return; + } + + setTimeout(function() { + total_micro_second -= 1000; + count_down(that, total_micro_second); + }, 1000) + +} +// 位数不足补零 +function fill_zero_prefix(num) { + return num < 10 ? "0" + num : num +} + +Page({ + mixins: [require('../../mixin/compoentCartMixin.js'), require('../../mixin/globalMixin.js')], + data: { + endtime: { + days: "00", + hours: "00", + minutes: "00", + seconds: "00", + }, + cancelOrderVisible: false, + orderSkuResps: [], + tablebar: 4, + navState: 0, + theme_type: '', + loadover: false, + pingtai_deal: 0, + is_show: false, + order: {}, + common_header_backgroundimage: '', + isShowModal: false, + userInfo: {}, + groupInfo: { + group_name: '社区', + owner_name: '团长', + delivery_ziti_name: '社区自提', + delivery_tuanzshipping_name: '团长配送', + delivery_express_name: '快递配送', + localtown_modifypickingname: '包装费' + }, + is_show_guess_like: 1, + showRefundModal: false, + order_hexiao_type: 0, //0订单,1按次,2混合 + salesroomIdx: 0, + order_goods_list: '', + hx_receive_info: '', + salesroom_list: '', + goodsHexiaoIdx: 0, + share_title: '', + presale_info: '', + presalePickup: { + pickup: '自提', localtown_delivery:'配送', express:'发货', hexiao: '核销', tuanz_send: '配送' + }, + showPresalePayModal: false + }, + is_show_tip: '', + timeOut: function() { + console.log('计时完成') + }, + options: '', + canCancel: true, + isFirst: 1, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + onLoad: function(options) { + var that = this; + that.options = options; + + var userInfo = wx.getStorageSync('userInfo'); + userInfo && (userInfo.shareNickName = userInfo.nickName.length > 3 ? userInfo.nickName.substr(0, 3) + "..." : userInfo.nickName); + status.setGroupInfo().then((groupInfo) => { + that.setData({ + groupInfo + }) + }); + util.check_login() ? this.setData({ + needAuth: false + }) : this.setData({ + needAuth: true + }); + let delivery = options.delivery || ''; + that.setData({ + userInfo, + delivery + }); + + // wx.showLoading(); + var is_show_tip = options && options.is_show || 0; + let isfail = options && options.isfail || ''; + this.is_show_tip = is_show_tip; + + if (isfail != undefined && isfail == 1) { + wx.showToast({ + title: '支付失败', + icon: 'none' + }) + } + + let latitude = wx.getStorageSync('latitude2') || ''; + let longitude = wx.getStorageSync('longitude2') || ''; + if(delivery=='hexiao'&&!latitude) { + this.getMyLocal().then(res=>{ + this.getData(options.id, res.latitude, res.longitude, is_show_tip, delivery); + }).catch(()=>{ + this.getData(options.id, latitude, longitude, is_show_tip, delivery); + }); + } else { + console.log('step2') + this.getData(options.id, latitude, longitude, is_show_tip, delivery); + } + }, + + getData: function(id, latitude="", longitude="", is_show_tip='', delivery=''){ + if (is_show_tip != undefined && is_show_tip == 1) { + //todo 弹出分享 + } else { + wx.showLoading(); + } + var that = this; + var token = wx.getStorageSync('token'); + + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'order.order_info', + token, + id, + latitude, + longitude + }, + dataType: 'json', + method: 'POST', + success: function(res) { + setTimeout(() => { + wx.hideLoading(); + }, 1000); + if(res.data.code==0){ + let order_info = res.data.data.order_info; + if (is_show_tip != undefined && is_show_tip == 1 && order_info.type == 'integral') { + wx.showToast({ + title: '兑换成功' + }) + } else if (is_show_tip != undefined && is_show_tip == 1) { + if (res.data.order_pay_after_share == 1) { + let share_img = res.data.data.share_img; + let share_title = res.data.data.share_title; + that.setData({ + share_title, + share_img, + isShowModal: true + }) + } else { + wx.showToast({ + title: '支付成功' + }) + } + } + + if (order_info.order_status_id == 3) { + var seconds = (order_info.over_buy_time - order_info.cur_time) * 1000; + if (seconds > 0) { + count_down(that, seconds); + } else { + order_info.open_auto_delete == 1 && that.setData({ + changeState: 1 + }) + } + } + let { + pingtai_deal, + order_refund, + order_can_del_cancle, + is_hidden_orderlist_phone, + is_show_guess_like, + user_service_switch, + common_header_backgroundimage, + order_can_shen_refund, + order_note_open, + order_note_name, + open_comment_gift, + presale_info, + virtualcard_info + } = res.data; + let order = res.data.data || {order_info: {}}; + order.order_info.order_note_open = order_note_open || ''; + order.order_info.order_note_name = order_note_name || ''; + let markers = []; + // if(delivery=='hexiao'&&order.order_info.salesroom_list) { + // let marker = that.createMarker(order.order_info.salesroom_list[0].lat, order.order_info.salesroom_list[0].lon); + // markers.push(marker) + // } + + let order_goods_list = order.order_goods_list || ''; + let hx_receive_info = order.order_info.hx_receive_info || ''; + let salesroom_list = order.salesroom_list || ''; + + // 预售订单 + presale_info = Object.keys(presale_info).length>0 ? presale_info : ''; + if(presale_info) { + if(presale_info.presale_type==0) { + let goodsTot = 0; + order_goods_list.forEach(goodsItem=>{ goodsTot += goodsItem.price*goodsItem.quantity; }); + let { presale_deduction_money, presale_ding_money } = presale_info; + presale_deduction_money = presale_deduction_money>0?presale_deduction_money:presale_ding_money; + let payTot = order.order_info.total*1-presale_deduction_money*1; + presale_info.payTot = payTot>0?payTot.toFixed(2):0; + let weikuan = goodsTot - presale_deduction_money*1; + presale_info.weikuan = weikuan>0?weikuan.toFixed(2):0; + presale_info.presale_deduction_money = presale_deduction_money; + } + } + + // 礼品卡 + virtualcard_info = Object.keys(virtualcard_info).length>0 ? virtualcard_info : ''; + + that.setData({ + order, + order_goods_list, + hx_receive_info, + salesroom_list, + pingtai_deal: pingtai_deal, + order_refund: order_refund, + order_can_del_cancle: order_can_del_cancle, + loadover: true, + is_show: 1, + hide_lding: true, + is_hidden_orderlist_phone: is_hidden_orderlist_phone || 0, + is_show_guess_like: is_show_guess_like || 0, + user_service_switch: user_service_switch || 1, + common_header_backgroundimage, + order_can_shen_refund, + open_comment_gift, + latitude, + longitude, + markers, + presale_info, + virtualcard_info + }) + that.caclGoodsTot(res.data.data); + that.hide_lding(); + } else if(res.data.code==2){ + that.setData({ needAuth: true }) + } + } + }) + }, + + onShow: function(){ + console.log(this.isFirst, 'onShow', this.options.id); + if (this.isFirst>1) this.reload_data(); + this.isFirst++; + }, + + onHide: function(){ + console.log('order Hide'); + }, + + getMyLocal: function() { + let that = this; + return new Promise((resovle, reject)=>{ + location.getGps().then(ret=>{ + console.log('step1') + wx.getLocation({ + type: 'wgs84', + success: (res) => { + resovle(res) + that.setData({ + scale: 12, + longitude: res.longitude, + latitude: res.latitude + }) + }, + fail: ()=>{ + reject(); + } + }); + }).catch(()=>{ + console.log('step3') + reject(); + app.util.message('地图功能开启失败,部分功能受影响', '', 'error'); + }) + }) + }, + + caclGoodsTot: function(order){ + if(order && order.order_goods_list) { + let order_goods_list = order.order_goods_list; + let goodsTot = 0; + Object.keys(order_goods_list).forEach(k=>{ + if(order_goods_list[k].is_vipcard_buy==1 || order_goods_list[k].is_level_buy) { + goodsTot += order_goods_list[k].total; + } else { + goodsTot += order_goods_list[k].real_total; + } + }) + this.setData({ goodsTot: goodsTot.toFixed(2) }) + } + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + this.onLoad(this.options); + }, + + reload_data: function() { + console.log('reload_data--', this.options.id); + var that = this; + var token = wx.getStorageSync('token'); + let id = this.options.id || ''; + let latitude = wx.getStorageSync('latitude2'); + let longitude = wx.getStorageSync('longitude2'); + // this.getData(id, latitude, longitude, '', this.data.delivery) + + id && app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'order.order_info', + token, + id, + latitude, + longitude + }, + dataType: 'json', + method: 'POST', + success: function(res) { + let order_info = res.data.data.order_info; + if (order_info.order_status_id == 3) { + var seconds = (order_info.over_buy_time - order_info.cur_time) * 1000; + if (seconds > 0) { + count_down(that, seconds); + } else { + that.setData({ + changeState: 1 + }) + } + } + that.setData({ + order: res.data.data, + pingtai_deal: res.data.pingtai_deal, + order_refund: res.data.order_refund, + loadover: true, + is_show: 1, + hide_lding: true + }) + } + }) + }, + + receivOrder: function(event) { + let id = event.currentTarget.dataset.type || ''; + var token = wx.getStorageSync('token'); + var that = this; + var that = this; + wx.showModal({ + title: '提示', + content: '确认收货', + confirmColor: '#4facfe', + success(res) { + if (res.confirm) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.receive_order', + token: token, + order_id: id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + wx.showToast({ + title: '收货成功', + icon: 'success', + duration: 1000 + }) + that.reload_data(); + } else { + app.util.message(res.data.msg||'收货失败', '', 'error'); + } + } + }) + } + } + }) + }, + + callDialog: function(e) { + var order_id = e.currentTarget.dataset.type || ''; + var token = wx.getStorageSync('token'); + wx.showModal({ + title: '取消支付', + content: '好不容易挑出来,确定要取消吗?', + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.cancel_order', + token: token, + order_id: order_id + }, + dataType: 'json', + success: function(res) { + wx.showToast({ + title: '取消成功', + icon: 'success', + complete: function() { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index' + }) + } + }) + } + }) + } + } + }) + }, + + applyForService: function(e) { + var order_id = e.currentTarget.dataset.type || ''; + var order_goods_id = e.currentTarget.dataset.order_goods_id; + + order_id && wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/refund?id=' + order_id + '&order_goods_id=' + order_goods_id + '&delivery=' + this.data.delivery + }) + + }, + + /** + * 支付防抖 + */ + // preOrderPay: util.debounce(function(event) { + // canpay && this.payNow(event); + // }), + preOrderPay: function(event) { + canpay && this.payNow(event); + }, + + payNow: function(e) { + canpay = false; + let that = this; + var order_id = e.currentTarget.dataset.type || ''; + var token = wx.getStorageSync('token'); + + order_id && app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'car.wxpay', + token, + order_id, + scene: app.globalData.scene + }, + dataType: 'json', + method: 'POST', + success: function(res) { + if (res.data.code == 0) { + // 交易组件 + if(res.data.isRequestOrderPayment==1) { + wx.requestOrderPayment({ + orderInfo: res.data.order_info, + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: res.data.signType, + paySign: res.data.paySign, + success: function(wxres) { + canpay = true; + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&is_show=1&delivery='+that.data.delivery + }) + }, + 'fail': function(res) { + canpay = true; + console.log(res); + } + }) + } else { + wx.requestPayment({ + "appId": res.data.appId, + "timeStamp": res.data.timeStamp, + "nonceStr": res.data.nonceStr, + "package": res.data.package, + "signType": res.data.signType, + "paySign": res.data.paySign, + 'success': function(wxres) { + canpay = true; + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&is_show=1&delivery='+that.data.delivery + }) + }, + 'fail': function(res) { + canpay = true; + console.log(res); + } + }) + } + } else if (res.data.code == 1) { + wx.showToast({ + title: res.data.RETURN_MSG || '支付错误', + icon: 'none' + }) + canpay = true; + } else if (res.data.code == 2) { + wx.showToast({ + title: res.data.msg, + icon: 'none' + }) + setTimeout(() => { + canpay = true; + that.reload_data(); + }, 1500); + } + }, + fail: ()=>{ + canpay = true; + } + }) + }, + + hide_lding: function() { + wx.hideLoading(); + this.setData({ + is_show: true + }) + }, + + call_mobile: function(event) { + let mobile = event.currentTarget.dataset.mobile; + wx.makePhoneCall({ + phoneNumber: mobile + }) + }, + + goComment: function(event) { + let id = event.currentTarget.dataset.type; + let order_goods_id = event.currentTarget.dataset.order_goods_id; + var goods_id = event.currentTarget.dataset.goods_id; + + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/evaluate?id=' + id + '&goods_id=' + goods_id + '&order_goods_id=' + order_goods_id + }) + } else { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/order/evaluate?id=' + id + '&goods_id=' + goods_id + '&order_goods_id=' + order_goods_id + }) + } + + }, + + gokefu: function(event) { + let id = event.currentTarget.dataset.s_id; + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/pages/im/index?id=' + id + }) + } else { + wx.navigateTo({ + url: '/pages/im/index?id=' + id + }) + } + + + }, + + goRefund: function(event) { + let id = event.currentTarget.dataset.id || 0; + if(id) { + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: `/eaterplanet_ecommerce/pages/order/refunddetail?id=${id}` + }) + } else { + wx.navigateTo({ + url: `/eaterplanet_ecommerce/pages/order/refunddetail?id=${id}` + }) + } + } + }, + + closeModal: function(event) { + let h = {}; + let type = event.currentTarget.dataset.type || 0; + if(type==1) { + h.showRefundModal = false; + } else { + h.isShowModal = false; + } + this.setData(h) + }, + + //取消订单 + cancelOrder: function(e){ + let that = this; + this.canCancel && wx.showModal({ + title: '取消订单并退款', + content: '取消订单后,款项将原路退回到您的支付账户;详情请查看退款进度。', + confirmText: '取消订单', + confirmColor: '#ff5344', + cancelText: '再等等', + cancelColor: '#666666', + success(res) { + if (res.confirm) { + that.canCancel = false; + let order_id = e.currentTarget.dataset.type; + let token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.del_cancle_order', + token, + order_id + }, + dataType: 'json', + method: 'POST', + success: function (res) { + if(res.data.code==0){ + //提交成功 + wx.showModal({ + title: '提示', + content: '取消订单成功', + showCancel: false, + confirmColor: '#ff5344', + success(ret) { + if(ret.confirm) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index' + }) + } + } + }) + } else { + that.canCancel = true; + wx.showToast({ + title: res.data.msg || '取消订单失败', + icon: 'none' + }) + } + } + }) + console.log('用户点击确定') + } else if (res.cancel) { + that.canCancel = true; + console.log('用户点击取消') + } + } + }) + }, + + /** + * 弹窗显示退款信息 + * @param {*} res + */ + showRefundInfo: function(e) { + let idx = e.currentTarget.dataset.idx; + let hasrefund = e.currentTarget.dataset.hasrefund; + if(hasrefund>0) { + let order = this.data.order; + let refundGoodsInfo = order.order_goods_list[idx]; + this.setData({ + showRefundModal: true, + refundGoodsInfo + }) + } + }, + + /** + * 查看地图 + */ + gotoMap: function (e) { + let tot = e.currentTarget.dataset.tot || ''; + let longitude = ''; + let latitude = ''; + let name = ''; + let address = ''; + if(tot==1) { + let salesroom_list = this.data.order.order_info.salesroom_list; + let salesroomIdx = this.data.salesroomIdx; + longitude = salesroom_list[salesroomIdx].lon; + latitude = salesroom_list[salesroomIdx].lat; + name = salesroom_list[salesroomIdx].room_name; + address = salesroom_list[salesroomIdx].room_address; + } else { + longitude = e.currentTarget.dataset.lon; + latitude = e.currentTarget.dataset.lat; + name = e.currentTarget.dataset.name; + address = e.currentTarget.dataset.address; + } + + wx.openLocation({ + latitude: parseFloat(latitude), + longitude: parseFloat(longitude), + name, + address, + scale: 28 + }) + }, + + createMarker: function(latitude, longitude){ + let marker = { + iconPath: "../../images/location-red.png", + id: '', + title: '门店', + latitude: parseFloat(latitude), + longitude: parseFloat(longitude), + label:{ + anchorX: -12, + anchorY: 0, + content: '门店' + }, + width: 30, + height: 30 + }; + return marker; + }, + + handleHexiaoModal: function() { + this.setData({ + showHexiaoModal: !this.data.showHexiaoModal + }) + }, + + changeMendian: function(e) { + let salesroomIdx = e.currentTarget.dataset.idx; + this.setData({ salesroomIdx, showHexiaoModal: !this.data.showHexiaoModal }) + }, + + handleHexiaoGoodsModal: function() { + this.setData({ + showHexiaoGoodsModal: !this.data.showHexiaoGoodsModal + }) + }, + + handleGoodsHexiao: function(e) { + let goodsHexiaoIdx = e.currentTarget.dataset.idx; + this.setData({ goodsHexiaoIdx, showHexiaoGoodsModal: true }) + }, + + hanlePresaleModal: function(e) { + this.setData({ + showPresaleDesc: !this.data.showPresaleDesc + }) + }, + + hanlePresalePayModal: function(){ + console.log(this.data.showPresalePayModal) + this.setData({ + showPresalePayModal: !this.data.showPresalePayModal + }) + }, + + copyCont: function(e) { + let data = e.currentTarget.dataset.code || ""; + data&&wx.setClipboardData({ + data, + success:function (res) { + wx.showToast({ + title: '复制成功', + }) + } + }) + }, + + goLink: function(event) { + let url = event.currentTarget.dataset.link; + let needauth = event.currentTarget.dataset.needauth || ''; + if(needauth){ if (!this.authModal()) return; } + url && wx.redirectTo({ url }) + }, + + showFanliView: function() { + let pin_rebate = this.data.order.pin_rebate || ''; + console.log(pin_rebate) + let text = ""; + if(pin_rebate&&pin_rebate.rebate_reward==1) { + text = "拼团返利赠送"+ pin_rebate.reward_amount +"积分"; + } else { + text = "拼团返利赠送余额:+"+ pin_rebate.reward_amount; + } + pin_rebate&&wx.showModal({ + title: "返利详情", + content: text, + showCancel: false, + confirmText: "我知道了" + }) + }, + + onShareAppMessage: function(res) { + var order_id = this.data.order.order_info.order_id || ''; + let goods_share_image = this.data.order.order_goods_list[0].goods_share_image; + let share_img = this.data.share_img; + let share_title = this.data.share_title; + share_title = share_title?share_title:`@${this.data.order.order_info.ziti_name}${this.data.groupInfo.owner_name},我是${this.data.userInfo.shareNickName},刚在你这里下单啦!!!`; + if (order_id && this.is_show_tip == 1) { + return { + title: share_title, + path: "eaterplanet_ecommerce/pages/order/shareOrderInfo?order_id=" + order_id, + imageUrl: share_img ? share_img : goods_share_image + }; + } + } +}) diff --git a/eaterplanet_ecommerce/pages/order/order.json b/eaterplanet_ecommerce/pages/order/order.json new file mode 100644 index 0000000..d50396c --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/order.json @@ -0,0 +1,23 @@ +{ + "navigationBarBackgroundColor": "#FFF", + "navigationBarTitleText": "订单详情", + "navigationBarTextStyle": "black", + "enablePullDownRefresh": false, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-card": "../../components/card/index", + "i-fixedBottom": "../../components/fixed-bottom/index", + "i-dialog": "../../components/dialog/index", + "i-order-info-express": "../../components/order/orderInfoExpress", + "i-goods-info": "../../components/goodsInfo/index", + "i-order-info": "../../components/orderInfo/index", + "i-modal": "../../components/modal/index", + "i-orderComment": "../../components/orderComment/index", + "i-img": "../../components/img/index", + "sku": "../../components/sku/index", + "guess-like": "../../components/guess-like/index", + "i-aside-btn": "../../components/asideBtn/index", + "s-form-show": "../../components/s-form-show/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/order.wxml b/eaterplanet_ecommerce/pages/order/order.wxml new file mode 100644 index 0000000..b8fcf58 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/order.wxml @@ -0,0 +1,717 @@ + + + + + + + + + + {{endtime.days}}天{{endtime.hours}}:{{endtime.minutes}}:{{endtime.seconds}} + + + 待付款 + + 请尽快付款,超时将被自动取消 + 请尽快付款,不然就被抢光了 + + + + + {{order.order_status_info.name}} + + 发货时间:{{presale_info.presale_sendorder_date}} + {{presale_info.presale_sendorder_afterday}}日内开始{{presalePickup[order.order_info.delivery]}} + + + 备货中 + + + + + 拼团中,已付款 + + + + 配送中 + + + + + {{order.order_status_info.name?order.order_status_info.name:"可提货"}} + + 发货时间:{{presale_info.presale_sendorder_date}} + {{presale_info.presale_sendorder_afterday}}日内开始{{presalePickup[order.order_info.delivery]}} + + + + + + 已签收 + + + + + 等待退款 + + + + 交易完成 + + + + + 售后中 + + + + + + 未在规定时间内支付,订单已取消 + 支付尾款时间:{{presale_info.balance_pay_begintime}} - {{presale_info.balance_pay_endtime}} + + 交易取消 + + + + + 已退款 + + + + + + {{order.order_status_info.name}} + 支付尾款时间:{{presale_info.balance_pay_begintime}} - {{presale_info.balance_pay_endtime}} + + + + + + + + + + + + {{order.order_info.shopname}} + + + + + + + {{goodsInfo.name}} + + {{goodsInfo.option_str}} + ¥{{goodsInfo.price}} x {{goodsInfo.quantity}} + + + 小计:¥{{goodsInfo.real_total}} + + 付尾款 + + + + {{(goodsInfo.order_refund_goods&&goodsInfo.order_refund_goods.state==3)?'退款成功':'查看售后'}} + + 退款成功 + + + 申请售后 + + + + + + + + 共{{hx_receive_info.goods_count}}{{goods_sale_unit}}商品 小计: + ¥{{goodsTot}} + + + + + + + + {{order.order_info.order_status_id==7?'已退款':'已收货'}} + {{hx_receive_info.goods_count}}{{goods_sale_unit}}商品 + + + 使用时间:{{hx_receive_info.use_time}} + 使用地址:{{hx_receive_info.salesroom_name}} + + 券码: + + + {{order.order_info.hexiao_volume_code}} 已退款 + + + + + + + + + + {{order.order_info.shopname}} + + + + + {{order.order_info.hexiao_volume_code}} + 出示二维码给店员核销 + + + + + + + + 有效期至{{goodsInfo.effect_end_time}} + 已退款 + 已过期 + + + 有效期至{{goodsInfo.effect_end_time}} + {{goodsInfo.is_refund_state==1?'已退款':'部分退款'}} + 已使用({{goodsInfo.hexiao_count-goodsInfo.remain_hexiao_count}}{{goodsInfo.hexiao_type==0?'份':'次'}}) + 未使用({{goodsInfo.remain_hexiao_count ==0?'不限':goodsInfo.remain_hexiao_count}}{{goodsInfo.hexiao_type==0?'份':'次'}}) + + + + + + + + {{goodsInfo.name}} + + {{goodsInfo.option_str}} + ¥{{goodsInfo.price}} x {{goodsInfo.quantity}} + + + 小计:¥{{goodsInfo.real_total}} + + 付尾款 + + + + {{(goodsInfo.order_refund_goods&&goodsInfo.order_refund_goods.state==3)?'退款成功':'查看售后'}} + + 退款成功 + + + 申请售后 + + + + + + + + + + + + + + + 已收货{{hx_receive_info.receive_count}}份, + 待收货{{hx_receive_info.wait_count}}份 + 已退款{{hx_receive_info.refund_goods_quantity}}份 + + {{hx_receive_info.goods_count}}{{goods_sale_unit}}商品 + + + 使用时间:{{hx_receive_info.use_time}} + 使用地址:{{hx_receive_info.salesroom_name}} + + 劵码: + + + {{item.hexiao_volume_code}} + 已过期(有效期至{{item.effect_end_time}}) + 已退款({{item.refund_quantity}}份) + + + + + + + + + 商品门店信息请点击商品右下角二维码查看 + + + + + + + + 礼品卡 + + + {{virtualcard_info.code_sn}} 复制 + + + + + + + + + {{virtualcard_info.effect_type==1?'有效期至'+virtualcard_info.effect_enddate:''}} + 已退款 + 已过期 + + + {{virtualcard_info.effect_type==1?'有效期至'+virtualcard_info.effect_enddate:''}} + {{goodsInfo.is_refund_state==1?'已退款':'部分退款'}} + 已使用 + 未使用 + + + + + + + + {{goodsInfo.name}} + + {{goodsInfo.option_str}} + ¥{{goodsInfo.price}} x {{goodsInfo.quantity}} + + + 小计:¥{{goodsInfo.real_total}} + + + + + {{(goodsInfo.order_refund_goods&&goodsInfo.order_refund_goods.state==3)?'退款成功':'查看售后'}} + + 退款成功 + + + 申请售后 + + 去使用 + + + + + + + + + + + + + {{order.order_info.order_status_id==7?'已退款':'已收货'}} + + + 使用时间:{{virtualcard_info.use_date}} + 兑换人:{{virtualcard_info.use_member_name}} + + 兑换码: + + + {{virtualcard_info.code_sn}} 已退款 + + + + + + + + + + + + + + + + + + + + + 预售信息 + + 预售价¥{{goodsTot}},付定金后再减¥{{presale_info.presale_deduction_money}},尾款需付金额¥{{presale_info.weikuan}}(若有优惠,优惠将在尾款时使用) + + + 定金({{presale_info.first_paytime>0?'已支付':'未支付'}}) + ¥{{presale_info.presale_ding_money}} + + + 尾款({{presale_info.is_unpay_ding_cancle==1?'已过期':(presale_info.second_paytime>0?'已支付':'未支付')}}) + ¥{{presale_info.weikuan}} + + + + {{presale_info.balance_pay_begintime}} - {{presale_info.balance_pay_endtime}} 开始支付尾款 + + + + {{groupInfo.delivery_express_name}} + 同城配送 + {{groupInfo.delivery_ziti_name}} + {{groupInfo.delivery_tuanzshipping_name}} + + + {{!presale_info.second_paytime&&presale_info.presale_type==0?'尾款支付成功后':''}} + {{presale_info.presale_sendorder_date}} + {{presale_info.presale_sendorder_afterday}}日内开始{{presalePickup[order.order_info.delivery]}} + + + + + + + + + + + 已取消 + + + {{presale_info.presale_sendorder_date}} + {{presale_info.presale_sendorder_afterday}}日内开始{{presalePickup[order.order_info.delivery]}} + + + 预计{{order.order_info.pick_up_time}}可提货 + 预计{{order.order_info.pick_up_time}}{{groupInfo.owner_name}}配送 + 同城配送 + {{groupInfo.delivery_express_name}} + + + {{showRealPickUpTime}}提货完成 + {{order.goods_count}}{{goods_sale_unit}}商品 + + + + + + + + + + + [预售] + 拼团 + {{goodsInfo.name}} + + + {{goodsInfo.option_str}} + ¥{{goodsInfo.price}} + 积分 x {{goodsInfo.quantity}} + + {{goodsInfo.refund_info.real_refund_quantity}}个 申请退款中 + {{goodsInfo.refund_info.real_refund_quantity}}个 退款成功 + {{goodsInfo.refund_info.real_refund_quantity}}个 退款失败 + + + + + 小计:¥{{goodsInfo.real_total}} + 积分 + + + + + + + + {{(goodsInfo.order_refund_goods&&goodsInfo.order_refund_goods.state==3)?'退款成功':'查看售后'}} + + 退款成功 + + + {{open_comment_gift==1?'评价有礼':'去评价'}} + + 申请售后 + + 备货中 + 配送中 + + + + + + + 付尾款 + 取消订单 + 返利详情 + 拼团详情 + {{order.order_info.delivery=='pickup'?"确认提货":"确认收货"}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 拼团 {{order_goods_list[refundIdx].name}} + + {{refundGoodsInfo.option_str}} + ¥{{refundGoodsInfo.price}} + 积分 x {{refundGoodsInfo.quantity}} + + + 小计:¥{{refundGoodsInfo.real_total}} + 积分 + + + + + + {{(refundGoodsInfo.order_refund_goods&&refundGoodsInfo.order_refund_goods.state==3)?'退款成功':'查看售后'}} + + 退款成功 + + + + 申请售后 + + + + + + + + 已退款({{refundGoodsInfo.has_refund_quantity}}{{goods_sale_unit}}) + {{order.goods_count}}{{goods_sale_unit}}商品 + + + + 退款时间:{{item.addtime}} + 退款金额:¥{{item.money}} + + + + + + + + + + + + + + + {{order.order_info.salesroom_list.length}} 个自提点 + + + + + + {{item.room_name}} + {{item.room_address}} + + + + + + + + + + + {{order.order_info.shopname}} + + + + + {{order_goods_list[goodsHexiaoIdx].hexiao_volume_code}} + 出示二维码给店员核销 + + + + + + {{order_goods_list[goodsHexiaoIdx].name}} + x {{order_goods_list[goodsHexiaoIdx].quantity}} + + + + + + 使用情况 + (已退款) + + (已过期 有效期至{{order_goods_list[goodsHexiaoIdx].effect_end_time}}) + + ({{order_goods_list[goodsHexiaoIdx].is_hexiao_over==1?"核销完成":"未核销完成"}}) + + + 总{{order_goods_list[goodsHexiaoIdx].hexiao_type==0?'份':'次'}}数:{{order_goods_list[goodsHexiaoIdx].hexiao_count == 0?'不限':order_goods_list[goodsHexiaoIdx].hexiao_count}}{{order_goods_list[goodsHexiaoIdx].hexiao_type==0?'份':'次'}} + 剩余{{order_goods_list[goodsHexiaoIdx].hexiao_type==0?'份':'次'}}数:{{order_goods_list[goodsHexiaoIdx].remain_hexiao_count == 0?'不限':order_goods_list[goodsHexiaoIdx].remain_hexiao_count}}{{order_goods_list[goodsHexiaoIdx].hexiao_type==0?'份':'次'}} + 已退款:{{order_goods_list[goodsHexiaoIdx].has_refund_quantity}}{{order_goods_list[goodsHexiaoIdx].hexiao_type==0?'份':'次'}} + + + + 适用门店({{order_goods_list[goodsHexiaoIdx].salesroom_list.length}}) + + + + + 门店名称:{{item.room_name}}(距你{{item.distance}}公里) + 门店地址:{{item.room_address}} + + + + + + + + + 关闭 + + + + + + + + 预售协议 + + {{presale_info.presale_agreement}} + + + + + + + + 预售尾款支付信息 + + + 尾款金额: + +¥{{presale_info.weikuan}} + + + 同城配送费: + {{order.order_info.delivery=="express"?groupInfo.placeorder_trans_name:groupInfo.placeorder_tuan_name}}: + + ¥{{order.order_info.shipping_fare}} + + + 满金额免{{order.order_info.delivery=="express"?groupInfo.placeorder_trans_name:groupInfo.placeorder_tuan_name}}: + - ¥{{order.order_info.fare_shipping_free}} + + + 积分抵扣: + - ¥{{order.order_info.score_for_money}} + + + 优惠券: + - ¥{{order.order_info.voucher_credit}} + + + 满减: + - ¥{{order.order_info.fullreduction_money}} + + + {{groupInfo.localtown_modifypickingname}}: + + ¥{{order.order_info.packing_fare}} + + + 加价配送费: + + ¥{{order.order_info.localtown_add_shipping_fare}} + + + 配送方式: + {{groupInfo.delivery_express_name}} + 同城配送 + {{groupInfo.delivery_tuanzshipping_name}} + + + 发货时间: + + {{!presale_info.second_paytime&&presale_info.presale_type==0?'尾款支付成功后':''}} + {{presale_info.presale_sendorder_date}} + {{presale_info.presale_sendorder_afterday}}日内开始{{presalePickup[order.order_info.delivery]}} + + + + 合计:¥{{presale_info.payTot}} + + + + 取消 + + 确认支付 + + + + diff --git a/eaterplanet_ecommerce/pages/order/order.wxss b/eaterplanet_ecommerce/pages/order/order.wxss new file mode 100644 index 0000000..f51a07e --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/order.wxss @@ -0,0 +1,699 @@ + +.orderpage { + background: #4facfe; +} + + +.content { + padding: 0 20rpx; + padding-bottom: 80rpx; +} + +.back-to-home { + position: fixed; + right: 40rpx; + bottom: 200rpx; +} + +.back-to-home image { + width: 92rpx; + height: 92rpx; +} + +.goods-info { + margin-bottom: 20rpx; +} + +.order-info { + margin-bottom: 20rpx; +} + +.foot { + width: 100%; + position: fixed; + bottom: 0; + z-index: 1000; +} + +.mar-left-8 { + margin-left: 16rpx; +} + +.space-between-card { + height: 22rpx; +} + +.btn-group { + display: flex; + text-align: center; + font-size: 30rpx; + z-index: 1000; +} + +.btn-group .cancelBtn { + width: 50%; +} + +.btn-group .cancelBtn .cancel-btn { + background-color: white; + color: #666; + height: 96rpx; + line-height: 96rpx; + font-weight: 500; +} + +.btn-group .pay-btn { + background: linear-gradient(100deg, #ff758c 0%, #ff7eb3 100%); + color: white; + height: 96rpx; + line-height: 96rpx; + font-weight: 500; + border-radius: 20px 0px 0px 20px; +} + +.btn-group .confirm-receipt { + width: 100%; + background-color: white; + color: #4facfe; + border-top: 0.1rpx solid rgba(0,0,0,0.1); + height: 96rpx; + line-height: 96rpx; +} + +.btn-group .del-order { + margin: 20rpx 0 0 20rpx; + padding: 34rpx 276rpx; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + border-radius: 20rpx; + color: white; + font-size: 30rpx; +} +/* 20181206 end */ + +/**订单状态begin**/ + +.font-bold-30 { + font-size: 60rpx; +} + +.font-bold-20 { + color: #fff; + font-size: 40rpx; + font-weight: 500; +} + +.font-12 { + font-size: 24rpx; +} + +.head .little-img { + width: 230rpx; + height: 120rpx; +} + +.back-img-wrap { + width: 100%; + position: absolute; + top: 0; + left: 0; + z-index: -1; +} + +.back-img-wrap .back-img { + width: 100%; + height: 340rpx; +} + +.to-pay-wrap { + text-align: center; + padding: 46rpx 0; + color: #fff; +} + +.to-get-wrap { + display: flex; + justify-content: space-between; + padding: 50rpx 50rpx 0 50rpx; + color: white; +} + +.trade-cancel-wrap { + padding: 50rpx 76rpx; + color: white; + text-align: center; +} + +.cancel-box { + display: flex; + align-items: center; + justify-content: center; +} + +.cancel-img { + margin-right: 10rpx; + width: 40rpx; + height: 40rpx; +} + +.count-down { + font-weight: 500; +} + + +/***订单状态end**/ + +/***goods begin **/ +.header { + padding: 20rpx 30rpx; + color: #444; + font-size: 28rpx; + font-weight: 500; +} + +.content-wrap { + border-top: 0.1rpx solid #efefef; + padding-bottom: 20rpx; +} + +.content-wrap .item { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 24rpx; + padding: 16rpx 30rpx 0; +} + +.content-wrap .item .title { + word-break: keep-all; + color: #aaa; +} + +.content-wrap .item .detail { + color: #444; + text-align: right; + display: flex; + align-items: center; +} + +.content-wrap .item .detail .phone { + margin-left: 20rpx; + padding: 0 20rpx; + height: 44rpx; + display: flex; + align-items: center; + border: 0.1rpx solid #efefef; + border-radius: 26rpx; +} + +.content-wrap .item .detail .phone .icon-phone { + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; +} +/***goods end **/ + +/***goods card begin **/ +.bold-text { + font-weight: 500; +} +.show-img { + float: left; + width: 120rpx; + height: 120rpx; +} +.name { + margin-top: -8rpx; + width: 510rpx; + font-size: 26rpx; + color: #444; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +.mount { + font-size: 22rpx; + color: #aaa; + margin-top: 10rpx; +} + +.bottom-info { + justify-content: space-between; + font-size: 28rpx; + color: #444; + margin-top: 18rpx; +} + +.bold-text { + font-weight: 500; +} + +.header { + display: flex; + justify-content: space-between; + padding: 30rpx; + font-size: 24rpx; +} + +.header .goods-num { + color: #aaa; +} + +.header .goods-done { + color: #aaa; +} + +.header .goods-ready { + color: #4facfe; +} + +.header .goods-cancel { + color: #aaa; +} + +.middle .middle-line { + height: 0.1rpx; + background: #efefef; +} + +.middle .each-item { + box-sizing: border-box; + display: flex; + width: 100%; + padding: 32rpx 30rpx; +} + +/** goods card end **/ +/** oprate begin **/ +.mar-left-8 { + margin-left: 16rpx; +} + +.card-btn { + margin-top: 20rpx; + float:right; + display: flex; +} + +.card-btn .button-hover { + background: #b6b6b6; +} + +.footer .btn-1, .card-btn .btn-1 { + position: relative; + color: #666; + text-align: center; + padding: 0; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + border-radius: 26rpx; + box-sizing: border-box; +} + +.footer .btn-1::after, .card-btn .btn-1::after { + box-sizing: border-box; + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + transform: scale(0.5); + transform-origin: 0 0; + border: 2rpx solid #b6b6b6; + border-radius: 52rpx; + pointer-events: none; +} + +.card-btn .btn-2 { + text-align: center; + padding: 0; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + border-radius: 26rpx; + box-sizing: border-box; + color: #aaa; + background-color: #f6f6f6; +} + +.card-btn .btn-3 { + color: white; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + text-align: center; + padding: 0; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + border-radius: 26rpx; + box-sizing: border-box; +} + +.card-btn .btn-5 { + display: flex; + align-items: center; + color: #aaa; +} + +.card-btn .arrow-right { + width: 12rpx; + height: 22rpx; + margin-left: 10rpx; + font-size: 24rpx; +} + + +/***operate end **/ +/**order_info begin **/ +.i-card { + width: 710rpx; + border-radius: 20rpx; + background: #fff; + box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.05); + display: flex; + flex-direction: column; + overflow: hidden; +} +.header { + padding: 20rpx 30rpx; + color: #444; + font-size: 28rpx; + font-weight: 500; +} + +.content-wrap { + border-top: 0.1rpx solid #efefef; + padding-bottom: 20rpx; +} + +.content-wrap .item { + display: flex; + justify-content: space-between; + font-size: 24rpx; + padding: 16rpx 30rpx; + padding-bottom: 0; +} + +.content-wrap .item .title { + color: #aaa; +} + +.content-wrap .item .detail { + color: #444; +} + +.footer { + border-top: 0.1rpx solid #efefef; + padding: 32rpx; + display: flex; + justify-content: flex-end; + align-items: center; + font-size: 28rpx; + font-weight: 500; +} + +.footer .money { + color: #4facfe; + font-weight: 500; + font-size: 30rpx; +} +/**order_info end **/ + +/* share-modal begin */ +.share-modal { + position: relative; + background-color: #fff; + border-radius: 10rpx; + width: 600rpx; + box-sizing: border-box; + padding: 20rpx; +} + +.share-modal-title { + font-size: 32rpx; + color: #333; + padding-bottom: 20rpx; +} + +.share-modal-img { + padding-bottom: 10rpx; +} + +.share-modal-img image { + width: 100%; +} + +.share-modal-btn { + display: flex; + line-height: 90rpx; + text-align: center; +} + +.btn-item { + position: relative; + flex: 1; + font-size: 30rpx; + background: #4facfe; +} + +.share-btn { + color: #fff; + line-height: inherit; + border-radius: 10rpx; +} + +.share-btn::after { + border: 0; +} + +.close-modal { + position: absolute; + right: -16rpx; + top: -16rpx; + width: 48rpx; + height: 48rpx; +} + +.home-btn { + bottom: 40% !important; +} + +.pintag { + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + color: #fff; + font-size: 20rpx; + padding: 1rpx 8rpx; + border-radius: 6rpx; + font-weight: bold; + margin-right: 10rpx; +} + +.refundModal { + position: relative; + width: 90%; + box-sizing: border-box; +} + +.refund-btn { + position: absolute; + right: 0; + bottom: 30rpx; +} + +.btn-gray { + text-align: center; + padding: 0; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + border-radius: 26rpx; + box-sizing: border-box; + color: #aaa; + background-color: #f6f6f6; +} + +.line { + height: 10rpx; + border-radius: 5rpx; + background: #f6f6f6; +} + +.refundScroll { + max-height: 600rpx; + overflow-y: scroll; +} + +.mapbox { + position: relative; +} + +.map-distance { + position: absolute; + left: 0; + top: 0; + padding: 8rpx 15rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 24rpx; + z-index: 1000; + border-radius: 0 0 10rpx 0; +} + +.roomitem { + margin: 10rpx 0; + padding-bottom: 15rpx; +} + +.mount .tag { + font-size: 20rpx; + padding: 4rpx 8rpx; + border-radius: 5rpx; + margin-left: 10rpx; +} + + +.presale-item { + padding: 15rpx 50rpx; +} + +.presale-item-circle { + position: relative; + padding-left: 25rpx; +} + +.presale-item-circle::before { + position: absolute; + content: ""; + width: 14rpx; + height: 14rpx; + border-radius: 50%; + background: #cccccc; + top: 50%; + margin-top: -7rpx; + left: 0; +} + +.presale-item.red .presale-item-circle::before { + background: #ff5344; +} + +.presale-item .presale-item-circle::after { + position: absolute; + content: ""; + border-right: 1rpx solid #cccccc; + left: 7rpx; + bottom: 50%; + height: 40rpx; +} + +.presale-item.red .presale-item-circle::after { + position: absolute; + content: ""; + border-right: 1rpx solid #ff5344; + left: 7rpx; + top: 50%; + height: 30rpx; +} + +.presale-item.red:last-child .presale-item-circle::after { + position: absolute; + content: ""; + border-right: 1rpx solid #ff5344; + left: 7rpx; + bottom: 50%; + height: 50rpx; + top: initial; +} + +.confirm-coupon-modal { + background: #f6f6f6; + display: flex; + flex-direction: column; + align-items: center; + position: relative; + padding-bottom: 30rpx; +} + +.confirm-coupon-modal .title { + width: 100%; + border-bottom: 1rpx solid #efefef; + line-height: 2.5; + font-size: 32rpx; + text-align: center; + background: #fff; +} + +.confirm-coupon-modal .list { + width: 100%; + max-height: 700rpx; + overflow-y: auto; + padding: 0 20rpx; + box-sizing: border-box; +} + +.confirm-presale-modal .button-group { + border-top: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.confirm-presale-modal .btn-content { + flex: 1; + height: 80rpx; + line-height:80rpx; + font-size: 30rpx; +} + +.confirm-presale-modal .title { + font-size: 32rpx; + color: #444; + line-height: 32rpx; + font-weight: 500; + padding: 30rpx 0; +} + +.confirm-presale-modal .order-content { + width: 690rpx; + border-radius: 20rpx; + padding-top: 30rpx; + background: #f6f6f6; + margin: 0 auto 20rpx; +} + +.confirm-presale-modal .order-content .msg-group { + width: 690rpx; + padding: 0 30rpx; + margin-bottom: 20rpx; + display: flex; + font-size: 24rpx; + line-height: 24rpx; + color: #444; + box-sizing: border-box; + align-items: center; +} + +.confirm-presale-modal .order-content .msg-group span { + font-weight: bold; + white-space: nowrap; +} + +.confirm-presale-modal .order-content .msg-group em { + font-weight: 400; + flex: 1; + line-height: 1.4; +} + +.confirm-presale-modal .order-content .total { + line-height: 86rpx; + padding: 0 30rpx; + text-align: right; + color: #444; + font-size: 30rpx; + border-top: 1rpx solid #e2e2e2; +} + +.confirm-presale-modal .order-content .total em { + color: #ff5344; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/placeOrder.js b/eaterplanet_ecommerce/pages/order/placeOrder.js new file mode 100644 index 0000000..b68114e --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/placeOrder.js @@ -0,0 +1,1589 @@ +var app = getApp() +var locat = require('../../utils/Location.js'); +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var wcache = require('../../utils/wcache.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + payBtnLoading: false, + showConfirmModal: false, + receiverAddress: "", //快递送货地址 + tuan_send_address: "", //团长送货地址 + showGetPhone: false, + lou_meng_hao:'', + pickUpAddress: "", + disUserName: "", + pickUpCommunityName: "", + is_limit_distance_buy: 0, + tabList: [ + { id: 0, name: '社区自提', dispatching: 'pickup', enabled: false }, + { id: 1, name: '团长配送', dispatching: 'tuanz_send', enabled: false }, + { id: 2, name: '快递配送', dispatching: 'express', enabled: false }, + { id: 3, name: '同城配送', dispatching: 'localtown_delivery', enabled: false}, + { id: 4, name: '到店核销', dispatching: 'hexiao', enabled: false} + ], + originTabList: [ + { id: 0, name: '社区自提', dispatching: 'pickup' }, + { id: 1, name: '团长配送', dispatching: 'tuanz_send'}, + { id: 2, name: '快递配送', dispatching: 'express'}, + { id: 3, name: '同城配送', dispatching: 'localtown_delivery'}, + { id: 4, name: '到店核销', dispatching: 'hexiao'} + ], + tabIdx: 0, + region: ['选择地址', '', ''], + tot_price: 0, + needAuth: false, + reduce_money: 0, + hide_quan: true, + tuan_region: ['选择地址','',''], + groupInfo: { + group_name: '社区', + owner_name: '团长', + placeorder_tuan_name: '配送费', + placeorder_trans_name: '快递费' + }, + comment: '', + is_yue_open: 0, + can_yupay: 0, + ck_yupay: 0, + use_score: 0, + commentArr: {}, + note_content: '', + showAlertTime: false, + curAlertTime: -1, + isAgreePresale: false, + presale_info: '', + presalePickup: ['自提','配送','发货','配送','核销'], + allform: "" + }, + canPay: true, + canPreSub: true, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + util.check_login() ? this.setData({ needAuth: false }) : (this.setData({ needAuth: true })); + // let is_limit = options.is_limit || 0; + this.setData({ + buy_type: options.type || '', + soli_id: options.soli_id || '', + pickUpAddress: community.fullAddress || '', + pickUpCommunityName: community.communityName || '', + disUserName: community.disUserName || '' + }) + wx.showLoading() + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'car.checkout', + token: token, + community_id, + buy_type: options.type, + soli_id: options.soli_id + }, + dataType: 'json', + method: 'POST', + success: function (res) { + // wx.hideLoading(); + setTimeout(function(){ wx.hideLoading(); },1000); + + let rdata = res.data; + // 提货方式 + let tabIdx = -1; + let tabLength = 0; + let tabList = that.data.tabList || {}; + let sortTabList = []; + + let { + delivery_express_name, + delivery_tuanzshipping_name, + delivery_ziti_name, + delivery_diy_sort, + delivery_type_express, + delivery_type_tuanz, + delivery_type_ziti, + delivery_tuanz_money, + is_vip_card_member, + vipcard_save_money, + level_save_money, + is_open_vipcard_buy, + is_member_level_buy, + total_integral, + is_need_subscript, + need_subscript_template, + delvery_type_hexiao, + order_note_open, + order_note_name, + order_note_content, + delivery_type_localtown, + localtown_dispatchtime, //预计配送需要多少分钟 + pickingup_fare, //订单包装费,只有在 同城快递的时 + localtown_shipping_fare, //同城配送费 + localtown_modifypickingname, + localtown_shipping_fare_arr, + localtown_moneytype_fixed_freemoney, + localtown_makeup_delivery_money, + localtown_expected_delivery, + order_lou_meng_hao, + order_lou_meng_hao_placeholder, + presale_info, + cashondelivery_data, + allform + } = res.data; + + let { + isopen_cashondelivery, + isopen_cashondelivery_communityhead, + isopen_cashondelivery_express, + isopen_cashondelivery_hexiao, + isopen_cashondelivery_localtown + } = cashondelivery_data; + + presale_info = Object.keys(presale_info).length ? presale_info : ''; + + // 同城满免运费 + if(localtown_shipping_fare_arr) { + let shipping_fare = 0; + shipping_fare = localtown_shipping_fare_arr.total_yl_shipping_fare*1 - localtown_shipping_fare_arr.total_shipping_fare*1; + localtown_shipping_fare_arr.shipping_fare = shipping_fare.toFixed(2); + } + + if (delivery_type_localtown == 1) tabList[3].enabled = true, tabLength++; + if (delivery_type_express == 1) tabList[2].enabled = true, tabLength++; + if (delivery_type_tuanz == 1) tabList[1].enabled = true, tabLength++; + if (delivery_type_ziti == 1) tabList[0].enabled = true, tabLength++; + + if (delivery_diy_sort) { + let sortArr = delivery_diy_sort.split(','); + if (sortArr[2] && tabList[sortArr[2]] && tabList[sortArr[2]].enabled) tabIdx = sortArr[2]; + if (sortArr[1] && tabList[sortArr[1]] && tabList[sortArr[1]].enabled) tabIdx = sortArr[1]; + if (sortArr[0] && tabList[sortArr[0]] && tabList[sortArr[0]].enabled) tabIdx = sortArr[0]; + + sortArr.forEach(function(item){ + sortTabList.push(tabList[item]); + }) + } + + delivery_express_name && (tabList[2].name = delivery_express_name); + delivery_tuanzshipping_name && (tabList[1].name = delivery_tuanzshipping_name); + delivery_ziti_name && (tabList[0].name = delivery_ziti_name); + + // 同城配送TODO... + sortTabList.push({id: 3, name: '同城配送', dispatching: 'localtown_delivery', enabled: (delivery_type_localtown==1) }); + if(tabIdx==-1&&delivery_type_localtown==1) tabIdx=3; + let localtown_delivery_space_month = ''; + if(localtown_expected_delivery&&localtown_expected_delivery.localtown_delivery_space_month) { + localtown_delivery_space_month = localtown_expected_delivery.localtown_delivery_space_month; + } + + // 到店核销 + sortTabList.push({id: 4, name: '到店核销', dispatching: 'hexiao', enabled: (delvery_type_hexiao==1) }); + if(tabIdx==-1&&delvery_type_hexiao) { tabIdx = 4; } + + var addres = 0; + addres = 1; + var seller_chose_id = 0; + var seller_chose_store_id = 0; + var seller_goods = rdata.seller_goodss; + + let commentArr = {}; + for (let key in seller_goods) commentArr[key] = ''; + + let sel_chose_vouche = ''; + let sgvKey = 0; + let goodsTotNum = 0; + for (var i in seller_goods) { + if (seller_goods[i].show_voucher == 1) { + if (seller_goods[i].chose_vouche.id) seller_chose_id = seller_goods[i].chose_vouche.id; + if (seller_goods[i].chose_vouche.store_id) seller_chose_store_id = seller_goods[i].chose_vouche.store_id; + + if (Object.prototype.toString.call(seller_goods[i].chose_vouche) == '[object Object]'){ + sel_chose_vouche = seller_goods[i].chose_vouche; + } + if(Object.keys(seller_goods[i].chose_vouche).length>0) sgvKey = i; + } + seller_goods[i].goodsnum = Object.keys(seller_goods[i].goods).length; + for (var j in seller_goods[i].goods) { + goodsTotNum += seller_goods[i].goods[j].quantity*1; + if (seller_goods[i].goods[j].header_disc > 0 && seller_goods[i].goods[j].header_disc < 100) { + seller_goods[i].goods[j].header_disc = (seller_goods[i].goods[j].header_disc / 10).toFixed(1); + } + } + } + + let current_distance = rdata.current_distance || ''; + let current_distance_str = that.changeDistance(current_distance); + + order_note_content = order_note_content!=null?order_note_content:''; + + if(presale_info&&presale_info.goods_price) { + let deduction_money = presale_info.deduction_money; + deduction_money = deduction_money>0?deduction_money:presale_info.presale_ding_money; + let totDeduction = deduction_money*goodsTotNum; + presale_info.balance = (presale_info.goods_price*1 - totDeduction).toFixed(2); + presale_info.totdingMoney = (goodsTotNum*presale_info.presale_ding_money).toFixed(2); + presale_info.totDeduction = totDeduction.toFixed(2); + } + + let param = { + sgvKey, + is_hexiao: delvery_type_hexiao, + loadover: true, + commentArr, + sel_chose_vouche, + tabList: sortTabList, + is_limit_distance_buy: rdata.is_limit_distance_buy || 0, + tabIdx: tabIdx, + tabLength: tabLength, + tuan_send_address: rdata.tuan_send_address, + is_open_order_message: rdata.is_open_order_message, + is_yue_open: rdata.is_yue_open, + can_yupay: rdata.can_yupay, + show_voucher: rdata.show_voucher, + current_distance, + man_free_tuanzshipping: rdata.man_free_tuanzshipping*1 || 0, + man_free_shipping: rdata.man_free_shipping*1 || 0, + index_hide_headdetail_address: rdata.index_hide_headdetail_address || 0, + open_score_buy_score: rdata.open_score_buy_score || 0, + score: rdata.score || 0, + score_for_money: rdata.score_for_money || 0, + bue_use_score: rdata.bue_use_score || 0, + is_man_delivery_tuanz_fare: rdata.is_man_delivery_tuanz_fare, //是否达到满xx减团长配送费 + fare_man_delivery_tuanz_fare_money: rdata.fare_man_delivery_tuanz_fare_money, //达到满xx减团长配送费, 减了多少钱 + is_man_shipping_fare: rdata.is_man_shipping_fare, //是否达到满xx减运费 + fare_man_shipping_fare_money: rdata.fare_man_shipping_fare_money, //达到满xx减运费,司机减了多少运费 + is_vip_card_member, + vipcard_save_money, + level_save_money, + is_open_vipcard_buy, + is_member_level_buy, + // canLevelBuy, + total_integral: total_integral || '', + is_need_subscript, + need_subscript_template, + current_distance_str, + order_note_open, + order_note_name, + order_note_content, + note_content: order_note_content, + localtown_dispatchtime, + pickingup_fare, + localtown_shipping_fare, + localtown_modifypickingname: localtown_modifypickingname || '包装费', + localtown_shipping_fare_arr, + localtown_moneytype_fixed_freemoney, + localtown_makeup_delivery_money, + localtown_expected_delivery, + localtown_delivery_space_month, + order_lou_meng_hao: order_lou_meng_hao|| '楼号门牌', + order_lou_meng_hao_placeholder: order_lou_meng_hao_placeholder || '例如:A座106室', + presale_info, + cashondelivery_data, + allform + } + + let addrObj = rdata.address || {}; + let tuan_send_address_info = rdata.tuan_send_address_info || {}; + let tuanAddress = tuan_send_address_info.address || '选择位置'; + if(tuan_send_address_info.city_name == "" || tuan_send_address_info.city_id==3708 || tuan_send_address_info.country_name == "" || tuan_send_address_info.country_id==3708){ + tuanAddress = '选择位置'; + } + + // 20200710 TODO + // addrObj = tuan_send_address_info; + + param.tabAddress = [ + { + name: rdata.ziti_name || '', + mobile: rdata.ziti_mobile || '' + }, + { + name: tuan_send_address_info.name || '', + mobile: tuan_send_address_info.telephone || '', + receiverAddress: tuanAddress, + lou_meng_hao: tuan_send_address_info.lou_meng_hao || '', + region: [tuan_send_address_info.province_name || "", tuan_send_address_info.city_name || "", tuan_send_address_info.country_name || ""] + }, + { + name: addrObj.name || '', + mobile: addrObj.telephone || '', + receiverAddress: addrObj.address || '', + region: [addrObj.province_name || "选择地址", addrObj.city_name || "", addrObj.country_name || ""] + }, + { + name: addrObj.name || '', + mobile: addrObj.telephone || '', + receiverAddress: addrObj.address || '', + region: [addrObj.province_name || "选择地址", addrObj.city_name || "", addrObj.country_name || ""] + }, + { + name: rdata.ziti_name || '', + mobile: rdata.ziti_mobile || '' + } + ]; + + if(JSON.stringify(addrObj)!='[]') { + if(addrObj.lon_lat=='') { + if(tabIdx==3){ + param.tabAddress[3] = { + name: addrObj.name || '', + mobile: addrObj.telephone || '', + receiverAddress: '', + region: ["选择地址", "", ""] + } + } + } else if(addrObj.lon_lat) { + let lat_lon = addrObj.lon_lat.split(','); + wcache.put('latitude2', lat_lon[1]); + wcache.put('longitude2', lat_lon[0]); + } + } + + if (addres == 1) { + that.setData({ + ...param, + pick_up_time: res.data.pick_up_time, + pick_up_type: res.data.pick_up_type, + pick_up_weekday: res.data.pick_up_weekday, + addressState: true, + is_integer: res.data.is_integer, + is_ziti: res.data.is_ziti, + pick_up_arr: res.data.pick_up_arr, + seller_goodss: res.data.seller_goodss, + seller_chose_id: seller_chose_id, + seller_chose_store_id: seller_chose_store_id, + goods: res.data.goods, + buy_type: res.data.buy_type, + yupay: res.data.can_yupay, + is_yue_open: res.data.is_yue_open, + yu_money: res.data.yu_money, + total_free: res.data.total_free, + trans_free_toal: res.data.trans_free_toal, + delivery_tuanz_money: res.data.delivery_tuanz_money, + reduce_money: res.data.reduce_money, + is_open_fullreduction: res.data.is_open_fullreduction, + cha_reduce_money: res.data.cha_reduce_money + }, () => { + that.calcPrice(); + }) + } else { + that.setData({ + ...param, + is_integer: res.data.is_integer, + addressState: false, + goods: res.data.goods, + is_ziti: res.data.is_ziti, + pick_up_arr: res.data.pick_up_arr, + seller_goodss: res.data.seller_goodss, + seller_chose_id: seller_chose_id, + seller_chose_store_id: seller_chose_store_id, + buy_type: res.data.buy_type, + yupay: res.data.can_yupay, + is_yue_open: res.data.is_yue_open, + yu_money: res.data.yu_money, + total_free: res.data.total_free, + trans_free_toal: res.data.trans_free_toal, + delivery_tuanz_money: res.data.delivery_tuanz_money, + reduce_money: res.data.reduce_money, + is_open_fullreduction: res.data.is_open_fullreduction, + cha_reduce_money: res.data.cha_reduce_money + },()=>{ + that.calcPrice(); + }) + } + + } + }) + }, + + changeDistance: function(current_distance) { + if(current_distance) { + current_distance = parseFloat(current_distance); + if(current_distance > 1000) { + let current_distance_int = current_distance/1000; + return current_distance_int.toFixed(2) + 'km'; + } + return current_distance + 'm'; + } + return current_distance; + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + this.onLoad(); + }, + + /** + * 设置手机号 + */ + getReceiveMobile: function (e) { + var num = e.detail; + this.setData({ + t_ziti_mobile: num, + showGetPhone: false + }); + }, + + ck_wxpays: function () { + this.setData({ + ck_yupay: 0 + }) + }, + + ck_yupays: function () { + this.setData({ + ck_yupay: 1 + }) + }, + + ck_cash: function () { + this.setData({ + ck_yupay: 2 + }) + }, + + scoreChange: function (e) { + console.log('是否使用', e.detail.value) + let tdata = this.data; + let score_for_money = tdata.score_for_money*1; + let tot_price = tdata.tot_price*1; + let disAmount = tdata.disAmount*1; + if (e.detail.value){ + tot_price = tot_price - score_for_money; + disAmount += score_for_money; + } else { + tot_price = tot_price + score_for_money; + disAmount -= score_for_money; + } + this.setData({ + use_score: e.detail.value?1:0, + tot_price: tot_price.toFixed(2), + disAmount: disAmount.toFixed(2) + }) + }, + + /** + * 未登录 + */ + needAuth: function(){ + this.setData({ + needAuth: true + }); + }, + + /** + * 关闭手机授权 + */ + close: function () { + this.setData({ + showGetPhone: false + }); + }, + + // 生成订单号 Step1 + preOrderConfirm() { + if(this.data.allform&&this.data.allform.is_open_orderform) { + this.selectComponent("#sForm").formSubmit(); + return false; + } else { + this.goOrderfrom(); + } + }, + // 生成订单号 Step2 + goOrderfrom: function(formData={detail: {}}) { + let that = this; + let { tabAddress, tabIdx, note_content, order_note_open, order_note_name, isAgreePresale, buy_type, presale_info } = this.data; + + this.setData({ formData: formData.detail }) + var t_ziti_name = tabAddress[tabIdx].name; + var t_ziti_mobile = tabAddress[tabIdx].mobile; + var receiverAddress = tabAddress[tabIdx].receiverAddress; + var region = tabAddress[tabIdx].region; + var tuan_send_address = tabAddress[tabIdx].receiverAddress; + var lou_meng_hao = tabAddress[tabIdx].lou_meng_hao; + + if (t_ziti_name == '') { + this.setData({ + focus_name: true + }) + let tip = '请填写收货人'; + if (tabIdx == 0) tip = '请填写提货人'; + wx.showToast({ + title: tip, + icon: 'none' + }) + return false; + } + if (t_ziti_mobile == '' || !(/^1(3|4|5|6|7|8|9)\d{9}$/.test(t_ziti_mobile))) { + this.setData({ + focus_mobile: true + }) + wx.showToast({ + title: '手机号码有误', + icon: 'none' + }) + return false; + } + + if((tabIdx==0||tabIdx==1||tabIdx==3)&&this.data.buy_type!='virtualcard') { + + if(order_note_open==1 && note_content=='') { + wx.showToast({ + title: '请填写' + order_note_name, + icon: 'none' + }) + return false; + } + } else { + note_content = ''; + } + if(order_note_open==0) note_content = ''; + + if ((tabIdx == 2 || tabIdx == 3) && region[0] == '选择地址') { + wx.showToast({ + title: '请选择所在地区', + icon: 'none' + }) + return false; + } + + if ((tabIdx == 2 || tabIdx == 3) && receiverAddress == ''){ + this.setData({ + focus_addr: true + }) + wx.showToast({ + title: '请填写详细地址', + icon: 'none' + }) + return false; + } + + if (tabIdx == 1) { + if (tuan_send_address == '选择位置' || tuan_send_address == '') { + wx.showToast({ + title: '请选择位置', + icon: 'none' + }) + return false; + } + + if (lou_meng_hao == ''){ + wx.showToast({ + title: '输入楼号门牌', + icon: 'none' + }) + return false; + } + + } + + if(buy_type=='presale'&&!isAgreePresale) { + wx.showModal({ + title: '提示', + content: '预售商品定金不支持退款,同意后可继续下单', + showCancel: true, + cancelText: '我再想想', + cancelColor: '#ff5344', + confirmText: '同意下单', + success (res) { + if (res.confirm) { + that.setData({ isAgreePresale: true }); + if (tabIdx == 2){ + that.preSubscript(); + } else { + that.conformOrder(); + } + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + return; + } + + if (tabIdx == 2||this.data.buy_type=="virtualcard"){ + this.preSubscript(); + } else { + this.conformOrder(); + } + }, + + /** + * 支付防抖 + */ + preSubscript: function(event) { + let that = this; + if(!this.canPreSub) return; + this.canPreSub = false; + let is_need_subscript = this.data.is_need_subscript; + if(is_need_subscript==1) { + //弹出订阅消息 + + console.log(111) + this.subscriptionNotice().then(()=>{ + console.log(3333) + that.prepay(); + }).catch(()=>{ + console.log(444) + that.prepay(); + }); + } else { + console.log(222) + that.prepay(); + } + }, + + prepay: function() { + this.canPreSub = true; + let { tabAddress, tabIdx, is_limit_distance_buy, note_content, seller_goodss, commentArr, formData } = this.data; + let isVirtualcard = 0; + if(this.data.buy_type=='virtualcard') isVirtualcard = 1; + if (is_limit_distance_buy == 1 && (tabIdx == 1) && isVirtualcard==0){ + wx.showModal({ + title: '提示', + content: '离团长太远了,暂不支持下单', + showCancel: false, + confirmColor: '#F75451' + }) + return false; + } + console.log('this.canPay', this.canPay) + if(this.canPay){ + this.setData({ payBtnLoading: true }) + this.canPay = false; + var that = this; + var token = wx.getStorageSync('token'); + + let { seller_chose_id, seller_chose_store_id, ck_yupay, tabList } = this.data; + var voucher_id = seller_chose_id; + var dispatching = ''; + tabList.forEach(function(item){ + if (item.id == tabIdx) dispatching = item.dispatching; + }) + + let arr = []; + for (let key in seller_goodss) { + let goodsid = ''; + let goods = seller_goodss[key].goods; + Object.keys(goods).forEach(kk=>{ + goodsid += goods[kk].goods_id+'_'; + }) + commentArr[key] = key+'_'+goodsid + commentArr[key]; + } + for (let key in commentArr) arr.push(commentArr[key]); + let comment = arr.join('@EOF@'); + var receiverAddress = tabAddress[tabIdx].receiverAddress || ''; + var region = tabAddress[tabIdx].region || []; + var t_ziti_name = tabAddress[tabIdx].name; + var t_ziti_mobile = tabAddress[tabIdx].mobile; + let lou_meng_hao = tabAddress[tabIdx].lou_meng_hao || ''; + var quan_arr = []; + + if (voucher_id > 0) { + var t_tmp = seller_chose_store_id + '_' + voucher_id; + quan_arr.push(t_tmp); + } + + let tuan_send_address = ''; + let tuan_region = ''; + let address_name = ''; + let province_name = ''; + let city_name = ''; + let country_name = ''; + + if (tabIdx==1){ + tuan_send_address = receiverAddress; + tuan_region = region; + province_name = tuan_region[0]; + city_name = tuan_region[1]; + country_name = tuan_region[2]; + } else if (tabIdx == 2 || tabIdx == 3) { + address_name = receiverAddress; + province_name = region[0]; + city_name = region[1]; + country_name = region[2]; + } + + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + var pick_up_id = community_id; + + let latitude = wx.getStorageSync('latitude2'); + let longitude = wx.getStorageSync('longitude2'); + + let { use_score, buy_type, soli_id } = this.data; + + // 送达时间 + let expected_delivery_time = ''; + let localtown_delivery_space_month = ''; + if(tabIdx==3){ + let { localtown_expected_delivery, curAlertTime, localtown_dispatchtime, localtown_delivery_space_month } = this.data; + if(curAlertTime==-1) { + expected_delivery_time = localtown_dispatchtime; + } else { + expected_delivery_time = localtown_expected_delivery.localtown_delivery_space_time_list[localtown_delivery_space_month][curAlertTime].time; + } + expected_delivery_time = localtown_delivery_space_month + ' ' + expected_delivery_time; + } + + let cashon_delivery = (ck_yupay)==2?1:0 + + wx.showLoading(); + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'car.sub_order', + token: token, + pay_method: 'wxpay', + buy_type, + pick_up_id, + dispatching, + ziti_name: t_ziti_name, + quan_arr, + comment, + ziti_mobile: t_ziti_mobile, + latitude, + longitude, + ck_yupay, + tuan_send_address, + lou_meng_hao, + address_name, + province_name, + city_name, + country_name, + use_score, + soli_id, + note_content, + expected_delivery_time, + scene: app.globalData.scene, + cashon_delivery, + ...formData + }, + dataType: 'json', + method: 'POST', + success: function (res) { + wx.hideLoading(); + let has_yupay = res.data.has_yupay || 0; + var order_id = res.data.order_id; + let h = {}; + console.log('支付日志:', res); + if (res.data.code == 0) { + // 交易组件 + if(res.data.isRequestOrderPayment==1) { + wx.requestOrderPayment({ + "orderInfo": res.data.order_info, + "timeStamp": res.data.timeStamp, + "nonceStr": res.data.nonceStr, + "package": res.data.package, + "signType": res.data.signType, + "paySign": res.data.paySign, + 'success': function (wxres) { + that.canPay = true; + if (buy_type == "dan" || buy_type == "pindan" || buy_type == "integral" || buy_type == "soitaire" || buy_type == "presale" || buy_type == "virtualcard") { + if (res.data.is_go_orderlist<=1){ + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&is_show=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?is_show=1' + }) + } + } else { + wx.redirectTo({ + url: `/eaterplanet_ecommerce/moduleA/pin/share?id=${order_id}` + }) + } + }, + 'fail': function (error) { + if (res.data.is_go_orderlist <= 1) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&isfail=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?isfail=1' + }) + } + } + }) + } else { + that.changeIndexList(); + if (has_yupay == 1) { + that.canPay = true; + if (buy_type == "dan" || buy_type == "pindan" || buy_type == "integral" || buy_type == "soitaire" || buy_type == "presale" || buy_type == "virtualcard") { + if (res.data.is_go_orderlist <= 1) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&is_show=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?is_show=1' + }) + } + } else { + wx.redirectTo({ + url: `/eaterplanet_ecommerce/moduleA/pin/share?id=${order_id}` + }) + } + } else { + wx.requestPayment({ + "appId": res.data.appId, + "timeStamp": res.data.timeStamp, + "nonceStr": res.data.nonceStr, + "package": res.data.package, + "signType": res.data.signType, + "paySign": res.data.paySign, + 'success': function (wxres) { + that.canPay = true; + if (buy_type == "dan" || buy_type == "pindan" || buy_type == "integral" || buy_type == "soitaire" || buy_type == "presale" || buy_type == "virtualcard") { + if (res.data.is_go_orderlist<=1){ + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&is_show=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?is_show=1' + }) + } + } else { + wx.redirectTo({ + url: `/eaterplanet_ecommerce/moduleA/pin/share?id=${order_id}` + }) + } + }, + 'fail': function (error) { + if (res.data.is_go_orderlist <= 1) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&isfail=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?isfail=1' + }) + } + } + }) + } + } + } else if (res.data.code == 1) { + that.canPay = true; + wx.showModal({ + title: '提示', + content: res.data.RETURN_MSG || '支付失败', + showCancel: false, + confirmColor: '#F75451', + success (ret) { + if (ret.confirm) { + if (res.data.is_go_orderlist <= 1) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/order?id=' + order_id + '&isfail=1&delivery=' + dispatching + }) + } else { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?is_show=1&isfail=1' + }) + } + } + } + }) + } else if (res.data.code == 2) { + that.canPay = true; + if( res.data.is_forb ==1 ){ h.btnDisable = true; h.btnText="已抢光"; } + wx.showToast({ + title: res.data.msg, + icon: "none" + }); + } else { + console.log(res); + } + that.setData({ btnLoading: false, payBtnLoading:false, ...h }) + }, + fail: function() { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/order/index?is_show=1&isfail=1' + }) + } + }) + } + }, + + /** + * 监听收货人 + */ + changeReceiverName: function(e) { + let { tabAddress, tabIdx } = this.data; + let receiverName = e.detail.value.trim(); + Object.keys(tabAddress).length && (tabAddress[tabIdx].name = receiverName); + if (!receiverName) { + let tip = '请填写收货人'; + if (tabIdx == 0) tip = '请填写提货人'; + wx.showToast({ + title: tip, + icon: "none" + }); + } + this.setData({ tabAddress }) + return { + value: receiverName + } + }, + + /** + * 监听备注 + */ + changeNoteName: function(e) { + let noteName = e.detail.value.trim(); + let order_note_name = this.data.order_note_name; + if (!noteName) { + let tip = '请填写' + order_note_name; + wx.showToast({ + title: tip, + icon: "none" + }); + } + this.setData({ note_content: noteName }) + return { + value: noteName + } + }, + + /** + * 监听手机号 + */ + bindReceiverMobile: function(e) { + let { tabAddress, tabIdx } = this.data; + let mobile = e.detail.value.trim(); + tabAddress[tabIdx].mobile = mobile; + this.setData({ tabAddress }); + return { + value: mobile + } + }, + + /** + * 监控快递地址变化 + */ + changeReceiverAddress: function(e){ + let { tabAddress, tabIdx } = this.data; + tabAddress[tabIdx].receiverAddress = e.detail.value.trim(); + this.setData({ tabAddress }); + return { + value: e.detail.value.trim() + } + }, + + /** + * 监控团长送货地址变化 + */ + changeTuanAddress: function (e) { + let { tabAddress, tabIdx } = this.data; + tabAddress[tabIdx].lou_meng_hao = e.detail.value.trim(); + this.setData({ tabAddress }); + return { + value: e.detail.value.trim() + } + }, + + /** + * 结算 + */ + conformOrder: function() { + this.setData({ + showConfirmModal: true + }); + }, + + /** + * 关闭结算 + */ + closeConfirmModal: function() { + this.canPay = true; + this.setData({ + showConfirmModal: false + }); + }, + + /** + * 地区选择 + */ + bindRegionChange: function (e) { + let region = e.detail.value; + region && this.checkOut(region[1]); + this.setData({ region }) + }, + + checkOut: function (mb_city_name) { + var that = this; + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + let latitude = wx.getStorageSync('latitude2'); + let longitude = wx.getStorageSync('longitude2'); + let buy_type = this.data.buy_type; + let soli_id = this.data.soli_id; + + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'car.checkout', + token, + community_id, + mb_city_name, + latitude: latitude, + longitude: longitude, + buy_type, + soli_id + }, + dataType: 'json', + method: 'POST', + success: function (res) { + if(res.data.code==1){ + let rdata = res.data; + let { + vipcard_save_money, + shop_buy_distance, + is_limit_distance_buy, + current_distance, + level_save_money, + score, + score_for_money, + bue_use_score, + localtown_shipping_fare_arr, + localtown_moneytype_fixed_freemoney, + localtown_makeup_delivery_money + } = rdata; + if (that.data.tabIdx == 1 && is_limit_distance_buy == 1 && (current_distance > shop_buy_distance)) { + wx.showModal({ + title: '提示', + content: '超出配送范围,请重新选择', + showCancel: false, + confirmColor: '#F75451' + }) + } + + current_distance = current_distance || ''; + let current_distance_str = that.changeDistance(current_distance); + + // 同城满免运费 + if(localtown_shipping_fare_arr) { + let shipping_fare = 0; + shipping_fare = localtown_shipping_fare_arr.total_yl_shipping_fare*1 - localtown_shipping_fare_arr.total_shipping_fare*1; + localtown_shipping_fare_arr.shipping_fare = shipping_fare.toFixed(2); + } + + that.setData({ + score: score || 0, + score_for_money: score_for_money || 0, + bue_use_score: bue_use_score || 0, + vipcard_save_money, + level_save_money, + is_limit_distance_buy: is_limit_distance_buy || 0, + current_distance, + current_distance_str, + trans_free_toal: rdata.trans_free_toal, + is_man_delivery_tuanz_fare: rdata.is_man_delivery_tuanz_fare, //是否达到满xx减团长配送费 + fare_man_delivery_tuanz_fare_money: rdata.fare_man_delivery_tuanz_fare_money, //达到满xx减团长配送费, 减了多少钱 + is_man_shipping_fare: rdata.is_man_shipping_fare, //是否达到满xx减运费 + fare_man_shipping_fare_money: rdata.fare_man_shipping_fare_money, //达到满xx减运费,司机减了多少运费 + localtown_shipping_fare_arr, + localtown_moneytype_fixed_freemoney, + localtown_makeup_delivery_money + }, () => { that.calcPrice() }) + } + } + }) + }, + + /** + * 定位获取地址 + */ + choseLocation: function() { + let { tabAddress, tabIdx } = this.data; + var that = this; + wx.chooseLocation({ + success: function (e) { + console.log(e); + var s_region = that.data.region; + var filename = e.name; + let addr = e.address || ''; + var reg = /.+?(省|市|自治区|自治州|县|区|特别行政区)/g; + // var result = addr.match(reg); + var result = null; + console.log('patt', result); + if (result == null || filename=="") { + locat.getGpsLocation(e.latitude, e.longitude).then((res) => { + console.log('反推了', res); + if (res) { + s_region[0] = res.province; + s_region[1] = res.city; + s_region[2] = res.district; + filename || (filename = res.street); + } + setRes(); + }); + } else { + s_region[0] = result[0]; + s_region[1] = result[1]; + s_region[2] = result[2] || ''; + var dol_path = addr.replace(s_region.join(''), ''); + filename = dol_path + e.name; + setRes(); + } + + wcache.put('latitude2', e.latitude); + wcache.put('longitude2', e.longitude); + + function setRes(){ + console.log('setData'); + s_region && (s_region[1] != "市") && that.checkOut(s_region[1]); + tabAddress[tabIdx].region = s_region; + tabAddress[tabIdx].receiverAddress = filename; + that.setData({ tabAddress }) + } + }, + fail: function (error) { + console.log(error) + if (error.errMsg =='chooseLocation:fail auth deny') { + console.log('无权限') + locat.checkGPS(app, locat.openSetting()) + } + } + }) + }, + + /** + * 微信获取地址 + */ + getWxAddress: function() { + let { tabAddress, tabIdx } = this.data; + let region = tabAddress[tabIdx].region || []; + let that = this; + wx.getSetting({ + success(res) { + if (res.authSetting['scope.address']) { + wx.chooseAddress({ + success(res) { + console.log("step1") + region[0] = res.provinceName || "选择地址"; + region[1] = res.cityName || ""; + region[2] = res.countyName || ""; + let receiverAddress = res.detailInfo; + tabAddress[tabIdx].name = res.userName; + tabAddress[tabIdx].mobile = res.telNumber; + tabAddress[tabIdx].region = region; + tabAddress[tabIdx].receiverAddress = receiverAddress; + that.setData({ tabAddress }) + region && (region[1] != "市") && that.checkOut(region[1]); + }, + fail(res){ + console.log("step4") + console.log(res) + } + }) + } else { + if (res.authSetting['scope.address'] == false) { + wx.openSetting({ + success(res) { + console.log(res.authSetting) + } + }) + } else { + console.log("step2") + wx.chooseAddress({ + success(res) { + console.log("step3") + region[0] = res.provinceName || "选择地址"; + region[1] = res.cityName || ""; + region[2] = res.countyName || ""; + let receiverAddress = res.detailInfo; + region && (region[1] != "市") && that.checkOut(region[1]); + tabAddress[tabIdx].name = res.userName; + tabAddress[tabIdx].mobile = res.telNumber; + tabAddress[tabIdx].region = region; + tabAddress[tabIdx].receiverAddress = receiverAddress; + that.setData({ tabAddress }) + } + }) + } + } + } + }) + }, + + /** + * tab切换 + */ + tabSwitch: function (t) { + let idx = 1 * t.currentTarget.dataset.idx; + (idx != 0) && wx.showToast({ title: '配送变更,费用已变化', icon: "none"}); + this.setData({ + tabIdx: idx + },function(){ + this.calcPrice(1); + }) + }, + + /** + * 打开优惠券 + */ + show_voucher: function (event) { + var that = this; + var serller_id = event.currentTarget.dataset.seller_id; + var voucher_list = []; + var seller_chose_id = this.data.seller_chose_id; + var seller_chose_store_id = this.data.seller_chose_store_id; + var seller_goods = this.data.seller_goodss; + for (var i in seller_goods) { + var s_id = seller_goods[i].store_info.s_id; + if (s_id == serller_id) { + voucher_list = seller_goods[i].voucher_list; + if (seller_chose_id == 0) { + seller_chose_id = seller_goods[i].chose_vouche.id || 0; + seller_chose_store_id = seller_goods[i].chose_vouche.store_id || 0; + } + } + } + that.setData({ + ssvoucher_list: voucher_list, + voucher_serller_id: serller_id, + seller_chose_id: seller_chose_id, + seller_chose_store_id: seller_chose_store_id, + hide_quan: false + }) + }, + + // 选择优惠券 + chose_voucher_id: function (event) { + wx.showLoading(); + var voucher_id = event.currentTarget.dataset.voucher_id; + var seller_id = event.currentTarget.dataset.seller_id; + var that = this; + var token = wx.getStorageSync('token'); + var use_quan_str = seller_id + "_" + voucher_id; + let latitude = wx.getStorageSync('latitude2'); + let longitude = wx.getStorageSync('longitude2'); + var buy_type = that.data.buy_type; + let soli_id = this.data.soli_id; + + var community_id = wx.getStorageSync('community').communityId || ''; + + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'car.checkout', + token, + community_id, + voucher_id, + use_quan_str, + buy_type, + latitude, + longitude, + soli_id + }, + dataType: 'json', + method: 'POST', + success: function (res) { + wx.hideLoading(); + if(res.data.code ==1){ + let seller_goodss = res.data.seller_goodss; + let sel_chose_vouche = ''; + for (var i in seller_goodss) { + seller_goodss[i].goodsnum = Object.keys(seller_goodss[i].goods).length; + if (Object.prototype.toString.call(seller_goodss[i].chose_vouche) == '[object Object]') { + sel_chose_vouche = seller_goodss[i].chose_vouche; + } + } + const rdata = res.data; + let current_distance = rdata.current_distance || ''; + let current_distance_str = that.changeDistance(current_distance); + let {score,score_for_money,bue_use_score} = rdata; + let h = {}; + if(bue_use_score*1<=0) h.use_score = ''; + that.setData({ + ...h, + score: score || 0, + score_for_money: score_for_money || 0, + bue_use_score: bue_use_score || 0, + seller_goodss: seller_goodss, + seller_chose_id: voucher_id, + seller_chose_store_id: seller_id, + hide_quan: true, + goods: rdata.goods, + buy_type: rdata.buy_type || 'dan', + yupay: rdata.can_yupay, + is_yue_open: rdata.is_yue_open, + total_free: rdata.total_free, + sel_chose_vouche: sel_chose_vouche, + current_distance, + current_distance_str + },()=>{ + that.calcPrice(1); + }) + } + } + }) + }, + + //关闭优惠券 + closeCouponModal: function(){ + this.setData({ + hide_quan: true + }) + }, + + /** + * 计算总额 + */ + calcPrice: function(isTabSwitch = 0){ + let tdata = this.data; + let { + total_free, + delivery_tuanz_money, + fare_man_shipping_fare_money, + trans_free_toal, + tabIdx, goods, + is_open_vipcard_buy, + is_vip_card_member, + fare_man_delivery_tuanz_fare_money, + pickingup_fare, + localtown_makeup_delivery_money, + buy_type + } = tdata; + total_free *= 1; //合计金额(扣除满减、优惠券,不含运费) + delivery_tuanz_money *= 1; //配送费 + fare_man_shipping_fare_money *= 1; //免多少运费 + trans_free_toal = trans_free_toal*1; + + let tot_price = 0; //计算后合计+运费 + // 商品总额 + let total_goods_price = 0; + let levelAmount = 0; //等级优惠 + + for (let gidx of Object.keys(goods)) { + let item = goods[gidx]; + total_goods_price += item.total; + + if(is_open_vipcard_buy==1&&item.is_take_vipcard==1&&is_vip_card_member==1) { + // 会员优惠 + } else if (item.is_mb_level_buy) { + levelAmount += item.total * 1 - item.level_total * 1; + } + } + + let total_all = total_goods_price; //总额 + // 商品总额+配送费 + if(tabIdx==0){ + tot_price = total_free; + } else if (tabIdx==1){ + // 满免运费 + let is_man_delivery_tuanz_fare = tdata.is_man_delivery_tuanz_fare; //是否达到满xx减团长配送费 + if (is_man_delivery_tuanz_fare==0) { + tot_price = delivery_tuanz_money + total_free; + } else { + tot_price = total_free + delivery_tuanz_money - fare_man_delivery_tuanz_fare_money*1; + } + total_all += delivery_tuanz_money; + } else if(tabIdx==2) { + // 满免快递费 + let is_man_shipping_fare = tdata.is_man_shipping_fare; //是否达到满xx减运费 + total_all += trans_free_toal; + if (is_man_shipping_fare == 0) { + tot_price = trans_free_toal + total_free; + } else { + if(buy_type=="pintuan") { + tot_price = trans_free_toal + total_free; + } else { + tot_price = trans_free_toal + total_free - fare_man_shipping_fare_money*1; + } + } + } else if(tabIdx==3) { + // 同城配送 + let localtown_shipping_fare_arr = this.data.localtown_shipping_fare_arr; + let total_yl_shipping_fare = localtown_shipping_fare_arr.total_yl_shipping_fare*1 || 0; + let total_shipping_fare = localtown_shipping_fare_arr.total_shipping_fare*1 || 0; + total_all += total_yl_shipping_fare; + //包装费 + total_all += pickingup_fare*1 + localtown_makeup_delivery_money*1; + tot_price = total_free + localtown_makeup_delivery_money*1; + tot_price += pickingup_fare*1+total_shipping_fare*1; + } else if (tabIdx==4) { + tot_price = total_free; + } + + //使用积分 + let use_score = tdata.use_score; + if (isTabSwitch && use_score) { + let score_for_money = tdata.score_for_money * 1; + tot_price = tot_price - score_for_money; + } + + let disAmount = 0; //优惠金额 + disAmount = (total_all - tot_price*1).toFixed(2); + + this.setData({ + total_all: total_all.toFixed(2), + disAmount, + tot_price: tot_price.toFixed(2), + total_goods_price: total_goods_price.toFixed(2), + levelAmount: levelAmount.toFixed(2) + }) + + }, + + /** + * 订单留言 20190219 + */ + bindInputMessage: function (event) { + let commentArr = this.data.commentArr; + let idx = event.currentTarget.dataset.idx; + var val = event.detail.value; + commentArr[idx] = val; + this.setData({ commentArr }) + }, + + /** + * 修改首页列表商品购物车数量 + */ + changeIndexList: function(){ + let goods = this.data.goods || []; + if(goods.length>0){ + goods.forEach((item)=>{ + item.option.length == 0 && status.indexListCarCount(item.goods_id, 0); + }) + } + }, + + /** + * 订阅消息 + */ + subscriptionNotice: function() { + let that = this; + return new Promise((resolve, reject)=>{ + let obj = that.data.need_subscript_template; + let tmplIds = Object.keys(obj).map(key => obj[key]); // 订阅消息模版id + if (wx.requestSubscribeMessage) { + tmplIds.length && wx.requestSubscribeMessage({ + tmplIds: tmplIds, + success(res) { + let is_need_subscript = 1; + let acceptId = []; + tmplIds.forEach(item=>{ + if (res[item] == 'accept') { + //用户同意了订阅,添加进数据库 + acceptId.push(item); + } else { + //用户拒绝了订阅或当前游戏被禁用订阅消息 + is_need_subscript = 0; + } + }) + + if(acceptId.length) { + that.addAccept(acceptId); + } + that.setData({ is_need_subscript }) + resolve(); + }, + fail(err) { + console.log(err) + reject(); + } + }) + } else { + // 兼容处理 + reject(); + } + }) + }, + + // 用户点击订阅添加到数据库 + addAccept: function (acceptId) { + let token = wx.getStorageSync('token'); + let type = acceptId.join(','); + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'user.collect_subscriptmsg', + token, + type + }, + dataType: 'json', + method: 'POST', + success: function () {} + }) + }, + + handleTimeModal: function(){ + let localtown_expected_delivery = this.data.localtown_expected_delivery; + if(localtown_expected_delivery.localtown_expected_delivery_status&&localtown_expected_delivery.localtown_delivery_space_month) { + this.setData({ + showAlertTime: !this.data.showAlertTime + }) + } + }, + + selectAlertTime: function(event){ + let idx = event.currentTarget.dataset.idx; + console.log(idx) + this.setData({ + curAlertTime: idx + }) + }, + + selectAlertDate: function(event){ + let idx = event.currentTarget.dataset.idx; + console.log(idx) + let curAlertTime = 0; + if(this.data.localtown_expected_delivery.localtown_delivery_space_month==idx) curAlertTime = -1; + this.setData({ + localtown_delivery_space_month: idx, + curAlertTime + }) + }, + + agreePresaleChange: function(e) { + let state = e.detail.value; + console.log('统一支付定金', state); + this.setData({ isAgreePresale: state }) + }, + + hanlePresaleModal: function(e) { + this.setData({ + showPresaleDesc: !this.data.showPresaleDesc + }) + }, + + showPresaleAmoutDesc: function(){ + wx.showModal({ + title: '优惠说明', + content: '优惠金额将在支付尾款时使用', + showCancel: false + }) + } +}) diff --git a/eaterplanet_ecommerce/pages/order/placeOrder.json b/eaterplanet_ecommerce/pages/order/placeOrder.json new file mode 100644 index 0000000..9e945b5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/placeOrder.json @@ -0,0 +1,17 @@ +{ + "navigationBarTitleText": "提交订单", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-card": "../../components/card/index", + "i-img": "../../components/img/index", + "i-button": "../../components/button/index", + "i-fixed-bottom": "../../components/fixed-bottom/index", + "i-modal": "../../components/modal/index", + "i-dialog": "../../components/dialog/index", + "i-vip-price": "../../components/vipPrice/vipPrice", + "s-form": "../../components/s-form/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/placeOrder.wxml b/eaterplanet_ecommerce/pages/order/placeOrder.wxml new file mode 100644 index 0000000..5d5df19 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/placeOrder.wxml @@ -0,0 +1,584 @@ + + + + + + + + {{item.name}} + + + + {{(tabIdx==0||tabIdx==4)?"提 货 人":"收 货 人"}}: + + + + 手机号码: + + + + {{order_note_name}}: + + + + + + 所在地区: + {{tabAddress[tabIdx].region[0] || "选择地址"}}{{tabAddress[tabIdx].region[1]}}{{tabAddress[tabIdx].region[2]}} + + + + 详细地址: + + + + 上传凭证图片(最多三张) + + + + - + + + + + + + + + 联系人: + + + + + + 联系方式: + + + + + + + 提交申请 + + + + 退款须知 + + 请按照提示关注维权进度和超时提醒并提供相应凭证。 + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/refund.wxss b/eaterplanet_ecommerce/pages/order/refund.wxss new file mode 100644 index 0000000..07c2b9a --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/refund.wxss @@ -0,0 +1,222 @@ +.goods { + background-color: #fff; +} + +.goods-item { + position: relative; + display: flex; + padding: 30rpx; +} + +.goods-item::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + border-bottom: 1px solid #e5e5e5; + transform-origin: 0 0; + transform: scaleY(0.5); +} + +.goods-item-r { + flex: 1; + margin-left: 20rpx; + width: 0; +} + +.show-img { + width: 120rpx; + height: 120rpx; +} + +.name { + font-size: 26rpx; + color: #444; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.mount { + font-size: 22rpx; + color: #aaa; + margin-top: 8rpx; +} + +.goods-item .price { + display: block; + font-size: 28rpx; + color: #444; + margin-top: 14rpx; +} + +.cell { + position: relative; + display: flex; + justify-content: space-between; + background-color: #fff; + padding: 30rpx; + align-items: center; +} + +.cell::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + border-bottom: 1px solid #e5e5e5; + transform-origin: 0 0; + transform: scaleY(0.5); +} + +.cell-hd, +.tit { + color: #000; +} + +.cell-col { + position: relative; + background-color: #fff; + padding: 20rpx 30rpx; +} + +.cell-col .tit { + margin-bottom: 20rpx; +} + +.cell-col::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + border-bottom: 1px solid #e5e5e5; + transform-origin: 0 0; + transform: scaleY(0.5); +} + +.image_uploader_selector { + width: 56px; + height: 56px; + border: 1px dashed #ccc; + display: inline-block; +} + +.image_uploader_indicate { + position: absolute; + font-size: 32px; + color: #ccc; + width: 56px; + height: 56px; + line-height: 52px; + text-align: center; +} + +.cell-ipt { + text-align: right; +} + +.cell-textarea { + width: 100%; +} + +.submit_button { + height: 70rpx; + line-height: 70rpx; + top: 10px; + position: relative; + border-top: 1px solid #eee; + text-align: center; + margin: 15px 30rpx 30px; +} + +.submit_button .span { + padding: 5px 20px; + font-size: 15px; + color: #fff; + background-color: #4facfe; + position: relative; + text-align: center; + border-radius: 5px; +} + +.note { + padding: 30rpx 30rpx 100rpx; +} + +.note-tit { + font-weight: bold; + margin-bottom: 10rpx; + font-size: 28rpx; +} + +.article .p { + font-size: 24rpx; + color: #666; + line-height: 1.6; +} + +.image_uploader_image { + position: relative; + display: inline-block; + width: 56px; + height: 56px; + border: 1px dashed #e6e6e6; + padding: 1px; + box-sizing: border-box; + margin-right: 12px; +} + +.image_uploader_image image { + width: 52px; + height: auto; + max-width: 52px; + max-height: 52px; + overflow: hidden; + margin: auto; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; +} + +.image_uploader_image .image_uploader_image_img_portrait { + width: auto !important; + height: 52px !important; +} + +.image_uploader_image .image_uploader_image_delete { + border-radius: 50%; + -webkit-border-radius: 50%; + position: absolute; + right: -8px; + top: -8px; + background-color: #4facfe; + line-height: 20px; + height: 20px; + width: 20px; + text-align: center; + color: #fff; + font-size: 14px; + font-weight: bold; +} + +.checkbox { + width: 50rpx; + height: 50rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.checkbox .checkbox-img { + width: 48rpx; + height: 48rpx; +} + +.isrefund { + text-decoration: line-through; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/refunddetail.js b/eaterplanet_ecommerce/pages/order/refunddetail.js new file mode 100644 index 0000000..368b064 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/refunddetail.js @@ -0,0 +1,154 @@ +// pages/order/refunddetail.js +var util = require('../../utils/util.js'); +var app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + ref_id: 0, + order_goods: {}, // 20190712 + order_id: 0, + order_info: {}, + order_refund: {}, + order_refund_historylist: [], + refund_images: [] + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var ref_id = options.id; + var that = this; + this.setData({ + ref_id: ref_id + }, ()=>{ + //20190711 + that.getData(); + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + this.getData(); + }, + + sub_cancle: function() { + var order_id = this.data.order_id; + var ref_id = this.data.ref_id; + var token = wx.getStorageSync('token'); + var that = this; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.cancel_refund', + 'token': token, + ref_id: ref_id + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 3) { + //un login + } else if (res.data.code == 1) { + wx.showToast({ + title: '撤销成功', + icon: 'success', + duration: 1000, + success: function(res) { + wx.redirectTo({ + url: "/eaterplanet_ecommerce/pages/order/order?id=" + order_id + }) + } + }) + } + } + }) + + + }, + + getData: function() { + var ref_id = this.data.ref_id; + var token = wx.getStorageSync('token'); + var that = this; + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'afterorder.refunddetail', + token, + ref_id + }, + dataType: 'json', + success: function (res) { + wx.stopPullDownRefresh(); + if (res.data.code == 3) { + //un login + } else if (res.data.code == 1) { + const { order_goods, order_id, order_info, order_refund, order_refund_historylist, refund_images } = res.data; + that.setData({ order_goods, order_id, order_info, order_refund, order_refund_historylist, refund_images }) + } + } + }) + }, + + /** + * 撤销申请 + */ + cancelApply: function () { + let that = this; + wx.showModal({ + title: '撤销申请', + content: '退款申诉一旦撤销就不可恢复,并且不可以再次申请,确定要撤销本次申诉吗?', + confirmText: '我要撤销', + confirmColor: '#ff5344', + cancelText: '暂不撤销', + cancelColor: '#666666', + success(res) { + if (res.confirm) { + that.sub_cancle(); + } + } + }) + }, + + /** + * 修改申请 + */ + editApply: function (){ + const { order_goods, order_refund, } = this.data; + let ref_id = order_refund.ref_id || 0; + let order_id = order_goods.order_id || 0; + let order_goods_id = order_goods.order_goods_id || 0; + + ref_id && order_id && order_goods_id && wx.navigateTo({ + url: `/eaterplanet_ecommerce/pages/order/refund?ref_id=${ref_id}&id=${order_id}&order_goods_id=${order_goods_id}`, + }) + } +}) diff --git a/eaterplanet_ecommerce/pages/order/refunddetail.json b/eaterplanet_ecommerce/pages/order/refunddetail.json new file mode 100644 index 0000000..34225d8 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/refunddetail.json @@ -0,0 +1,7 @@ +{ + "enablePullDownRefresh": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-img": "../../components/img/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/refunddetail.wxml b/eaterplanet_ecommerce/pages/order/refunddetail.wxml new file mode 100644 index 0000000..cbfcb2e --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/refunddetail.wxml @@ -0,0 +1,58 @@ + + + + 审核进度: + + + + + + {{item.message}} + {{item.addtime}} + + + + 暂无记录 + + + + 审核详情: + + + + + + + {{order_goods.name}} + + {{order_goods.option_str}} ¥{{order_goods.price}} x {{order_goods.quantity}} + + ¥{{order_goods.total}} + + + + 实际退款金额:¥{{order_refund.ref_money}} + 问题类型:{{order_refund.ref_name}} + 联系人: {{order_refund.complaint_name}} + 联系方式: {{order_refund.ref_mobile}} + + + + 商品图片: + + + + + + 问题描述: + {{order_refund.ref_description}} + + + + 撤销申请 + 修改申请 + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/refunddetail.wxss b/eaterplanet_ecommerce/pages/order/refunddetail.wxss new file mode 100644 index 0000000..54d8e36 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/refunddetail.wxss @@ -0,0 +1,172 @@ +.wrap { + padding-bottom: 100rpx; +} + +.details { + padding: 30rpx; + background-color: #fff; + margin-bottom: 20rpx; +} + +.tit { + padding-bottom: 20rpx; +} + +.content { + color: #666; +} + +.timeline { + display: flex; + flex-direction: column; + position: relative; +} + +.timeline-item { + display: flex; + flex-direction: row; + position: relative; + padding-bottom: 20rpx; + box-sizing: border-box; + overflow: hidden; +} + +.timeline-item .timeline-item-keynode { + width: 160rpx; + flex-shrink: 0; + box-sizing: border-box; + padding-right: 20rpx; + text-align: right; + line-height: 65rpx; +} + +.timeline-item .timeline-item-divider { + flex-shrink: 0; + position: relative; + width: 30rpx; + height: 30rpx; + top: 6rpx; + border-radius: 50%; + background-color: #bbb; +} + +.timeline-item-divider::before, .timeline-item-divider::after { + position: absolute; + left: 15rpx; + width: 1rpx; + height: 100vh; + content: ''; + background: inherit; +} + +.timeline-item-divider::before { + bottom: 100%; +} + +.timeline-item-divider::after { + top: 100%; +} + +.timeline .timeline-item:last-child .timeline-item-divider:after { + display: none; +} + +.timeline .timeline-item:first-child .timeline-item-divider:before { + display: none; +} + +.timeline-item .timeline-item-content { + padding-left: 20rpx; +} + +.timeline-last-item .bottom-border::after { + display: none; +} + +.timeline-item-content .datetime { + color: #ccc; +} + +.goods { + background-color: #fff; +} + +.goods-item { + position: relative; + display: flex; + padding: 30rpx; +} + +.goods-item-r { + flex: 1; + margin-left: 20rpx; + width: 0; +} + +.show-img { + width: 120rpx; + height: 120rpx; +} + +.name { + font-size: 26rpx; + color: #444; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.mount { + font-size: 22rpx; + color: #aaa; + margin-top: 8rpx; +} + +.goods-item .price { + display: block; + font-size: 28rpx; + color: #444; + margin-top: 14rpx; +} + +.img-list { + display: flex; +} + +.img-list .img { + width: 200rpx; + height: 200rpx; + margin-right: 30rpx; +} + +.ll { + color: #666; + line-height: 2; +} + +.ll text { + color: #333; +} + +.btn { + display: flex; + line-height: 98rpx; + position: fixed; + left: 0; + right: 0; + bottom: 0; +} + +.btn-item { + flex: 1; + text-align: center; + color: #fff; +} + +.btn-item.red { + background: linear-gradient(270deg,#ff758c 0%,#ff7eb3 100%); +} + +.btn-item.bule { + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/shareOrderInfo.js b/eaterplanet_ecommerce/pages/order/shareOrderInfo.js new file mode 100644 index 0000000..da1dabb --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shareOrderInfo.js @@ -0,0 +1,109 @@ +var app = getApp(); +var status = require('../../utils/index.js'); + +Page({ + data: { + order: [], + groupInfo: { + group_name: '社区', + owner_name: '团长' + } + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let that = this; + status.setGroupInfo().then((groupInfo) => { + that.setData({ groupInfo }) + }); + let order_id = options.order_id || 0; + if (order_id == undefined || !order_id){ + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } + wx.showLoading(); + this.getData(order_id); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 获取数据 + */ + getData: function (order_id) { + let that = this; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.order_share_info', + id: order_id, + is_share: 1 + }, + dataType: 'json', + method: 'POST', + success: function (res) { + wx.hideLoading(); + if(res.data.code == 0){ + let order = res.data.data; + let order_info = order.order_info || ''; + if (order_info){ + let { shipping_name, shipping_address } = order_info; + shipping_name = that.formatData(shipping_name, 2); + shipping_address = that.formatData(shipping_address, 6); + order.order_info.shipping_name = shipping_name; + order.order_info.shipping_address = shipping_address; + } + + that.setData({ order }) + } else { + app.util.message(res.data.msg || '请求出错', '', 'error'); + } + } + }) + }, + + /** + * 去商品详情 + */ + goGoodsDetails: function(e){ + let id = e.currentTarget.dataset.id || 0; + let head_id = this.data.order.order_info.head_id || ''; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + id + '&community_id=' + head_id, + }) + }, + + formatData: function(str, len) { + str = str+""; + len = str.length > 3 ? len : 1; + if (str.length > len) { + return str.substr(0, str.length - len) + new Array(len+1).join('*'); + } else { + return str; + } + } +}) diff --git a/eaterplanet_ecommerce/pages/order/shareOrderInfo.json b/eaterplanet_ecommerce/pages/order/shareOrderInfo.json new file mode 100644 index 0000000..b4d92f5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shareOrderInfo.json @@ -0,0 +1,13 @@ +{ + "navigationBarTitleText": "订单详情", + "navigationBarBackgroundColor": "#4facfe", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-order-info-express": "../../components/order/orderInfoExpress", + "i-goods-info": "../../components/goodsInfo/index", + "i-order-info": "../../components/orderInfo/index", + "i-card": "../../components/card/index", + "i-aside-btn": "../../components/asideBtn/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxml b/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxml new file mode 100644 index 0000000..ff5b082 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + 商品详情 + + + + + + + + + {{goodsInfo.name}} + + 规格:{{goodsInfo.option_str}} 数量:{{goodsInfo.quantity}} + + ¥{{goodsInfo.price}} + + + 我也买 + + + + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxss b/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxss new file mode 100644 index 0000000..27f94ba --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shareOrderInfo.wxss @@ -0,0 +1,118 @@ +.content { + padding: 0 20rpx; + padding-bottom: 136rpx; +} + +.order-info, .goods-info, .goods-card { + margin-bottom: 20rpx; +} + +.order-status { + background-color: #fff; + width: 710rpx; + border-radius: 20rpx; + box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.05); + text-align: center; + line-height: 120rpx; + margin: 20rpx 0; + color: #666; + font-size: 32rpx; + padding: 20rpx 0; +} + +.user-info { + display: flex; + justify-content: center; + align-content: center; + line-height: 80rpx; +} + +.order-status image { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + margin-right: 10rpx; +} + +.header { + padding: 20rpx 30rpx; + color: #444; + font-size: 28rpx; + font-weight: 500; +} + +.middle .middle-line { + height: 0.1rpx; + background: #efefef; +} + +.middle .each-item { + box-sizing: border-box; + display: flex; + width: 100%; + padding: 32rpx 30rpx; +} + +.mar-left-8 { + margin-left: 16rpx; +} + +.card-btn { + margin-top: 20rpx; + float: right; + display: flex; +} + +.card-btn .button-hover { + background: #b6b6b6; +} + +.card-btn .btn-3 { + color: white; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + text-align: center; + padding: 0; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + border-radius: 26rpx; + box-sizing: border-box; +} + +.bold-text { + font-weight: 500; +} + +.show-img { + float: left; + width: 120rpx; + height: 120rpx; +} + +.name { + margin-top: -8rpx; + width: 510rpx; + font-size: 26rpx; + color: #444; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.mount { + font-size: 22rpx; + color: #aaa; + margin-top: 10rpx; +} + +.bottom-info { + justify-content: space-between; + font-size: 28rpx; + color: #444; + margin-top: 18rpx; +} + +.bold-text { + font-weight: 500; +} diff --git a/eaterplanet_ecommerce/pages/order/shopCart.js b/eaterplanet_ecommerce/pages/order/shopCart.js new file mode 100644 index 0000000..42364e3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shopCart.js @@ -0,0 +1,1818 @@ +// eaterplanet_ecommerce/pages/order/shopCart.js +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var a = require("../../utils/public"); +var app = getApp(); +var addFlag = 1; + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + allselect: false, + community_id: 0, + allnum: 0, + allcount: "0.00", + recount: "0.00", + carts: {}, + isEmpty: false, + needAuth: false, + cartNum: 0, + isIpx: false, + disAmount: 0, + totalAmount: 0, + tabIdx: 0, + updateCart: 0, + invalidCarts: {}, + tabList: [], + groupInfo: { + group_name: '社区', + owner_name: '团长' + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function() { + let that = this; + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + wx.hideTabBar(); + wx.showLoading(); + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + wx.reLaunch({ + url: '/eaterplanet_ecommerce/pages/order/shopCart', + }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + let that = this; + util.check_login_new().then((res) => { + console.log(res) + if (res) { + var community = wx.getStorageSync('community'); + var community_id = community.communityId || ''; + that.setData({ + needAuth: false, + isEmpty: false, + tabbarRefresh: true, + community_id: community_id, + isIpx: app.globalData.isIpx + }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + that.showCartGoods(); + } else { + that.setData({ needAuth: true, isEmpty: true }); + wx.hideLoading(); + } + }) + }, + + /** + * 获取购物车信息20190604 + */ + showCartGoods: function(){ + let that = this; + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + console.log('onshow购物车里面的community_id:'); + that.setData({ community_id: community_id }) + var token = wx.getStorageSync('token'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.show_cart_goods', + token: token, + community_id: community_id, + buy_type: 'dan', + }, + dataType: 'json', + success: function (res) { + // wx.hideLoading(); + setTimeout(function(){ wx.hideLoading(); },1000); + if (res.data.code == 0) { + //20190720 + let mult_carts = res.data.mult_carts || []; + let carts = {}; + let tabIdx = that.data.tabIdx; + let showTab = false; + + // tab名称自定义 + let { shopcar_tab_express_name, shopcar_tab_all_name } = res.data; + let tabList = [ + { id: 0, name: shopcar_tab_all_name || '全部商品', enabled: false }, + { id: 1, name: shopcar_tab_express_name || '快递商品', enabled: false }, + { id: 2, name: '到店核销', enabled: false }, + { id: 3, name: '同城配送', enabled: false } + ]; + + //20200220 + let mulCartArr = Object.keys(mult_carts); + let objLen = mulCartArr.length; + if (objLen > 1){ + showTab = true; + mulCartArr.forEach((item)=>{ + tabList[item].enabled = true; + }) + carts = mult_carts[tabIdx] || {}; + } else if(objLen==1) { + tabIdx = mulCartArr[0]; + carts = mult_carts[tabIdx] || {}; + } + + let isEmpty = true; + if (Object.keys(carts).length != 0) { + isEmpty = false; + carts = that.sortCarts(carts); + } + let { + man_free_tuanzshipping, + delivery_tuanz_money, + is_comunity_rest, + open_man_orderbuy, + man_orderbuy_money, + is_show_guess_like, + is_open_vipcard_buy, + is_vip_card_member, + vipcard_save_money, + modify_vipcard_name, + is_member_level_buy, + level_save_money, + open_tuan_ship, + full_list, + is_open_fullreduction, + localtown_moneytype_fixed_deliverymoney, + localtown_moneytype_fixed_freemoney + } = res.data; + + that.setData({ + tabIdx, + carts, + mult_carts, + showTab, + isEmpty, + is_comunity_rest, + open_man_orderbuy, + man_orderbuy_money: man_orderbuy_money * 1, + is_show_guess_like, + man_free_tuanzshipping, // 需要金额 + delivery_tuanz_money, //配送费 + is_open_vipcard_buy, + is_vip_card_member, + vipcard_save_money, + modify_vipcard_name: modify_vipcard_name?modify_vipcard_name:'天机会员', + is_member_level_buy, + level_save_money, + tabList, + open_tuan_ship, + full_list, + is_open_fullreduction, + localtown_moneytype_fixed_deliverymoney, + localtown_moneytype_fixed_freemoney + }) + that.xuan_func(); + } else { + that.setData({ + needAuth: true, + isEmpty: true + }) + } + } + }) + }, + + onHide: function() { + this.setData({ + tabbarRefresh: false + }) + console.log('onHide') + }, + + /** + * 商品排序 + */ + sortCarts: function(carts) { + // 先剔除失效(保留原有结构)=>再分出满减 + let is_open_fullreduction = 0; + let full_reducemoney = 0; + let full_money = 0; + let invalidCarts = {}; + let hasInvalid = 0; + + for (let i in carts) { + is_open_fullreduction = carts[i].is_open_fullreduction; + full_reducemoney = carts[i].full_reducemoney; + full_money = carts[i].full_money; + invalidCarts[i] = { + id: carts[i].id, + shopcarts: [] + }; + + let shopcarts = carts[i].shopcarts; + let oriShopcarts = []; + shopcarts.forEach(function(item, index) { + if(item.can_buy==0 || item.option_can_buy==0) { + invalidCarts[i].shopcarts.push(item); + hasInvalid += 1; + } else { + oriShopcarts.push(item); + } + }) + carts[i].shopcarts = oriShopcarts; + oriShopcarts.sort(function(x, y) { + if (x.can_man_jian < y.can_man_jian) { + return 1; + } + if (x.can_man_jian > y.can_man_jian) { + return -1; + } + return 0; + }); + } + this.setData({ + is_open_fullreduction, + full_reducemoney, + full_money, + invalidCarts, + hasInvalid + }); + return carts; + }, + + xuan_func: function() { + var allnum = 0; + var allcount = 0 + + var flag = 1; + var allselect = false; + var all_cant_buy = 1; + for (var i in this.data.carts) { + var count = 0; + this.data.carts[i].goodstypeselect = 0; + this.data.carts[i].goodstype = this.data.carts[i].shopcarts.length; + + for (var j = 0; j < this.data.carts[i].shopcarts.length; j++) { + let shopcartsItem = this.data.carts[i].shopcarts[j]; + if (shopcartsItem.isselect == false && shopcartsItem.can_buy == 1 && shopcartsItem.can_buy == 1 && shopcartsItem.option_can_buy == 1) flag = 0; + if (shopcartsItem.isselect && shopcartsItem.can_buy == 1 && shopcartsItem.can_buy == 1 && shopcartsItem.option_can_buy == 1) { + all_cant_buy = 0; + //20190927 + count = this.calcVipPrice(count, shopcartsItem); + this.data.carts[i].goodstypeselect++; + allnum = parseInt(allnum) + parseInt(shopcartsItem.goodsnum); + } + + if (shopcartsItem.can_buy == 0) shopcartsItem.isselect = false; + } + this.data.carts[i].count = count.toFixed(2); + allcount = allcount + count; + } + if (flag == 1 && all_cant_buy == 0) { //是全部选中 + allselect = true; + } + this.setData({ + allselect: allselect, + allnum: allnum, + allcount: allcount.toFixed(2), + carts: this.data.carts + }); + this.calcAmount(); + }, + + //编辑点击事件处理函数 + edit: function(e) { + var index = parseInt(e.target.dataset.index); + this.data.carts[index].caredit = "none"; + this.data.carts[index].finish = "inline"; + for (var i = 0; i < this.data.carts[index].shopcarts.length; i++) { + this.data.carts[index].shopcarts[i].edit = "none"; + this.data.carts[index].shopcarts[i].finish = "inline"; + this.data.carts[index].shopcarts[i].description = "onedit-description"; + this.data.carts[index].shopcarts[i].cartype = "block"; + } + this.setData({ + carts: this.data.carts + }) + + }, + + //完成点击事件处理函数 + finish: function(e) { + var index = parseInt(e.target.dataset.index); + this.data.carts[index].caredit = "inline"; + this.data.carts[index].finish = "none"; + for (var i = 0; i < this.data.carts[index].shopcarts.length; i++) { + this.data.carts[index].shopcarts[i].edit = "inline"; + this.data.carts[index].shopcarts[i].finish = "none"; + this.data.carts[index].shopcarts[i].description = "description"; + this.data.carts[index].shopcarts[i].cartype = "inline"; + } + this.setData({ + carts: this.data.carts + }) + }, + + goLink: function(event) { + let link = event.currentTarget.dataset.link; + wx.navigateTo({ + url: link + }) + + }, + + goGoods: function(event) { + let id = event.currentTarget.dataset.type; + + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: '/Snailfish_shop/pages/goods/index?id=' + id + }) + } else { + wx.navigateTo({ + url: '/Snailfish_shop/pages/goods/index?id=' + id + }) + } + + }, + + //店铺点击选择事件 + shopselect: function(e) { + var index = parseInt(e.target.dataset.index); + var allselect = this.data.allselect; + var isselect = this.data.carts[index].isselect; + var allnum = 0; + var allcount = 0.00; + var count = 0.00; + if (isselect == true) { //店铺为选中状态 + this.data.carts[index].isselect = false; + allselect = false; + for (var i = 0; i < this.data.carts[index].shopcarts.length; i++) { //循环商店下商品,改成不选中 + if (this.data.carts[index].shopcarts[i].isselect == true) { + this.data.carts[index].shopcarts[i].isselect = false; + allnum = parseInt(allnum) + parseInt(this.data.carts[index].shopcarts[i].goodsnum); + this.data.carts[index].goodstypeselect = this.data.carts[index].goodstypeselect - 1; + } + + } + allnum = this.data.allnum - allnum; //去除不选中商店的产品数量 + allcount = parseFloat(this.data.allcount) - parseFloat(this.data.carts[index].count); + this.data.carts[index].count = "0.00"; + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } else { + var addcount = 0.00; + this.data.carts[index].isselect = true; + for (var i = 0; i < this.data.carts[index].shopcarts.length; i++) { + let goodsItem = this.data.carts[index].shopcarts[i]; + if (goodsItem.isselect == false) { + goodsItem.isselect = true; + this.data.carts[index].goodstypeselect = this.data.carts[index].goodstypeselect + 1; + allnum = parseInt(allnum) + parseInt(goodsItem.goodsnum); + addcount = this.calcVipPrice(addcount, goodsItem); + } + // 20190927 + count = this.calcVipPrice(count, goodsItem); + } + allnum = this.data.allnum + allnum; + allcount = parseFloat(this.data.allcount) + addcount; + this.data.carts[index].count = count.toFixed(2); + var flag = 1; + for (var i in this.data.carts) { + for (var j = 0; j < this.data.carts[i].shopcarts.length; j++) + if (this.data.carts[i].shopcarts[j].isselect == false) + flag = 0; + } + if (flag == 1) { //是全部选中 + allselect = true; + } + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } + this.go_record(); + }, + + //点击商品选中事件函数 + goodsselect: function(e) { + var parentid = parseInt(e.target.dataset.parentid); + var index = parseInt(e.target.dataset.index); + var allselect = this.data.allselect; + let goodsItem = this.data.carts[parentid].shopcarts[index]; + var isselect = goodsItem.isselect; + + if (isselect == true) { //商品选中状态 + goodsItem.isselect = false; + if (allselect) + allselect = false; + + this.data.carts[parentid].goodstypeselect = parseInt(this.data.carts[parentid].goodstypeselect) - 1; + if (this.data.carts[parentid].goodstypeselect <= 0) { //选中商品为0 + this.data.carts[parentid].isselect = false; + } + var allnum = parseInt(this.data.allnum) - parseInt(goodsItem.goodsnum); + // 20190927 + var allcount = this.calcVipPrice(this.data.allcount, goodsItem, '', 'red'); + var count = this.calcVipPrice(this.data.carts[parentid].count, goodsItem, '', 'red'); + + this.data.carts[parentid].count = count.toFixed(2); + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } else { //商品为非选中状态 + goodsItem.isselect = true; + this.data.carts[parentid].goodstypeselect = parseInt(this.data.carts[parentid].goodstypeselect) + 1; + + if (this.data.carts[parentid].goodstypeselect > 0) { //选中商品个数大于0 + this.data.carts[parentid].isselect = true; + } + var flag = 1; + for (var i in this.data.carts) { + console.log('in'); + for (var j = 0; j < this.data.carts[i].shopcarts.length; j++) + if (this.data.carts[i].shopcarts[j].isselect == false && this.data.carts[i].shopcarts[j].can_buy == 1 && this.data.carts[i].shopcarts[j].option_can_buy == 1) flag = 0; + } + + if (flag == 1) { //全部商品选中 + allselect = true; + } + var allnum = parseInt(this.data.allnum) + parseInt(goodsItem.goodsnum); + // 20190927 + var allcount = this.calcVipPrice(this.data.allcount, goodsItem); + var count = this.calcVipPrice(this.data.carts[parentid].count, goodsItem); + + this.data.carts[parentid].count = count.toFixed(2); + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } + this.go_record(); + }, + + //全部选中事件函数 + allselect: function(e) { + var allselect = this.data.allselect; + var carts = this.data.carts; + + if (allselect) { //点击前为全部选中状态 + allselect = false; + var allnum = 0; + var allcount = 0.00; + for (var i in this.data.carts) { + this.data.carts[i].count = "0.00"; + this.data.carts[i].isselect = false; + this.data.carts[i].goodstypeselect = 0; + for (var j in this.data.carts[i].shopcarts) + this.data.carts[i].shopcarts[j].isselect = false; + } + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } else { //点击前为不全部选址状态 + allselect = true; + var allnum = 0; + var allcount = 0.00; + + for (var i in this.data.carts) { + var count = 0; + this.data.carts[i].isselect = true; + let shopcarts = this.data.carts[i].shopcarts; + this.data.carts[i].goodstypeselect = shopcarts.length; + for (var j in shopcarts) { + if (shopcarts[j].can_buy == 1 && shopcarts[j].option_can_buy == 1) { + //20190927 + count = this.calcVipPrice(count, shopcarts[j]); + allnum = parseInt(allnum) + parseInt(this.data.carts[i].shopcarts[j].goodsnum); + shopcarts[j].isselect = true; + } + } + this.data.carts[i].count = count.toFixed(2); + allcount = allcount + count; + } + + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: allselect + }); + } + this.go_record(); + }, + + //减少商品数量函数 + regoodsnum: function(e) { + var parentid = parseInt(e.currentTarget.dataset.parentid); + var index = parseInt(e.currentTarget.dataset.index); + let updateCart = this.data.updateCart; + let goodsItem = this.data.carts[parentid].shopcarts[index]; + + // 起购数量 + let goods_start_count = goodsItem.goods_start_count || 1; + + var that = this; + var goodsnum = goodsItem.goodsnum; + if (goodsnum == 1 || goodsnum<=goods_start_count) { //减少前商品数量为1 + that.cofirm_del(parentid, index); + } else { //减少前商品的数量不为1 + if (goodsItem.isselect == true) { //商品为选中状态 + var allnum = parseInt(this.data.allnum) - 1; + //20190927 + var allcount = this.calcVipPrice(that.data.allcount, goodsItem, 1, 'red'); + var count = this.calcVipPrice(this.data.carts[parentid].count, goodsItem, 1, 'red'); + + that.data.carts[parentid].count = count.toFixed(2); + goodsItem.goodsnum = goodsItem.goodsnum - 1; + this.setData({ + carts: this.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2) + }); + } else { //商品为非选中状态 + goodsItem.goodsnum = parseInt(goodsItem.goodsnum) - 1; + this.setData({ + carts: this.data.carts + }); + } + } + if (goodsItem.goodstype == '') { + let goodsnum = goodsItem.goodsnum * 1; + let gid = e.currentTarget.dataset.gid; + status.indexListCarCount(gid, goodsnum); + that.setData({ updateCart: updateCart + 1 }) + } + let cur_car_key = goodsItem.key || ''; + that.go_record(cur_car_key); + }, + + /** + * 确认删除提示框 + */ + cofirm_del: function(parentid, index, type = 1) { + let that = this; + let updateCart = this.data.updateCart; + let goodsItem = that.data.carts[parentid].shopcarts[index]; + // 起购数量 + let goods_start_count = goodsItem.goods_start_count || 1; + let content = ''; + if(goods_start_count>1) content =`该商品的起购数是${goods_start_count},`; + wx.showModal({ + title: '提示', + content: content + '确定删除这件商品吗?', + confirmColor: "#4facfe", + success: function(res) { + if (res.confirm) { + if (goodsItem.goodstype == '') { + let gid = goodsItem.id; + status.indexListCarCount(gid, 0); + that.setData({ updateCart: updateCart + 1 }) + } + var del_car_keys = goodsItem.key; + // 起购数量 + let goodsnum = goodsItem.goodsnum; + let reduceNum = goods_start_count; + if(goodsnum { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + if (goodsItem.goodstype == '') { + let goodsnum = goodsItem.goodsnum * 1; + let gid = e.currentTarget.dataset.gid; + status.indexListCarCount(gid, goodsnum); + that.setData({ updateCart: updateCart + 1 }) + } + } else { + goodsItem.goodsnum = parseInt(goodsItem.goodsnum) - 1; + if (goodsItem.isselect == true) { + // 20190927 + var allcount_new = that.calcVipPrice(that.data.allcount, goodsItem, 1, 'red'); + var count_new = that.calcVipPrice(that.data.carts[parentid].count, goodsItem, 1, 'red'); + + that.data.carts[parentid].count = count_new.toFixed(2); + allnum--; + that.setData({ + allnum: allnum, + allcount: allcount_new.toFixed(2) + }); + } + that.setData({ + carts: that.data.carts + }); + + wx.showToast({ + title: msg.data.msg, + icon: 'none', + duration: 2000 + }) + } + addFlag = 1; + that.calcAmount(); + } + }) + }, + + /** + * 输入框监控 + */ + changeNumber: function(e) { + if (Object.keys(this.data.carts).length<=0) return; + wx.hideLoading(); + var that = this; + var parentid = parseInt(e.currentTarget.dataset.parentid); + var index = parseInt(e.currentTarget.dataset.index); + var iptVal = e.detail.value; + var newCount = that.count_goods(parentid, index); + let goodsItem = this.data.carts[parentid].shopcarts[index]; + let lastGoodsnum = goodsItem.goodsnum; + console.log(iptVal); + let updateCart = this.data.updateCart || 0; + if (iptVal > 0) { + var max_quantity = parseInt(goodsItem.max_quantity); + if (iptVal > max_quantity) { + iptVal = max_quantity; + wx.showToast({ + title: '不能购买更多啦', + icon: 'none' + }) + } + goodsItem.goodsnum = iptVal; + if (that.data.carts[parentid].shopcarts[index].isselect == true) { //商品为选中状态 + newCount = that.count_goods(parentid, index); + } + this.setData({ + carts: this.data.carts, + allnum: newCount.allnum, + allcount: newCount.allcount + }); + + var token = wx.getStorageSync('token'); + var keys_arr = []; + var all_keys_arr = []; + var allnum = this.data.allnum; + var carts = this.data.carts; + + for (var i in carts) { + for (var j in carts[i]['shopcarts']) { + keys_arr.push(carts[i]['shopcarts'][j]['key']); + all_keys_arr.push(carts[i]['shopcarts'][j]['key'] + '_' + carts[i]['shopcarts'][j]['goodsnum']); + } + } + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.checkout_flushall', + token, + car_key: keys_arr, + community_id: that.data.community_id, + all_keys_arr: all_keys_arr, + cur_car_key: goodsItem.key || '' + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + if (msg.data.code == 0) { + that.setData({ + carts: that.data.carts + }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + if (that.data.carts[parentid].shopcarts[index].goodstype == '') { + let goodsnum = that.data.carts[parentid].shopcarts[index].goodsnum * 1; + let gid = that.data.carts[parentid].shopcarts[index].id; + status.indexListCarCount(gid, goodsnum); + that.setData({ updateCart: updateCart + 1 }) + } + that.go_record(); + } else { + that.data.carts[parentid].shopcarts[index].goodsnum = lastGoodsnum; + if (that.data.carts[parentid].shopcarts[index].isselect == true) { //商品为选中状态 + newCount = that.count_goods(parentid, index); + } + that.setData({ + carts: that.data.carts, + allnum: newCount.allnum, + allcount: newCount.allcount + }); + + wx.showToast({ + title: msg.data.msg, + icon: 'none', + duration: 2000 + }) + } + } + }) + } else { + wx.hideLoading(); + this.data.carts[parentid].shopcarts[index].goodsnum = 1; + if (that.data.carts[parentid].shopcarts[index].isselect == true) { //商品为选中状态 + newCount = that.count_goods(parentid, index); + } + this.setData({ + carts: this.data.carts, + allnum: newCount.allnum, + allcount: newCount.allcount + }); + var token = wx.getStorageSync('token'); + var keys_arr = []; + var all_keys_arr = []; + var allnum = this.data.allnum; + var carts = this.data.carts; + + for (var i in carts) { + for (var j in carts[i]['shopcarts']) { + keys_arr.push(carts[i]['shopcarts'][j]['key']); + all_keys_arr.push(carts[i]['shopcarts'][j]['key'] + '_' + carts[i]['shopcarts'][j]['goodsnum']); + } + } + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.checkout_flushall', + 'token': token, + 'car_key': keys_arr, + community_id: that.data.community_id, + 'all_keys_arr': all_keys_arr, + cur_car_key: goodsItem.key || '' + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + if (msg.data.code == 0) { + that.setData({ + carts: that.data.carts + }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + if (that.data.carts[parentid].shopcarts[index].goodstype == '') { + let goodsnum = that.data.carts[parentid].shopcarts[index].goodsnum * 1; + let gid = that.data.carts[parentid].shopcarts[index].id; + status.indexListCarCount(gid, goodsnum); + that.setData({ updateCart: updateCart + 1 }) + } + that.go_record(); + } + } + }) + that.cofirm_del(parentid, index); + } + }, + + count_goods: function(parentid, index) { + let that = this; + let carts = this.data.carts; + // let cart = carts[parentid]; + let allnum = 0; + let allcount = 0; + + for (let carsKey of Object.keys(carts)) { + let cart = carts[carsKey]; + cart.shopcarts.forEach(function (item, idx) { + if (item.isselect) { + allcount = that.calcVipPrice(allcount, item); + allnum += parseInt(item.goodsnum); + } + }) + } + + return { + allnum, + allcount: allcount.toFixed(2) + } + }, + + //删除商品函数 + delgoods: function(e) { + var parentid = parseInt(e.target.dataset.parentid); + var index = parseInt(e.target.dataset.index); + var that = this; + wx.showModal({ + title: '提示', + content: '确定删除这件商品吗?', + confirmColor: "#4facfe", + success: function(res) { + if (res.confirm) { + let goodsItem = that.data.carts[parentid].shopcarts[index]; + var del_car_keys = goodsItem.key; + if (goodsItem.isselect == true) { //商品为选中状态 + var allnum = parseInt(that.data.allnum) - parseInt(goodsItem.goodsnum); + // 20190927 + var allcount = that.calcVipPrice(that.data.allcount, goodsItem, 1, 'red'); + var count = that.calcVipPrice(that.data.carts[parentid].count, goodsItem, 1, 'red'); + + that.data.carts[parentid].count = count.toFixed(2); + that.data.carts[parentid].goodstype = that.data.carts[parentid].goodstype - 1; + that.data.carts[parentid].goodstypeselect = that.data.carts[parentid].goodstypeselect - 1 + if (that.data.carts[parentid].goodstype == 0) { + console.log(parentid); + //that.data.carts.splice(parentid, 1) + that.data.carts[parentid].shopcarts.splice(index, 1); + } else { + that.data.carts[parentid].shopcarts.splice(index, 1); + } + var num = 0; + for (var i = 0; i < that.data.carts.length; i++) { + for (var j = 0; j < that.data.carts[i].shopcarts.length; j++) { + num = num + that.data.carts[i].shopcarts[j].goodsnum; + } + } + if (allnum == num) + that.data.allselect = true; + that.setData({ + carts: that.data.carts, + allnum: allnum, + allcount: allcount.toFixed(2), + allselect: that.data.allselect + }); + } else { //商品为选中状态 + that.data.carts[parentid].goodstype = that.data.carts[parentid].goodstype - 1; + if (that.data.carts[parentid].goodstype == 0) { + that.data.carts[parentid].shopcarts.splice(index, 1); + } else { + that.data.carts[parentid].shopcarts.splice(index, 1); + } + var num = 0; + for (var i = 0; i < that.data.carts.length; i++) { + for (var j = 0; j < that.data.carts[i].shopcarts.length; j++) { + num = num + that.data.carts[i].shopcarts[j].goodsnum; + } + } + if (that.data.allnum == num) + that.data.allselect = true; + that.setData({ + carts: that.data.carts, + allselect: that.data.allselect + }); + } + + if (that.data.carts[parentid].shopcarts.length == 0) { + delete that.data.carts[parentid]; + if (Object.keys(that.data.carts).length == 0) { + that.setData({ + carts: [] + }); + } + } + //删除商品 + that.del_car_goods(del_car_keys); + } + } + }) + this.go_record(); + }, + + del_car_goods: function (carkey, isLose=0) { + var token = wx.getStorageSync('token'); + var that = this; + let updateCart = this.data.updateCart; + console.log('del_car_goods:开始'); + + var community = wx.getStorageSync('community'); + var community_id = community.communityId; + console.log('缓存中的:' + community_id); + console.log('使用中的:' + that.data.community_id); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.del_car_goods', + carkey: carkey, + community_id: that.data.community_id, + token: token + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + if (msg.data.code == 0 && isLose != 1) { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data, + updateCart: updateCart + 1 + }); + }); + } + } + }) + }, + + /** + * 提示不可购买并提示是否删除 + */ + delete: function (e) { + var parentid = parseInt(e.currentTarget.dataset.parentid); + var index = parseInt(e.currentTarget.dataset.index); + var isLost = e.currentTarget.dataset.islost || 0; + var that = this; + wx.showModal({ + title: '提示', + content: '确认删除这件商品吗?', + confirmColor: "#4facfe", + success: function(res) { + if (res.confirm) { + if (isLost==1) { + let {hasInvalid,invalidCarts} = that.data; + console.log(parentid) + let del_car_keys = invalidCarts[parentid].shopcarts[index].key; + invalidCarts[parentid].shopcarts.splice(index, 1); + hasInvalid -= 1; + that.setData({ invalidCarts, hasInvalid }); + that.del_car_goods(del_car_keys, 1); + } else { + let carts = that.data.carts; + let del_car_keys = carts[parentid].shopcarts[index].key; + carts[parentid].shopcarts.splice(index, 1); + that.setData({ + carts: carts + }); + if (carts[parentid].shopcarts.length == 0) { + delete carts[parentid]; + if (Object.keys(carts).length == 0) { + that.setData({ + carts: {} + }); + } + } + //删除商品 + that.del_car_goods(del_car_keys); + } + } + } + }) + }, + + //清空失效商品函数 + clearlose: function() { + var that = this; + wx.showModal({ + title: '提示', + content: '确认清空失效商品吗?', + confirmColor: "#4facfe", + success: function(res) { + if (res.confirm) { + let invalidCarts = that.data.invalidCarts; + + for (let idx in invalidCarts) { + let shopcarts = invalidCarts[idx].shopcarts; + shopcarts.forEach(function(item){ + let del_car_keys = item.key; + that.del_car_goods(del_car_keys, 1); + }) + } + that.setData({ + hasInvalid: 0, + invalidCarts: {} + }); + } + } + }) + }, + + //记录购物车状态值,为了下次进来还是和上次一样 + go_record: function(cur_car_key='') { + var that = this; + var token = wx.getStorageSync('token'); + var keys_arr = []; + var all_keys_arr = []; + var allnum = this.data.allnum; + var carts = this.data.carts; + + for (var i in carts) { + for (var j in carts[i]['shopcarts']) { + if (carts[i]['shopcarts'][j]['isselect']) { + keys_arr.push(carts[i]['shopcarts'][j]['key']); + } + all_keys_arr.push(carts[i]['shopcarts'][j]['key'] + '_' + carts[i]['shopcarts'][j]['goodsnum']); + } + } + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.checkout_flushall', + token: token, + car_key: keys_arr, + community_id: that.data.community_id, + all_keys_arr: all_keys_arr, + cur_car_key + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + if (msg.data.code == 0) { + // todo + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } else { + wx.showToast({ + title: msg.data.msg, + icon: 'none', + duration: 2000 + }) + } + + } + }) + that.calcAmount(); + }, + + //结算跳转页面函数 + toorder: function() { + var token = wx.getStorageSync('token'); + var keys_arr = []; + var all_keys_arr = []; + var that = this; + + var allnum = this.data.allnum; + if (allnum > 0) { + var carts = this.data.carts; + for (var i in carts) { + for (var j in carts[i]['shopcarts']) { + if (carts[i]['shopcarts'][j]['isselect']) { + keys_arr.push(carts[i]['shopcarts'][j]['key']); + } + + all_keys_arr.push(carts[i]['shopcarts'][j]['key'] + '_' + carts[i]['shopcarts'][j]['goodsnum']); + } + } + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'car.checkout_flushall', + token: token, + community_id: that.data.community_id, + car_key: keys_arr, + all_keys_arr: all_keys_arr + }, + method: 'POST', + dataType: 'json', + success: function(msg) { + if (msg.data.code == 0) { + let is_limit = msg.data.data || 0; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/order/placeOrder?type=dan&is_limit=' + is_limit + }) + } else { + that.showCartGoods(); + wx.showToast({ + title: msg.data.msg, + icon: 'none', + duration: 2000 + }) + } + } + }) + + } else { + wx.showModal({ + title: '提示', + content: '请选择您要购买的商品', + confirmColor: "#4facfe", + success: function(res) { + if (res.confirm) { + + } + } + }) + } + + }, + + goindex: function() { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + }, + + /** + * 计算优惠 + */ + calcAmount: function() { + let { + is_open_vipcard_buy, + is_vip_card_member, + carts, + delivery_tuanz_money, + man_free_tuanzshipping, + full_list, + allcount, + tabIdx + } = this.data; + let totalAmount = 0; //合计 + let disAmount = 0; //优惠 + let diffMoney = 0; //差多少可满减 + let cartsArr = Object.keys(carts); + let allReducGoods = []; //所有满减商品 + let full_money = 0; + let full_reducemoney = 0; + let isCanManJian = 0; + + // 免配送费 + let deliveryGoodsTot = 0; + let selectGoodsTot = 0; //商品价格合计 + + // 开通vip优惠提示 + let vipFee = 0; + let levelFee = 0; + let localtown_fee_list = tabIdx==3?{}:''; //同城配送起送优惠信息 + + cartsArr.forEach(key => { + let cart = carts[key]; + let shopcarts = cart.shopcarts; + full_money = cart.full_money * 1; + full_reducemoney = cart.full_reducemoney * 1; + let localtown_fixed_list = cart.localtown_fixed_list || ''; + let curSelectGoodsTot = 0; //当前平台选中商品合计 + // 1选提取所有的满减商品 + shopcarts.forEach(function(item) { + if (item.isselect && item.can_man_jian) { + allReducGoods.push(item); + } + if (item.isselect && man_free_tuanzshipping > 0 && delivery_tuanz_money > 0) { + if (is_open_vipcard_buy == 1 && is_vip_card_member == 1 && item.is_take_vipcard == 1) { + accordTot += item.card_price * item.goodsnum * 1; + } else if (item.is_mb_level_buy == 1){ + accordTot += item.levelprice * item.goodsnum * 1; + } else { + accordTot += item.currntprice * item.goodsnum * 1; + } + } + + //vip优惠 + if (is_open_vipcard_buy == 1 && is_vip_card_member == 1 && item.is_take_vipcard == 1 && item.isselect) { + vipFee += (item.currntprice - item.card_price) * item.goodsnum * 1; + } else if (item.is_mb_level_buy == 1 && item.isselect) { + //等级优惠 + levelFee += (item.currntprice - item.levelprice) * item.goodsnum * 1; + } + + //自营商品满减配送费商品合计 + if (item.isselect && item.store_id==0) { + if (is_open_vipcard_buy == 1 && is_vip_card_member == 1 && item.is_take_vipcard == 1) { + deliveryGoodsTot += item.card_price * item.goodsnum * 1; + } else if (item.is_mb_level_buy == 1){ + deliveryGoodsTot += item.levelprice * item.goodsnum * 1; + } else { + deliveryGoodsTot += item.currntprice * item.goodsnum * 1; + } + } + + // 商品合计 + if (item.isselect) { + selectGoodsTot += item.currntprice * item.goodsnum * 1; + } + + //同城配送 + if (item.isselect && tabIdx==3) { + curSelectGoodsTot += item.currntprice * item.goodsnum * 1; + } + }) + if(tabIdx==3){ + let { localtown_moneytype_fixed_deliverymoney, localtown_moneytype_fixed_freemoney } = localtown_fixed_list; + let localtownCanBuy = localtown_moneytype_fixed_deliverymoney - curSelectGoodsTot; //>0显示起送差额 + let localtownManJian = localtown_moneytype_fixed_freemoney - curSelectGoodsTot; //>0显示免配送差额 + localtown_fee_list[key] = {}; + localtown_fee_list[key].localtownCanBuy = localtownCanBuy.toFixed(2); + localtown_fee_list[key].localtownManJian = localtownManJian.toFixed(2); + localtown_fee_list[key].localtown_moneytype_fixed_deliverymoney = localtown_moneytype_fixed_deliverymoney; + localtown_fee_list[key].localtown_moneytype_fixed_freemoney = localtown_moneytype_fixed_freemoney; + } + }) + + // 计算满减金额 + let accordTot = 0; + allReducGoods.forEach(function(item) { + if (item.isselect && item.can_man_jian) { + if (is_open_vipcard_buy == 1 && is_vip_card_member == 1 && item.is_take_vipcard==1) { + accordTot += item.card_price * item.goodsnum * 1; + } else if (item.is_mb_level_buy == 1){ + accordTot += item.levelprice * item.goodsnum * 1; + } else { + accordTot += item.currntprice * item.goodsnum * 1; + } + isCanManJian = 1; + } + }) + + let currentMjIdx = -1; //当前满减索引 + full_list.forEach((item, index)=>{ + if(accordTot >= item.full_money) { + full_money = item.full_money*1; + full_reducemoney = item.full_reducemoney*1; + full_list[index].disable = true; + currentMjIdx = index; + } else { + full_list[index].disable = false; + } + }) + // 未满足 + let cur_full_item = null; + // 已享 + let sucess_full_item = null; + let tot_full_len = full_list.length || 0; + if(currentMjIdx==-1){ + cur_full_item = full_list[0]; + } else { + if(currentMjIdx= full_money) { + disAmount += full_reducemoney; + } else { + diffMoney = full_money - accordTot; + } + + let nextDiffMoney = 0; + if(full_list.length > currentMjIdx+1) { + nextDiffMoney = full_list[currentMjIdx+1].full_money*1 - accordTot; + } + + // 优惠金额(包含满减,会员等级优惠) + disAmount += vipFee + levelFee; + + totalAmount = (allcount * 1 - disAmount).toFixed(2); + totalAmount = totalAmount <= 0 ? 0 : totalAmount; + + let canbuy_tot = allcount * 1; //合计 计算满多少下单使用 + let canbuy_other = canbuy_tot - this.data.man_orderbuy_money; + let vipTotal = selectGoodsTot; + let levelToTal = selectGoodsTot; + + // 团长满配送费 + let diffDeliveryMoney = 0; + if (deliveryGoodsTot < man_free_tuanzshipping*1) { + diffDeliveryMoney = man_free_tuanzshipping*1 - deliveryGoodsTot; + } + + // 同城配送 + let localtownCanBuy = true; //是否可以结算 + if(tabIdx==3) { + Object.keys(localtown_fee_list).forEach(idx=>{ + if(localtown_fee_list[idx].localtownCanBuy>0&&carts[idx].isselect) localtownCanBuy = false; + }) + } + + console.log('=====carts=====', Object.keys(carts)) + // let cartsNull = false; + // if(Object.keys(carts).length==0){cartsNull = true;} + this.setData({ + // cartsNull, + isCanManJian, + canbuy_tot, + totalAmount, + disAmount: disAmount.toFixed(2), + diffMoney: diffMoney.toFixed(2), + canbuy_other: canbuy_other.toFixed(2), + diffDeliveryMoney: diffDeliveryMoney.toFixed(2), + vipFee: vipFee.toFixed(2), + vipTotal: vipTotal.toFixed(2), + levelFee: levelFee.toFixed(2), + levelToTal: levelToTal.toFixed(2), + full_reducemoney, + full_list, + nextDiffMoney: nextDiffMoney.toFixed(2), + cur_full_item, + sucess_full_item, + localtown_fee_list, + localtownCanBuy + }) + }, + + /** + * vip商品价格计算 + * count: 原来总价 + * good: 商品 + * num: 数量, + * type: add 加减 + */ + calcVipPrice: function(count, good, num=0, type="add"){ + let { is_open_vipcard_buy, is_vip_card_member, canLevelBuy } = this.data; + let goodsNum = num > 0 ? num : parseFloat(good.goodsnum); + if (type === 'red') goodsNum = -1*goodsNum; + count = parseFloat(count); + // if (is_open_vipcard_buy == 1 && is_vip_card_member == 1 && good.is_take_vipcard==1 ) { + // return count += parseFloat(good.card_price) * goodsNum; + // } else if (canLevelBuy && good.is_mb_level_buy == 1){ + // return count += parseFloat(good.levelprice) * goodsNum; + // }else { + return count += parseFloat(good.currntprice) * goodsNum; + // } + }, + + /** + * 大家常卖 + */ + openSku: function(t) { + var that = this, + e = t.detail; + var goods_id = e.actId; + var options = e.skuList; + that.setData({ + addCar_goodsid: goods_id + }) + let list = options.list || []; + let arr = []; + let goods_start_count = e.allData.goods_start_count || 1; + if (list.length > 0) { + for (let i = 0; i < list.length; i++) { + let sku = list[i]['option_value'][0]; + let temp = { + name: sku['name'], + id: sku['option_value_id'], + index: i, + idx: 0 + }; + arr.push(temp); + } + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + + var cur_sku_arr = options.sku_mu_list[id]; + cur_sku_arr.oneday_limit_count = e.allData.oneday_limit_count || 0; + cur_sku_arr.total_limit_count = e.allData.total_limit_count || 0; + cur_sku_arr.one_limit_count = e.allData.one_limit_count || 0; + cur_sku_arr.goods_start_count = e.allData.goods_start_count || 1; + + that.setData({ + sku: arr, + sku_val: goods_start_count, + cur_sku_arr: cur_sku_arr, + skuList: e.skuList, + visible: true, + showSku: true + }); + } else { + let goodsInfo = e.allData; + that.setData({ + sku: [], + sku_val: 1, + skuList: [], + cur_sku_arr: goodsInfo + }) + let formIds = { + detail: { + formId: "" + } + }; + formIds.detail.formId = "the formId is a mock one"; + that.gocarfrom(formIds); + } + }, + + /** + * 确认加入购物车 + */ + gocarfrom: function(e) { + var that = this; + var is_just_addcar = 1; + wx.showLoading(); + a.collectFormIds(e.detail.formId); + that.goOrder(); + }, + + changeCartNum(e) { + let cartNum = e.detail || 0; + let updateCart = this.data.updateCart; + this.showCartGoods(); + this.setData({ + cartNum: cartNum, + updateCart: updateCart + 1 + }) + }, + + goOrder: function() { + var that = this; + if (that.data.can_car) { + that.data.can_car = false; + } + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + + var goods_id = that.data.addCar_goodsid; + var community_id = community.communityId; + var quantity = that.data.sku_val; + var cur_sku_arr = that.data.cur_sku_arr; + var sku_str = ''; + var is_just_addcar = 1; + let updateCart = that.data.updateCart; + + if (cur_sku_arr && cur_sku_arr.option_item_ids) { + sku_str = cur_sku_arr.option_item_ids; + } + + let data = { + goods_id, + community_id, + quantity, + sku_str, + buy_type: 'dan', + pin_id: 0, + is_just_addcar + } + util.addCart(data).then(res=>{ + if(res.showVipModal==1) { + let { pop_vipmember_buyimage } = res.data; + wx.hideLoading(); + that.setData({ pop_vipmember_buyimage, showVipModal: true, visible: false }) + } else { + if (res.data.code == 3 || res.data.code == 7) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } else if (res.data.code == 4) { + wx.showToast({ + title: '您未登录', + duration: 2000, + success: () => { + that.setData({ + needAuth: true, isEmpty: true + }) + } + }) + } else if (res.data.code == 6) { + let max_quantity = res.data.max_quantity || ''; + (max_quantity > 0) && that.setData({ + sku_val: max_quantity, + updateCart: updateCart + 1 + }) + var msg = res.data.msg; + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }) + } else { + if (is_just_addcar == 1) { + that.closeSku(); + that.showCartGoods(); + status.indexListCarCount(goods_id, res.data.cur_count); + (0, status.cartNum)(res.data.total); + that.setData({ + cartNum: res.data.total, + updateCart: updateCart + 1 + }) + wx.showToast({ + title: "已加入购物车", + image: "../../images/addShopCart.png" + }) + } + } + } + }).catch(res=>{ + app.util.message(res||'请求失败', '', 'error'); + }) + }, + + selectSku: function(event) { + var that = this; + let str = event.currentTarget.dataset.type; + let obj = str.split("_"); + let arr = that.data.sku; + let temp = { + name: obj[3], + id: obj[2], + index: obj[0], + idx: obj[1] + }; + arr.splice(obj[0], 1, temp); + that.setData({ + sku: arr + }) + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + + var { skuList, cur_sku_arr } = this.data; + cur_sku_arr = Object.assign(cur_sku_arr, skuList.sku_mu_list[id]); + + that.setData({ + cur_sku_arr: cur_sku_arr + }); + }, + + /** + * 数量加减 + */ + setNum: function(event) { + let types = event.currentTarget.dataset.type; + var that = this; + var num = 1; + let sku_val = this.data.sku_val * 1; + if (types == 'add') { + num = sku_val + 1; + } else if (types == 'decrease') { + let goods_start_count = this.data.cur_sku_arr.goods_start_count || 1; + if (sku_val > 1) { + num = sku_val - 1; + if(num 0) { + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + } + + if (options.length > 0) { + let cur_sku_arr = options.sku_mu_list[id]; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + } else { + let cur_sku_arr = this.data.cur_sku_arr; + if (num > cur_sku_arr['canBuyNum']) { + num = num - 1; + } + } + + this.setData({ + sku_val: num + }) + }, + + skuConfirm: function() { + this.closeSku(), (0, status.cartNum)().then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + }, + + /** + * 关闭购物车选项卡 + */ + closeSku: function() { + this.setData({ + visible: 0, + stopClick: false, + }); + }, + + /** + * 切换 + */ + changeTabs: function(e){ + let that = this; + let idx = e.currentTarget.dataset.idx || 0; + let { tabIdx, carts, mult_carts } = this.data; + if (tabIdx != idx) { + mult_carts[tabIdx] = carts; + carts = mult_carts[idx]; + let isEmpty = true; + if (carts&&Object.keys(carts).length != 0) isEmpty = false; + this.setData({ + tabIdx: idx, + mult_carts, + isEmpty, + carts + }, ()=>{ + that.xuan_func(); + }) + } + }, + + vipModal: function(t) { + this.setData(t.detail) + } + +}) diff --git a/eaterplanet_ecommerce/pages/order/shopCart.json b/eaterplanet_ecommerce/pages/order/shopCart.json new file mode 100644 index 0000000..ee5647e --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shopCart.json @@ -0,0 +1,18 @@ +{ + "navigationBarTitleText": "购物车", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-card": "../../components/card/index", + "i-tabbar": "../../components/tabbar/index", + "i-dialog": "../../components/dialog/index", + "i-router-link": "../../components/router-link/router-link", + "i-img": "../../components/img/index", + "guess-like": "../../components/guess-like/index", + "i-new-auth": "../../components/new-auth/index", + "i-vip-price": "../../components/vipPrice/vipPrice", + "i-sku": "../../components/sku/index", + "ad-alert": "../../components/ad-alert/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/order/shopCart.wxml b/eaterplanet_ecommerce/pages/order/shopCart.wxml new file mode 100644 index 0000000..7a7ab29 --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shopCart.wxml @@ -0,0 +1,334 @@ + + + + + + {{item.name}} + + + + + {{tabList[3].name}} + + + + + + + + + + 开通“{{modify_vipcard_name}}”所选商品预计可省{{vipFee}}元 + “{{modify_vipcard_name}}” 尊享特权·会员专享价 + + 立即开通 + + + + + + + + + + + 点击“去登录”查看购物车商品 + 去登录 + + + 购物车空空如也,赶紧去逛逛吧~ + 去购物 + + + + + + + {{item.localtown_fixed_list.store_name}} + + + 还差{{localtown_fee_list[index].localtownCanBuy}}元就能起送 + + 再买{{localtown_fee_list[index].localtownManJian}}元可免费配送 + + + + 去凑单 + + + + + + {{item.localtown_fixed_list.store_name}} + + + + + + + + + + + 已失效 + 满{{full_money}}减{{full_list[0].full_reducemoney}} + 新人专享 + + + + 自营 {{shopcarts.title}} + {{shopcarts.goodstype}} + + + + + + ¥{{shopcarts.currntprice}} + + + + + + + + + + + + 删除 + + + + + + + + + + + + + 已失效 + 新人专享 + + + + 自营 {{shopcarts.title}} + {{shopcarts.goodstype}} + + + + + + ¥{{shopcarts.currntprice}} + + + + + + + + + + + + 删除 + + + + + + + + + + + + + + + + + + + + 清空 + + + + + + + + + + + + + + + + {{shopcarts.title}} + {{shopcarts.goodstype}} + + + 已售罄 + 规格失效 + + + + + + + + + + + + + + + + + 自营满{{man_free_tuanzshipping}}免配送费{{delivery_tuanz_money}},还差{{diffDeliveryMoney}}元 + + 自营满¥{{man_free_tuanzshipping}}免配送费¥{{delivery_tuanz_money}} + + + 去凑单 + + + + + + + + + + + 满{{item.full_money}}{{item.full_reducemoney}}, + + + + + + + + 已享{{sucess_full_item.full_money}}{{sucess_full_item.full_reducemoney}}, + + + + 再买{{nextDiffMoney}}元,可享{{cur_full_item.full_money}}{{cur_full_item.full_reducemoney}} + + + + 去凑单 + + + + + + + + + + 合计: + ¥{{totalAmount}} + + + 总额:¥{{allcount}} + 优惠:¥{{disAmount}} + + + + + + + + + + + + + + + + + + + + + 满{{item.full_money}}{{item.full_reducemoney}}, + + + + + + + + + + + + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/order/shopCart.wxss b/eaterplanet_ecommerce/pages/order/shopCart.wxss new file mode 100644 index 0000000..61a070b --- /dev/null +++ b/eaterplanet_ecommerce/pages/order/shopCart.wxss @@ -0,0 +1,667 @@ +@import "/eaterplanet_ecommerce/resource/css/vip.wxss"; +page { +background: linear-gradient(180deg, #ffbad2 0%, #ffbad2c1 100%); +} +.empty { + + padding: 50rpx 0 80rpx; + margin-bottom: 50rpx; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +.empty.pos-a { + width: 100%; + height: 100%; + position: fixed; + left: 0; + top: 0; + padding: 0; +} + +.empty image { + width: 218rpx; + height: 218rpx; + margin-bottom: 30rpx; +} + +.empty .h1 { + color: #fff; + font-size: 30rpx; + line-height: 30rpx; + margin-bottom: 60rpx; +} + +.empty .btn { + width: 310rpx; + height: 96rpx; + border-radius: 20rpx; + background: #fff; + line-height: 96rpx; + text-align: center; + color: #ffbad2; + font-size: 30rpx; + font-weight: bold; +} + +.checkbox { + width: 50rpx; + height: 50rpx; + display: flex; + justify-content: center; +} + +.checkbox .checkbox-checked { + width: 48rpx; + height: 48rpx; + font-size: 38rpx; + margin-top: 4rpx; + margin-left: 2rpx; +} + +.checkbox .checkbox-disabled { + width: 48rpx; + height: 48rpx; + margin-top: 2rpx; +} + +.shop-cart-content { + padding: 30rpx 20rpx 130rpx; +} + +.pt80 { + padding-top: 114rpx; +} + +.pb100 { + padding-bottom: 140rpx; +} + +.shop-cart-content .card-group { + margin-bottom: 20rpx; +} + +.shop-cart-content .card-group .card-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: 28rpx 20rpx; + border-bottom: 2rpx solid #efefef; +} + +.shop-cart-content .card-group .card-header .cart-header-left { + display: flex; + align-items: flex-start; +} + +.shop-cart-content .card-group .card-header .tag { + font-size: 20rpx; + line-height: 28rpx; + padding: 0 8rpx; + background: #4facfe; + color: #fff; + border-radius: 28rpx; + white-space: nowrap; + margin-right: 10rpx; + font-weight: 500; +} + +.shop-cart-content .card-group .card-header .active-msg { + font-size: 26rpx; + line-height: 32rpx; + color: #666; + margin-top: -1rpx; +} + +.shop-cart-content .card-group .card-header .i-link { + display: flex; + align-items: center; + flex: 1; + font-size: 26rpx; + line-height: 26rpx; + margin-top: 4rpx; + color: #4facfe; + font-weight: 500; + white-space: nowrap; +} + +.shop-cart-content .card-group .card-header .i-link .iconfont { + font-size: 18rpx; + margin-left: 6rpx; +} + +.fixed-bar { + + margin-left: 30rpx; + margin-right: 30rpx; + position: fixed; + left: 0; + right: 0; + bottom: 123rpx; + + z-index: 96; +} + +.cart-bar { + right: 30rpx; + border-radius: 30rpx 48rpx 48rpx 30rpx; + background-color: #36362D; + box-shadow: 0rpx 10rpx 20rpx 10rpx rgba(0,0,0,0.4); + height: 80rpx; + display: flex; + align-items: center; + justify-content: space-between; + padding-left: 20rpx; +} + +.fixed-bar .cart-item-checkbox { + display: flex; + font-size: 26rpx; + align-items: center; + color: #fff; + white-space: nowrap; +} + +.fixed-bar .cart-item-checkbox checkbox-group { + margin-right: 10rpx; +} + +.fixed-bar .fixed-bar-center { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: center; + width: 560rpx; + flex: 1; + margin: 20rpx; +} + +.fixed-bar .fixed-bar-center .total { + display: flex; + text-align: right; + color: #fff; + font-size: 28rpx; + line-height: 30rpx; + white-space: nowrap; +} + +.fixed-bar .fixed-bar-center .total span { + font-family: DIN; + font-size: 36rpx; + font-weight: bold; + color: #ff758c; +} + +.fixed-bar .fixed-bar-center .total span.line-through { + text-decoration-color: #ff758c; +} + +.fixed-bar .fixed-bar-center .total-detail { + margin-top: 12rpx; + color: #f6f6f6; + font-size: 22rpx; + line-height: 22rpx; +} + +.fixed-bar .fixed-bar-center .total-detail span:last-child { + margin-left: 20rpx; +} + +.fixed-bar .fixed-bar-btn { + width: 200rpx; + height: 80rpx; + text-align: center; + line-height: 80rpx; + color: #fff; + font-size: 30rpx; + background: #ffbad2; + font-weight: bold; + overflow: hidden; + border-radius: 0rpx 48rpx 48rpx 0rpx; +} + +.fixed-bar button.fixed-bar-btn::after { + border: none; +} + +.fixed-bar button[disabled].fixed-bar-btn { + background:#ececec; + color:#666; + font-size: 28rpx; +} + +.i-card { + width: 710rpx; + border-radius: 20rpx; + background: #fff; + box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.05); + display: flex; + flex-direction: column; + overflow: hidden; +} + +/**car item begin***/ +.checkbox .checkbox-disabled { + width: 48rpx; + height: 48rpx; + margin-top: 2rpx; +} + +.swiper-out-button-content { + height: 100%; + width: 140rpx; + border-bottom: 1rpx solid #efefef; +} + +.swiper-out-button-content:last-child { + border: none; +} + +.swiper-out-button-content .delete-btn { + padding: 0; + margin: 0; + height: 100%; + background: #4facfe; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + font-size: 28rpx; +} + +.cart-item { + display: flex; + align-items: center; + flex-wrap: wrap; + padding: 40rpx 0; + border-bottom: 1rpx solid #efefef; +} + +.cart-item .cart-item-checkbox { + width: 90rpx; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.cart-item-img { + width: 180rpx; + height: 180rpx; + margin-right: 30rpx; + position: relative; +} + +.cart-item-img .i-class { + width: 180rpx; + height: 180rpx; +} + +.cart-item-img .tip { + width: 180rpx; + height: 34rpx; + color: #fff; + font-size: 22rpx; + line-height: 34rpx; + text-align: center; + position: absolute; + bottom: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 100; +} + +.cart-item-content { + width: 380rpx; + height: 180rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.cart-item-content .title { + font-size: 26rpx; + color: #444; + line-height: 32rpx; + margin-bottom: 10rpx; + font-weight: bold; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.cart-item-content .title .tag { + font-size: 18rpx; + padding: 2rpx 4rpx; + line-height: 1; + background: #ff758c; + color: #fff; + border-radius: 5rpx; + white-space: nowrap; + margin-right: 5rpx; +} + +.cart-item-content .cart-item-content-bottom { + display: flex; + align-items: center; + justify-content: space-between; + position: relative; +} + +.cart-item-content .cart-item-content-bottom .input-class { + position: absolute; + right: 0; + bottom: 0; +} + +.cart-item-content .spec { + font-size: 22rpx; + color: #aaa; + line-height: 22rpx; + margin-bottom: 10rpx; +} + +.cart-item-content .sale-price { + font-family: DIN; + color: #ff758c; + font-size: 26rpx; + line-height: 26rpx; +} + +.cart-item-content .sale-price span { + font-size: 44rpx; + line-height: 44rpx; + margin-left: 4rpx; + font-weight: bold; +} + +.cart-item-content .delete-icon { + position: absolute; + right: 0; + top: -10rpx; + display: flex; + align-items: center; + font-size: 24rpx; + line-height: 24rpx; + color: #00f2fe; + padding: 20rpx; +} + +.cart-item-content .delete-icon image { + width: 18rpx; + height: 18rpx; + margin-right: 12rpx; +} + +/**car item end**/ + +.fixed-bar.isIpx { + padding-bottom: calc(constant(safe-area-inset-bottom) + 45rpx); + padding-bottom: calc(env(safe-area-inset-bottom) + 45rpx); +} + +/* 满减 */ + +.cart-item .piece-reduce { + width: 650rpx; + display: flex; + align-items: flex-start; + padding: 20rpx; + box-sizing: border-box; + background: #f9f9f9; + border-radius: 64rpx; + margin: 30rpx auto 0; + font-size: 24rpx; + line-height: 32rpx; + color: #666; + white-space: normal; +} + +.cart-item .piece-reduce .tag-content { + height: 32rpx; + display: flex; + align-items: center; +} + +.cart-item .piece-reduce .tag { + border-radius: 26rpx; + height: 22rpx; + padding: 0 8rpx; + border: 1rpx solid #00f2fe; + font-size: 20rpx; + line-height: 22rpx; + color: #4facfe; + margin-right: 16rpx; + white-space: nowrap; + margin-top: 3rpx; + font-weight: bold; +} + +.diff-money { + margin-right: 10rpx; + color: #fff; +} + +.diff-money text { + font-family: DIN; + color: #ff758c; +} + +.reduce-item+.normal-item { + border-top: 30rpx solid #f6f6f6; +} + +/* 20190306 */ + +.fullreductionInfo { + box-shadow: 10rpx 10rpx 20rpx 0rpx #4571a1a1; + border-radius: 48rpx 48rpx 48rpx 48rpx; + width: 450rpx; + max-width: 500rpx; + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: 12rpx 25rpx; + margin-bottom: 5rpx; + background-color: #36362D; + z-index: 100; +} + + + +.fullreductionInfo .fr-left { + display: flex; + align-items: flex-start; +} + +.fullreductionInfo .fr-left .tag { + font-size: 20rpx; + line-height: 28rpx; + padding: 0 8rpx; + background: linear-gradient(90deg, #40A48E 0%, #6ab8a7 100%); + color: #fff; + border-radius: 6rpx; + white-space: nowrap; + margin-right: 10rpx; + font-weight: 500; +} + +.fullreductionInfo .fr-left .active-msg { + font-size: 24rpx; + line-height: 32rpx; + color: #fff; + margin-top: -1rpx; +} + +.fullreductionInfo .i-link { + display: flex; + align-items: center; + flex: 1; + font-size: 24rpx; + line-height: 24rpx; + + color: #40A48E; + font-weight: 500; + white-space: nowrap; +} + +.fullreductionInfo .i-link .iconfont { + font-size: 18rpx; + margin-left: 6rpx; +} + +.cart-item-img .tag { + position: absolute; + left: 0; + bottom: 0; + background: linear-gradient(to right,#4facfe,#00f2fe); + border-radius: 0 14rpx 14rpx 0; + padding: 0 12rpx; + height: 30rpx; + font-size: 22rpx; + line-height: 30rpx; + color: #fff; + display: inline-block; + align-items: center; + justify-content: center; + width: auto; + max-width: 180rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.cart-item-img .tag.pos-top { + top: 0; + bottom: initial; +} + +.cart-tabs { + display: flex; + align-items: center; + text-align: center; + height: 88rpx; + line-height: 88rpx; + background: #fff; + box-shadow: 0 0 3px 0px #ccc; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 105; +} + +.cart-tabs.hasVip { + top: 130rpx; +} + +.cart-tabs-item { + position: relative; + flex: 1; +} + +.cart-tabs-item.active { + color: #4facfe; + font-weight: bold; +} + +.cart-tabs-item.active::after { + content: ""; + position: absolute; + left: 20%; + right: 20%; + bottom: 0; + border-bottom: 2px solid #4facfe; + border-radius: 2px; +} + +.h88 { + height: 88rpx; +} + +.h72 { + height: 72rpx; +} + +.vipprice { + color: #964c00; + font-size: 20rpx; + padding: 2rpx 8rpx; + border-radius: 6rpx; + font-weight: bold; + margin-left: 10rpx; + background: linear-gradient(to right, #ffeea2, #ffe689); +} + +.fixed-vip { + position: fixed; + /**background:linear-gradient(90deg, #40A48E 0%, #6ab8a7 100%);**/ + left: 0; + right: 0; + padding: 10rpx 20rpx 20rpx; + z-index: 10; +} + +.fixed-vip.hasVip { + box-shadow: none; + padding-bottom: 0; +} + +.fixed-vip .vip { + margin-top: 0; +} + +/* 失效处理 */ +.invalid-head { + padding: 0 30rpx; + line-height: 90rpx; + color: #999; + border-bottom: 1rpx solid #efefef; + font-size: 26rpx; +} + +.invalid-card-group { + box-shadow: none!important; +} + +.invalid-head .iconfont { + font-size: 28rpx; +} + +.invalid-card-group .cart-item-content .title { + color: #b0b0b0; +} + +.invalid-tip { + background: #c6c6c6; + font-size: 20rpx; + padding: 4rpx 8rpx; + color: #fff; + line-height: 1; + border-radius: 6rpx; +} + +.scroll-full { + position: relative; + overflow-x: auto; + overflow-y: hidden; + white-space:nowrap; + margin-right: 5rpx; + line-height: 34rpx; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.theader { + padding: 28rpx 20rpx; + border-bottom: 2rpx solid #efefef; +} diff --git a/eaterplanet_ecommerce/pages/position/cities.js b/eaterplanet_ecommerce/pages/position/cities.js new file mode 100644 index 0000000..b2eda08 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/cities.js @@ -0,0 +1,233 @@ +// eaterplanet_ecommerce/pages/position/cities.js +var app = getApp(), + cities = []; +var QQMapWX = require("../../utils/qqmap-wx-jssdk.min.js") + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + cities: [], + localCity: {} + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var shopname = wx.getStorageSync('shopname'); + if (shopname) wx.setNavigationBarTitle({ + title: shopname || '' + }); + this.getMapKey(); + this.getData(); + }, + + getMapKey: function() { + var tx_map_key = wx.getStorageSync('tx_map_key'); + console.log('tx_map_key', tx_map_key) + let that = this; + if (tx_map_key) { + this.getCity(); + } else { + console.log('step4') + this.getCommunityConfig(); + console.log('step2') + } + }, + + getCommunityConfig: function() { + let that = this; + return new Promise(function (resolve, reject) { + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.get_community_config' + }, + dataType: 'json', + success: function (res) { + console.log('step1') + if (res.data.code == 0) { + wx.setStorage({ + key: "shopname", + data: res.data.shoname + }) + if (res.data.shoname) { + wx.setNavigationBarTitle({ + title: res.data.shoname + }); + } + wx.setStorage({ + key: "tx_map_key", + data: res.data.tx_map_key + }) + wx.setStorage({ + key: "shop_index_share_title", + data: res.data.shop_index_share_title + }) + resolve(res); + that.getCity(); + } + } + }) + }) + }, + + /** + * 获取定位城市 + */ + getCity: function() { + console.log('step3') + var token = wx.getStorageSync('token'); + var tx_map_key = wx.getStorageSync('tx_map_key'); + console.log(tx_map_key); + var that = this; + + var demo = new QQMapWX({ + key: tx_map_key + }); + + wx.getLocation({ + type: 'gcj02', //编码方式, + success: function(res) { + var latitude = res.latitude; + var longitude = res.longitude; + + that.setData({ + latitude: res.latitude, + longitude: res.longitude + }) + wx.setStorage({ + key: "latitude", + data: res.latitude + }) + wx.setStorage({ + key: "longitude", + data: res.longitude + }) + + demo.reverseGeocoder({ + //腾讯地图api 逆解析方法 首先设计经纬度 + location: { + latitude: res.latitude, + longitude: res.longitude + }, //逆解析成功回调函数 + success: function(res) { + that.setData({ + localCity: { + districtName: res.result.address_component.city + } + }) + wx.setStorage({ + key: 'city', + data: that.data.localCity, + }) + } + }) + } + }) + }, + + /** + * 获取数据 + */ + getData: function() { + var that = this; + wx.showLoading({ + title: "加载中...", + mask: true + }); + var city = app.globalData.city; + if (cities.length) { + this.setData({ + cities: cities, + localCity: city + }), wx.hideLoading() + } else { + // 请求数据 + var token = wx.getStorageSync('token'); + var community = wx.getStorageSync('community'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'community.get_city_list', + token: token + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + var cityArr = [], + keyArr = []; + res.data.data && res.data.data.forEach(function(item) { + var firstLetter = item.firstLetter, + pos = keyArr.indexOf(firstLetter); + if (pos < 0) { + keyArr.push(firstLetter); + cityArr.push({ + key: firstLetter, + list: [] + }); + pos = keyArr.length - 1 + } + cityArr[pos].list.push({ + name: item.districtName, + key: firstLetter, + city: item + }); + }); + + cityArr.sort(function(x, y) { + if (x.key > y.key) return 1 + else if (x.key < y.key) return -1 + else return 0 + }) + cities = cityArr; + that.setData({ + cities: cities + }); + } + wx.hideLoading(); + } + }) + } + }, + + /** + * 选择城市 + */ + chooseCity: function(e) { + var currentPages = getCurrentPages(), + a = 1; + currentPages[currentPages.length - 2].route.indexOf("/position/search") > -1 && (a = 2); + var city = e.currentTarget.dataset.city; + app.globalData.changeCity = city.city_id || 0; + wx.setStorage({ + key: "city", + data: { + districtName: city.districtName + } + }) + wx.setStorage({ + key: "city_id", + data: city.city_id + }) + wx.navigateBack({ + delta: a + }); + } +}) diff --git a/eaterplanet_ecommerce/pages/position/cities.json b/eaterplanet_ecommerce/pages/position/cities.json new file mode 100644 index 0000000..881db8d --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/cities.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "社区查询", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-index": "../../components/index/index", + "i-index-item": "../../components/index-item/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/cities.wxml b/eaterplanet_ecommerce/pages/position/cities.wxml new file mode 100644 index 0000000..19411e4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/cities.wxml @@ -0,0 +1,10 @@ + + + + + + {{it.name}} + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/cities.wxss b/eaterplanet_ecommerce/pages/position/cities.wxss new file mode 100644 index 0000000..a5659cb --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/cities.wxss @@ -0,0 +1,39 @@ +page { + background: #fff; +} + +.btn { + border: 2rpx solid #666; + font-size: 24rpx; + border-radius: 8rpx; + width: 200rpx; + height: 80rpx; + background: #00f2fe; + display: block; +} + +.i-index-demo, page { + width: 100%; + height: 100%; +} + +.i-index-demo-item { + height: 96rpx; + line-height: 96rpx; + border-bottom: 2rpx solid #efefef; + font-size: 32rpx; + margin: 0 40rpx; +} + +.i-index-demo-item:last-child { + border: none; +} + +.index-title { + height: 70rpx; + line-height: 70rpx; + font-size: 26rpx; + padding-left: 40rpx; + color: #999; + background: #f6f6f6; +} diff --git a/eaterplanet_ecommerce/pages/position/community.js b/eaterplanet_ecommerce/pages/position/community.js new file mode 100644 index 0000000..115a94e --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/community.js @@ -0,0 +1,448 @@ +// eaterplanet_ecommerce/pages/position/community.js +var location = require("../../utils/Location") +var QQMapWX = require("../../utils/qqmap-wx-jssdk.min.js") +var status = require('../../utils/index.js'); +var app = getApp(); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + loadMore: true, + canGetGPS: true, + tip: "加载中...", + community: {}, + communities: [], + historyCommunity: [], + city: { + districtName: "" + }, + latitude: '', + longitude: '', + hasRefeshin: false, + pageNum: 1, + isNotHistory: true, + city_id: 0, + needAuth: false, + common_header_backgroundimage: '', + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + isEmpty: false + }, + + linkSearch: function() { + wx.navigateTo({ + url: "/eaterplanet_ecommerce/pages/position/search?city=" + JSON.stringify(this.data.city) + }); + }, + isFirst: true, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + status.setNavBgColor(); + status.setGroupInfo().then((groupInfo) => { + that.setData({ + groupInfo + }) + }); + this.loadpage(); + }, + + onReady: function(){ + this.setData({ + common_header_backgroundimage: app.globalData.common_header_backgroundimage + }); + }, + + loadpage: function() { + let that = this; + var current_community = wx.getStorageSync('community'); + if (current_community) that.setData({ + community: current_community + }) + + var tx_map_key = wx.getStorageSync('tx_map_key'); + if (tx_map_key) { + var shopname = wx.getStorageSync('shopname'); + wx.setNavigationBarTitle({ + title: shopname + }); + that.load_gps_community(); + } else { + that.getCommunityConfig(); + } + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + this.setData({ + needAuth: false + }) + this.loadpage() + }, + + getCommunityConfig: function(){ + let that = this; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.get_community_config' + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + wx.setStorage({ + key: "shopname", + data: res.data.shoname + }) + + if (res.data.shoname) { + wx.setNavigationBarTitle({ + title: res.data.shoname + }); + } + wx.setStorage({ + key: "tx_map_key", + data: res.data.tx_map_key + }) + that.setData({ + tx_map_key: res.data.tx_map_key + }) + wx.setStorage({ + key: "shop_index_share_title", + data: res.data.shop_index_share_title + }) + that.load_gps_community(); + } + } + }) + }, + + /** + * 获取定位城市 + */ + load_gps_community: function() { + var token = wx.getStorageSync('token'); + var tx_map_key = wx.getStorageSync('tx_map_key'); + if (tx_map_key == undefined || tx_map_key == '') { + if (this.data.tx_map_key) { + tx_map_key = this.data.tx_map_key + } else { + // nm , + this.getCommunityConfig(); + return; + } + } + var that = this; + token && app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_history_community', + token: token + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let history_communities = res.data.list; + let isNotHistory = false; + if (Object.keys(history_communities).length == 0 || history_communities.communityId == 0) isNotHistory = true; + + if (that.data.community) { + app.globalData.community = history_communities; + } + that.setData({ + historyCommunity: history_communities, + isNotHistory + }) + } + } + }) + + var demo = new QQMapWX({ + key: tx_map_key || '' + }); + + console.log('腾讯地图api key', tx_map_key); + + wx.getLocation({ + type: 'gcj02', //编码方式, + success: function(res) { + console.log('getLocation success') + var latitude = res.latitude; + var longitude = res.longitude; + that.setData({ + latitude: res.latitude, + longitude: res.longitude + }) + wx.setStorage({ + key: "latitude", + data: latitude + }) + wx.setStorage({ + key: "longitude", + data: longitude + }) + + demo.reverseGeocoder({ + //腾讯地图api 逆解析方法 首先设计经纬度 + location: { + latitude: res.latitude, + longitude: res.longitude + }, //逆解析成功回调函数 + success: function(res) { + let cityName = res.result.address_component.city; + that.setData({ + city: { + districtName: cityName + } + }) + wx.showLoading({ + title: "加载中...", + mask: true, + icon: "none" + }) + that.load_gps_community_list(); + }, + fail: function(error){ + console.log('腾讯地图api error', error); + let msg = error.message || ''; + app.util.message(msg, '', 'error'); + wx.setStorageSync('tx_map_key', ''); + } + }) + }, + fail: function(error) { + that.isFirst = true; + location.checkGPS(app, () => { + console.log('canGetGPS', app.globalData.canGetGPS) + if (app.globalData.canGetGPS) { + console.log('checkGPS sucess') + let gpos = app.globalData.location; + if (gpos && gpos.lat) { + that.setData({ + latitude: gpos.latitude, + longitude: gpos.longitude + }) + wx.setStorage({ + key: "latitude", + data: gpos.latitude + }) + wx.setStorage({ + key: "longitude", + data: gpos.longitude + }) + + demo.reverseGeocoder({ + //腾讯地图api 逆解析方法 首先设计经纬度 + location: { + latitude: gpos.latitude, + longitude: gpos.longitude + }, //逆解析成功回调函数 + success: function(res) { + let cityName = res.result.address_component.city; + that.setData({ + city: { + districtName: cityName + } + }) + that.load_gps_community_list(); + } + }) + } + } else { + location.openSetting(app).then(function(pos) { + that.setData({ + latitude: pos.latitude, + longitude: pos.longitude + }) + wx.setStorage({ + key: "latitude", + data: pos.latitude + }) + wx.setStorage({ + key: "longitude", + data: pos.longitude + }) + + demo.reverseGeocoder({ + //腾讯地图api 逆解析方法 首先设计经纬度 + location: { + latitude: pos.latitude, + longitude: pos.longitude + }, //逆解析成功回调函数 + success: function(res) { + let cityName = res.result.address_component.city; + that.setData({ + city: { + districtName: cityName + } + }) + that.load_gps_community_list(); + } + }) + }).catch(function() { + that.setData({ + isEmpty: true, + loadMore: false, + hasRefeshin: true, + tip: '', + canGetGPS: false + }) + }); + } + }); + } + }) + }, + + /** + * 获取社区列表 + */ + load_gps_community_list: function(city_id) { + console.log('load_gps_community_list') + var token = wx.getStorageSync('token'); + var that = this; + //tip: "加载中...", + console.log('come gpslist'); + if (!that.data.hasRefeshin) { + that.setData({ + hasRefeshin: true, + loadMore: true + }); + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_gps_community', + token: token, + pageNum: that.data.pageNum, + longitude: that.data.longitude, + latitude: that.data.latitude, + city_id: that.data.city_id || 0 + }, + dataType: 'json', + success: function(res) { + wx.hideLoading(); + if (res.data.code == 0) { + let communities = that.data.communities.concat(res.data.list); + if (that.data.pageNum == 1 && communities.length == 0) { + that.setData({ + isEmpty: true, + loadMore: false, + tip: '', + hasRefeshin: true + }); + return false; + } + that.setData({ + communities: communities, + pageNum: that.data.pageNum + 1, + loadMore: false, + hasRefeshin: false, + tip: '', + index_hide_headdetail_address: res.data.index_hide_headdetail_address || 0 + }); + } else if (res.data.code == 1) { + //go data + that.setData({ + loadMore: false, + tip: '^_^已经到底了' + }) + } else if (res.data.code == 2) { + //no login + wx.hideLoading(); + console.log(that.data.needAuth) + that.setData({ + needAuth: true, + hasRefeshin: false + }) + } + } + }) + } + }, + + /** + * 打开设置 + */ + openSetting: function() { + let that = this; + that.setData({ + isEmpty: false, + loadMore: true, + hasRefeshin: false, + tip: '加载中' + }, () => { + that.load_gps_community(); + }) + // location.openSetting(app); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + let that = this; + console.log("show") + if (!this.isFirst) { + console.log('nofirst'); + // util.check_login() ? this.setData({ + // needAuth: false + // }) : this.setData({ + // needAuth: true + // }); + var city = wx.getStorageSync('city'), + city_id = wx.getStorageSync('city_id'); + console.log(city_id) + city && that.setData({ + city, + city_id, + pageNum: 1, + hasRefeshin: false, + communities: [] + }), wx.showLoading({ + title: "加载中...", + mask: true, + icon: "none" + }), this.load_gps_community_list(); + } else { + this.isFirst = false + } + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + this.load_gps_community_list(); + } +}) diff --git a/eaterplanet_ecommerce/pages/position/community.json b/eaterplanet_ecommerce/pages/position/community.json new file mode 100644 index 0000000..73e9f74 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/community.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-router-link": "../../components/router-link/router-link", + "i-load-more": "../../components/load-more/index", + "i-community-item": "../../components/community-item/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/community.wxml b/eaterplanet_ecommerce/pages/position/community.wxml new file mode 100644 index 0000000..456603c --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/community.wxml @@ -0,0 +1,65 @@ + + + + + + + + + + {{city.districtName}} + + + + + 请输入{{groupInfo.group_name}}名称 + + + + 当前地址 + {{city.districtName}} + 请选择您的{{groupInfo.group_name}} + + + 当前{{groupInfo.group_name}} + + + + + + + + {{groupInfo.owner_name}}:{{community.disUserName||community.realName}} + {{community.communityName}} + {{community.communityAddress||community.fullAddress}} + + + + + + + + + + + 附近{{groupInfo.group_name}} + + + + + 未获得您的位置信息,点击开启 + + + + 当前城市暂未开通服务,请更换城市或申请开通> + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/position/community.wxss b/eaterplanet_ecommerce/pages/position/community.wxss new file mode 100644 index 0000000..2089d8a --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/community.wxss @@ -0,0 +1,256 @@ +page { + background: #9F99AA; +} + +.mars-mask { + position: fixed; + z-index: 9; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +.header-content { + width: 750rpx; + padding-top: 20rpx; + box-sizing: border-box; + position: relative; +} + +.header-content .header-bg { + width: 100%; + height: 340rpx; + position: absolute; + left: 0; + top: 0; +} + +.header-content .search-content { + margin-left: 20rpx; + margin-right: 20rpx; + height: 64rpx; + border-radius: 20rpx; + background: #fff; + position: relative; + display: flex; +} + +.header-content .search-content .city-content { + height: 64rpx; + padding: 0 16rpx; + box-sizing: border-box; + display: flex; + align-items: center; + font-size: 26rpx; + color: #444; + white-space: nowrap; + font-weight: bold; +} + +.header-content .search-content .city-content .search-icon { + width: 28rpx; + height: 28rpx; + margin-right: 20rpx; + margin-top: -2rpx; +} + +.header-content .search-content .city-content .bottom-arrow { + width: 12rpx; + height: 6rpx; + margin-left: 8rpx; +} + +.header-content .search-ipt { + flex: 1; +} + +.header-content .ipt-class { + line-height: 64rpx; + height: 64rpx; + font-size: 26rpx; + color: #999; +} + +.header-content .location-title { + color: #fff; + font-size: 36rpx; + text-align: center; + margin-top: 30rpx; + margin-bottom: 40rpx; + position: relative; +} + +.header-content .location-title.location-title-pad { + margin-bottom: 66rpx; +} + +.header-content .location-msg { + font-size: 30rpx; + width: 560rpx; + height: 72rpx; + margin: 0 auto 28rpx; + line-height: 36rpx; + position: relative; + color: #fff; + text-align: center; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: initial; + white-space: normal; +} + +.header-content .switch-btn { + width: 440rpx; + height: 100rpx; + border-radius: 100rpx; + text-align: center; + line-height: 100rpx; + background: #fff; + font-size: 32rpx; + box-shadow: 0 0 40rpx rgba(0, 0, 0, 0.08); + position: relative; + margin: 0 auto; +} + +.header-content .local-community-card { + width: 690rpx; + height: 360rpx; + border-radius: 16rpx; + box-shadow: 0 0 40rpx rgba(0, 0, 0, 0.08); + margin: 0 auto; + position: relative; +} + +.header-content .local-community-card .local-distance { + position: absolute; + top: 86rpx; + right: 12rpx; + width: 170rpx; + height: 40rpx; + border-radius: 20rpx 0 0 20rpx; + background: linear-gradient(to right,#4facfe,#00f2fe); + color: #fff; + font-size: 22rpx; + line-height: 40rpx; + text-align: center; +} + +.header-content .local-community-card .card-bg { + position: absolute; + width: 690rpx; + height: 360rpx; + left: 0; + top: 0; +} + +.header-content .local-community-card .head-pic { + position: absolute; + width: 120rpx; + height: 120rpx; + left: 286rpx; + top: -60rpx; + border-radius: 60rpx; + background: #fff; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 0 2rpx rgba(0, 0, 0, 0.2) inset; +} + +.header-content .local-community-card .head-pic .head-pic-content { + position: relative; + width: 106rpx; + height: 106rpx; + border-radius: 50rpx; +} + +.header-content .local-community-card .card-msg { + position: relative; + display: flex; + flex-direction: column; + align-items: center; + padding-top: 94rpx; +} + +.header-content .local-community-card .card-msg .group-master { + font-size: 26rpx; + line-height: 26rpx; + color: #999; + margin-bottom: 40rpx; +} + +.header-content .local-community-card .card-msg .community-name { + font-size: 40rpx; + color: #444; + line-height: 40rpx; + margin-bottom: 30rpx; + font-weight: bold; +} + +.header-content .local-community-card .card-msg .community-address { + width: 640rpx; + font-size: 26rpx; + line-height: 36rpx; + color: #444; + text-align: center; +} + +.title { + font-size: 40rpx; + line-height: 40rpx; + color: #fff; + border-left: 10rpx solid #fff; + text-indent: 20rpx; + font-weight: bold; +} + +.community-list { + padding-top: 60rpx; +} + +.history-communities { + border-bottom: 20rpx solid #f6f6f6; +} + +.item-border { + display: block; + background: #fff; + margin: 20rpx 20rpx 20rpx 20rpx; + border-radius: 20rpx; +} + +.item-border:last-child { + border: none; +} + +.item-center { + margin-left: 20rpx; +} +.no-community { + display: flex; + flex-direction: column; + align-content: center; + align-items: center; +} + +.flex-align { + display: flex; + flex-direction: column; + align-content: center; + align-items: center; + padding: 100rpx 30rpx; +} + +.no-community image { + width: 200rpx; + height: 200rpx; + margin-bottom: 30rpx; +} + +.link-apply { + display: inline-block; + color: #4facfe; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/search.js b/eaterplanet_ecommerce/pages/position/search.js new file mode 100644 index 0000000..39934d6 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/search.js @@ -0,0 +1,165 @@ +// eaterplanet_ecommerce/pages/position/search.js +var wcache = require('../../utils/wcache.js'); +var status = require('../../utils/index.js'); +var app = getApp(); +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + communities: [], + city: { + districtName: "" + }, + cityName: "", + inputValue: "", + loadMore: false, + noResult: true, + latitude: '', + longitude: '', + hasRefeshin: false, + pageNum: 1, + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + tip: "" // 没有更多社区了 / 没有搜索到社区" + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var that = this; + status.setNavBgColor(); + var city = wx.getStorageSync('city'); + var shopname = wcache.get('shopname'); + if (shopname) wx.setNavigationBarTitle({ + title: shopname + }); + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + that.setData({ + city: city, + cityName: city.districtName + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + onInput: function(event) { + //inputValue + console.log(event.detail.value); + this.setData({ + inputValue: event.detail.value + }) + }, + subInput: function() { + this.setData({ + pageNum: 1, + hasRefeshin: false + }) + this.load_gps_community_list(); + }, + load_gps_community_list: function() { + var token = wx.getStorageSync('token'); + var latitude = wx.getStorageSync('latitude'); + var longitude = wx.getStorageSync('longitude'); + + var that = this; + var inputValue = this.data.inputValue; + + if (!that.data.hasRefeshin) { + that.setData({ + hasRefeshin: true, + loadMore: true + }); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_gps_community', + token: token, + inputValue: inputValue, + pageNum: that.data.pageNum, + longitude: longitude, + latitude: latitude + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let communities = that.data.communities.concat(res.data.list); + + that.setData({ + communities: communities, + pageNum: that.data.pageNum + 1, + loadMore: false, + hasRefeshin: false, + tip: '' + }); + + } else if (res.data.code == 1) { + //go data + that.setData({ + loadMore: false, + tip: '^_^已经到底了' + }) + + } else if (res.data.code == 2) { + //no login + } + } + }) + } + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + this.load_gps_community_list(); + } +}) diff --git a/eaterplanet_ecommerce/pages/position/search.json b/eaterplanet_ecommerce/pages/position/search.json new file mode 100644 index 0000000..20c0fa6 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/search.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "社区搜索", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-load-more": "../../components/load-more/index", + "i-community-item": "../../components/community-item/index", + "i-router-link": "../../components/router-link/router-link" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/search.wxml b/eaterplanet_ecommerce/pages/position/search.wxml new file mode 100644 index 0000000..85c6b70 --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/search.wxml @@ -0,0 +1,22 @@ + + + + + + + + {{cityName}} + + + + + + + + + + + + {{tip}} + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/position/search.wxss b/eaterplanet_ecommerce/pages/position/search.wxss new file mode 100644 index 0000000..3a6224d --- /dev/null +++ b/eaterplanet_ecommerce/pages/position/search.wxss @@ -0,0 +1,79 @@ +page { + background: #fff; +} + +.no-result { + display: flex; + align-items: center; + flex-direction: column; + color: #666; + font-size: 30rpx; + padding-top: 394rpx; +} + +.no-result image { + width: 218rpx; + height: 218rpx; + margin-bottom: 30rpx; +} + +.header-content { + display: flex; + align-items: center; + justify-content: center; + height: 104rpx; + border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.search-content { + width: 670rpx; + height: 64rpx; + border-radius: 64rpx; + background: #f8f8f8; + position: relative; + display: flex; +} + +.search-content .city-content { + height: 64rpx; + padding: 0 16rpx; + box-sizing: border-box; + display: flex; + align-items: center; + font-size: 26rpx; + color: #444; + white-space: nowrap; + font-weight: bold; +} + +.search-content .city-content .search-icon { + width: 28rpx; + height: 28rpx; + margin-right: 20rpx; + margin-top: -2rpx; +} + +.search-content .city-content .bottom-arrow { + width: 12rpx; + height: 6rpx; + margin-left: 8rpx; +} + +.search-content .search-ipt { + flex: 1; +} + +.search-content .ipt-class { + line-height: 64rpx; + height: 64rpx; + font-size: 26rpx; + color: #444; +} + +.search-content .input-placeholder { + color: #999; +} + +.load-more { + padding: 40rpx 0; +} diff --git a/eaterplanet_ecommerce/pages/refund/refundList.js b/eaterplanet_ecommerce/pages/refund/refundList.js new file mode 100644 index 0000000..d55af81 --- /dev/null +++ b/eaterplanet_ecommerce/pages/refund/refundList.js @@ -0,0 +1,245 @@ +var app = getApp() +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + containerHeight: 0, + scrollTop: 0, + currentTab: "0", + navList: [{ + name: "全部", + status: "0" + }, { + name: "处理中", + status: "1" + }, { + name: "已退款", + status: "2" + }, { + name: "已拒绝", + status: "3" + }], + refundList: [], + loading: true, + page: 1, + loadover: false, + order_status: 12, + no_order: 0, + hide_tip: true, + order: [], + tip: '正在加载', + pageNum: [1, 1, 1, 1], + pageSize: 20, + loadText: "没有更多订单了~", + LoadingComplete: ["", "", "", ""] + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + let sysInfo = wx.getSystemInfoSync(); + this.setData({ + currentTab: options.orderStatus || "0", + containerHeight: sysInfo.windowHeight - Math.round(sysInfo.windowWidth / 375 * 55) + }); + this.getData(); + }, + + getData: function() { + this.setData({ + isHideLoadMore: true + }) + + this.data.no_order = 1 + let that = this; + var token = wx.getStorageSync('token'); + + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'order.refundorderlist', + token: token, + currentTab: that.data.currentTab, + page: that.data.page, + order_status: that.data.order_status + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let rushList = that.data.order.concat(res.data.data); + that.setData({ + order: rushList, + hide_tip: true, + 'no_order': 0 + }); + } else { + that.setData({ + isHideLoadMore: true + }) + return false; + } + } + }) + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + this.setData({ + pageNum: [1, 1, 1, 1, 1], + loading: true + }), this.getAllList(); + }, + + /** + * 获取列表 + */ + getAllList: function() { + var that = this; + Promise.all([this.getDataList({ + pageNum: 1, + status: "" + }), this.getDataList({ + pageNum: 1, + status: 1 + }), this.getDataList({ + pageNum: 1, + status: 3 + }), this.getDataList({ + pageNum: 1, + status: 4 + })]) + .then(function(res) { + that.setData({ + loading: false + }); + wx.stopPullDownRefresh(); + }) + .catch(function() {}); + }, + + /** + * 切换导航 + */ + switchNav: function(t) { + this.data.currentTab !== t.currentTarget.dataset.current && this.setData({ + currentTab: t.currentTarget.dataset.current + }); + }, + + /** + * 监控改变 + */ + bindChange: function(t) { + console.log(t.detail.current); + this.setData({ + no_order: 0, + page: 1, + order: [], + currentTab: t.detail.current + "" + }); + + this.getData(); + }, + + /** + * 获取数据列表 + */ + getDataList: function(t) { + let data = { + pageNum: t.pageNum, + pageSize: this.data.pageSize, + status: t.status + }; + // 请求数据 + return data; + }, + + /** + * 售后详情 + */ + goRefund: function (t) { + var order_id = t.currentTarget.dataset.type; + wx.navigateTo({ + url: "/eaterplanet_ecommerce/pages/order/refunddetail?id=" + order_id + }); + }, + + /** + * 前往订单详情 + */ + goOrder: function(t) { + var order_id = t.currentTarget.dataset.type; + wx.navigateTo({ + url: "/eaterplanet_ecommerce/pages/order/order?id=" + order_id + }); + }, + + /** + * 撤销申请 + */ + cancelApplication: function(t) { + var a = this, + n = t.detail; + wx.showModal({ + title: "撤销申请", + content: "您确定要撤销本次退款申请吗?", + success: function(t) { + t.confirm && (0, e.default)("/shop-return-order/refund/undo", { + returnOrderNo: n + }).then(function(t) { + 0 === t.head.error ? (wx.showToast({ + title: "撤销成功", + icon: "none" + }), a.getAllList()) : (wx.showToast({ + title: "该退款申请已处理", + icon: "none" + }), a.getAllList()); + }).catch(function() {}); + } + }); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + getCurrentList: function() { + if (this.data.no_order == 1) return false; + this.data.page += 1; + this.getData(); + + this.setData({ + isHideLoadMore: false + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + + } +}) diff --git a/eaterplanet_ecommerce/pages/refund/refundList.json b/eaterplanet_ecommerce/pages/refund/refundList.json new file mode 100644 index 0000000..5e6c011 --- /dev/null +++ b/eaterplanet_ecommerce/pages/refund/refundList.json @@ -0,0 +1,10 @@ +{ + "navigationBarBackgroundColor": "#FFF", + "navigationBarTitleText": "售后退款", + "navigationBarTextStyle": "black", + "enablePullDownRefresh": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-load-more": "../../components/load-more/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/refund/refundList.wxml b/eaterplanet_ecommerce/pages/refund/refundList.wxml new file mode 100644 index 0000000..806db77 --- /dev/null +++ b/eaterplanet_ecommerce/pages/refund/refundList.wxml @@ -0,0 +1,76 @@ + + + + + + {{item.name}} + + + + + + + + + 暂无任何退款记录 + + + + + + + 下单时间: + {{item.createTime}} + + + {{item.status_name}} + + + + + + + + + + + + + + + + + + 共 + {{item.goods_list.length}} 件商品 + 实付: + + ¥{{item.total}} + + + + + + 取消订单 + 立即支付 + + + + 确认提货 + + + + + 查看详情 + + + + + + + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/refund/refundList.wxss b/eaterplanet_ecommerce/pages/refund/refundList.wxss new file mode 100644 index 0000000..3e507b4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/refund/refundList.wxss @@ -0,0 +1,305 @@ +.nav { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10; + background: #fff; + height: 92rpx; + border-top: 2rpx solid #f2f2f2; + border-bottom: 2rpx solid #f2f2f2; + padding: 0 60rpx; + width: unset; + display: flex; + align-items: center; + justify-content: space-between; +} + +.nav .orderList_item { + margin-bottom: 4rpx; + font-size: 28rpx; + font-family: PingFangSC-Medium; + font-weight: 500; + color: #666; + position: relative; + height: 96rpx; + line-height: 96rpx; +} + +.nav .orderList_item .line { + position: absolute; + bottom: 0; + height: 6rpx; + width: 100%; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(255,89,0,0.25); + border-radius: 24rpx; +} + +.nav .on { + color: #4facfe; +} + +.swiper-box { + width: 100%; + margin-top: 90rpx; +} + +.swiper-box .order-scroll-view { + width: 750rpx; + height: 100%; +} + +.swiper-box .noRecordCon { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.swiper-box .noRecordCon .noRecordImg { + width: 132rpx; + height: 138rpx; + margin-top: 50%; +} + +.swiper-box .noRecordCon .noRefundImg { + width: 218rpx; + height: 218rpx; + margin-top: 50%; +} + +.swiper-box .noRecordCon .noRecord { + padding-top: 32rpx; + font-size: 30rpx; + font-family: PingFangSC-Light; + font-weight: 300; + color: #666; + line-height: 30rpx; +} + +.swiper-box .noRecordCon .goIndex { + width: 164rpx; + height: 60rpx; + background: #4facfe; + border-radius: 30rpx; + font-size: 28rpx; + color: #fff; + margin-top: 30rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.swiper-box .item { + width: 710rpx; + height: 266rpx; + box-shadow: 0rpx 0rpx 40rpx 0rpx rgba(0, 0, 0, 0.05); + border-radius: 20rpx; + margin: 20rpx auto 0; + background: #fff; +} + +.swiper-box .item:last-of-type { + margin: 20rpx auto; +} + +.refresh { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + border: 1rpx solid #999; + position: fixed; + right: 50rpx; + bottom: 200rpx; + font-size: 20rpx; + color: #fff; + background: #000; + opacity: 0.5; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.refresh image { + width: 32rpx; + height: 32rpx; + margin-bottom: 4rpx; +} + +.refundList { + background: #f6f6f6; +} + +.card { + margin-top:20rpx; + margin-left: 20rpx; + color: #444; +} + +.card .card-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx; + font-size: 24rpx; +} + +.card .card-content { + padding: 30rpx; + border-top: 0.1rpx solid #efefef; + border-bottom: 0.1rpx solid #efefef; +} + +.card .card-content .content-wrap { + display: flex; + align-items: center; + justify-content: space-between; +} + +.card .card-content .show-img { + float: left; + width: 120rpx !important; + height: 120rpx !important; +} + +.card .card-content .dot { + display: flex; + align-items: center; + justify-content: space-between; +} + +.card .card-content .dot .dot-item { + width: 12rpx; + height: 12rpx; + border-radius: 50%; + background: #d8d8d8; +} + +.card .card-content .dot .dot-middle { + margin: 0 10rpx; +} + +.card .card-footer { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx; + font-size: 24rpx; +} + +.card .card-footer .money { + font-size: 32rpx; + font-weight: bold; + display: inline-block; +} + +.card .card-footer .accual-pay { + display: inline-block; +} + +.empty-wrap { + padding-top: 300rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.empty-wrap .empty-img { + width: 218rpx; + height: 218rpx; +} + +.empty-wrap .empty-txt { + font-size: 30rpx; + font-weight: 400; + color: #777; + margin-top: 32rpx; +} + +.padding-15 { + margin-left: 16rpx; +} + +.button-group { + display: flex; + justify-content: space-between; +} + +.my-button { + position: relative; + color: #666; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + text-align: center; +} + +.my-button::after { + box-sizing: border-box; + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + transform: scale(0.5); + transform-origin: 0 0; + border: 2rpx solid #b6b6b6; + border-radius: 52rpx; + pointer-events: none; +} + +.get-goods { + display: flex; + justify-content: space-between; + align-items: center; +} + +.get-goods .sure-get { + color: #aaa; +} + +.my-button-pay { + position: relative; + width: 136rpx; + height: 52rpx; + line-height: 52rpx; + font-size: 24rpx; + text-align: center; + color: white; + border: none; + border-radius: 26rpx; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); +} + +.right-arrow { + width: 12rpx; + height: 22rpx; + margin-left: 10rpx; +} + +.bold { + font-weight: 500; +} + +.red { + color: #4facfe; + font-size: 24rpx; +} + +.gray { + color: #aaa; +} +.i-card { + width: 710rpx; + border-radius: 20rpx; + background: #fff; + box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.05); + display: flex; + flex-direction: column; + overflow: hidden; +} diff --git a/eaterplanet_ecommerce/pages/supply/apply.js b/eaterplanet_ecommerce/pages/supply/apply.js new file mode 100644 index 0000000..88979d7 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/apply.js @@ -0,0 +1,239 @@ +// eaterplanet_ecommerce/pages/supply/apply.js +var util = require('../../utils/util.js'); +var app = getApp(); +var status = require('../../utils/index.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + image_thumb: '', + image_o_full: '', + orign_image: '', + shopname: '', + name: '', + mobile: '', + product: '', + state: null + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + status.setNavBgColor(); + this.getData(); + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + let that = this; + this.setData({ + needAuth: false + }, () => { + that.getData(); + }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + util.check_login_new().then((res) => { + if (res) { + this.setData({ needAuth: false }); + } else { + this.setData({ needAuth: true }); + } + }) + }, + + getData: function(){ + wx.showLoading(); + var token = wx.getStorageSync('token'); + let that = this; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'supply.apply_info', + token: token + }, + dataType: 'json', + method: 'POST', + success: function (res) { + wx.hideLoading(); + let code = res.data.code; + let supply_diy_name = res.data.supply_diy_name || '商户'; + wx.setNavigationBarTitle({ + title: `申请成为${supply_diy_name}`, + }) + if (code == 0) { + that.setData({ + state: res.data.data.state || 0, + supply_diy_name + }) + } else if(code == 1) { + that.setData({ supply_diy_name }) + //needAuth + console.log('needAuth'); + } + } + }) + }, + + inputShopName: function (e) { + this.setData({ + shopname: e.detail.value + }) + }, + + inputName: function (e) { + this.setData({ + name: e.detail.value + }) + }, + + inputMobile: function (e) { + this.setData({ + mobile: e.detail.value + }) + }, + + inputAdvantage: function (e) { + this.setData({ + product: e.detail.value + }) + }, + + addImg: function () { + var that = this; + wx.chooseMedia({ + count: 1, + success: function (res) { + const tempFiles = res.tempFiles; + var new_thumb_img = that.data.thumb_img; + wx.showLoading({ title: '上传中' }); + wx.uploadFile({ + url: app.util.url('entry/wxapp/index', { + 'm': 'eaterplanet_ecommerce', + 'controller': 'goods.doPageUpload' + }), + filePath: tempFiles[0].tempFilePath, + name: 'upfile', + formData: { + 'name': tempFiles[0].tempFilePath + }, + header: { + 'content-type': 'multipart/form-data' + }, + success: function (res) { + + wx.hideLoading(); + var data = JSON.parse(res.data); + var image_thumb = data.image_thumb; + var image_o_full = data.image_o_full; + var orign_image = data.image_o; + + that.setData({ + image_thumb: image_thumb, + image_o_full: image_o_full, + orign_image: orign_image + }) + } + }) + } + }); + }, + + submit: function () { + if (!this.authModal()) return; + var token = wx.getStorageSync('token'); + var shopname = this.data.shopname; + var mobile = this.data.mobile; + var name = this.data.name; + var product = this.data.product; + var that = this; + + if (shopname == '') { + wx.showToast({ + title: '请填商户名称', + icon: 'none', + }) + return false; + } + + if (name == '') { + wx.showToast({ + title: '请填写商户联系人', + icon: 'none', + }) + return false; + } + + if (mobile == '' || !(/^1(3|4|5|6|7|8|9)\d{9}$/.test(mobile))) { + wx.showToast({ + title: '手机号码有误', + icon: 'none', + }) + return false; + } + + var s_data = { + shopname, name, mobile, product, controller: 'user.supply_apply', 'token': token + }; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': s_data, + method: 'post', + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + wx.showToast({ + title: '提交成功,等待审核', + icon: 'none', + duration: 2000, + success: function(){ + setTimeout(()=>{ + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + }, 2000) + } + }) + } else { + wx.showModal({ + title: '提示', + content: res.data.msg, + showCancel: false + }) + } + } + }) + + } +}) diff --git a/eaterplanet_ecommerce/pages/supply/apply.json b/eaterplanet_ecommerce/pages/supply/apply.json new file mode 100644 index 0000000..8c7ab35 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/apply.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/supply/apply.wxml b/eaterplanet_ecommerce/pages/supply/apply.wxml new file mode 100644 index 0000000..a536e7b --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/apply.wxml @@ -0,0 +1,54 @@ + + + + 申请{{supply_diy_name}}身份,需要您填写真实姓名、手机 +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + + 申请通过 + 恭喜您,您的申请已通过 + 返回首页 + + + + 申请审核中 + 您的申请在处理中,请等待结果… + 返回首页 + +
+ + diff --git a/eaterplanet_ecommerce/pages/supply/apply.wxss b/eaterplanet_ecommerce/pages/supply/apply.wxss new file mode 100644 index 0000000..688646d --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/apply.wxss @@ -0,0 +1,186 @@ +.header { + background: #4facfe; + height: 160rpx; + color: #fff; + font-size: 30rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.form-group { + padding: 12rpx 30rpx 0; + display: flex; + flex-direction: column; + align-items: center; +} + +.form-group .form-item { + display: flex; + align-items: center; + border-bottom: 2rpx solid #e4e4e4; + font-size: 30rpx; + transition: all 0.3s; + width: 100%; +} + +.form-group .form-item:last-child { + border: none; +} + +.form-group .form-item.error { + border-color: #4facfe; +} + +.form-group .form-item .form-item-control { + width: 130rpx; + height: 100rpx; + line-height: 100rpx; +} + +.form-group .form-item .form-item-input { + flex: 1; + height: 100rpx; + line-height: 100rpx; +} + +weui-cell__hd { + position: relative; + font-size: 28rpx; + text-align: left; +} + +.weui-pos { + width: 40rpx; + height: 50rpx; + background: url(https://wxapp.ch871.com/Common/image/order_checkout_icon.png) no-repeat; + background-position: 0rpx 0; + background-size: 132rpx 142rpx; +} + +.form-group .form-item .form-item-input .picker { + height: 100rpx; + line-height: 100rpx; +} + +.form-group .form-item .captcha { + color: #666; + border-left: 4rpx solid #ddd; + padding-left: 20rpx; + width: 160rpx; + height: 100%; + text-align: center; +} + +.form-group .form-item .placeholder { + color: #ccc; +} + +.form-group .form-item .input-placeholder { + color: #ccc; +} + +.form-group .form-item .submit { + width: 640rpx; + margin: 46rpx auto 0; + height: 94rpx; + border-radius: 94rpx; + font-size: 36rpx; + background: #4facfe; + color: #fff; + display: flex; + justify-content: center; + align-items: center; +} + +.form-group .form-item .submit.disabled { + background: #dcdcdc; +} + +.apply-pass { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + background: #fff; + position: fixed; + left: 0; + top: 0; + z-index: 9; +} + +.add-img-btn { + color: #ccc; +} + +.form-group .form-item2 { + border-bottom: 0; + flex-direction: column; + align-items: flex-start; +} + +.form-item-textarea { + width: 100%; + border: 2rpx solid #e4e4e4; + border-radius: 5px; + padding: 5px; + box-sizing: border-box; +} + +.apply-pass { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + background: #fff; + position: relative; + left: 0; + z-index: 9; + padding-bottom: 100rpx; +} + +.apply-pass image { + width: 156rpx; + height: 144rpx; + padding-top: 150rpx; + margin-bottom: 28rpx; +} + +.apply-pass .applyPassImg { + width: 186rpx; + height: 186rpx; + font-size: 230rpx; + color: #4facfe; + margin-bottom: 40rpx; + margin-top: 106rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.apply-pass .h1 { + font-size: 32rpx; + margin-bottom: 20rpx; + color: #555; +} + +.apply-pass .p { + font-size: 28rpx; + color: #999; + margin-bottom: 30rpx; +} + +.apply-pass .link-btn { + width: 310rpx; + height: 98rpx; + border-radius: 20rpx; + background: #4facfe; + color: #fff; + font-size: 32rpx; + display: flex; + justify-content: center; + align-items: center; + font-weight: bold; +} diff --git a/eaterplanet_ecommerce/pages/supply/home.js b/eaterplanet_ecommerce/pages/supply/home.js new file mode 100644 index 0000000..144c909 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/home.js @@ -0,0 +1,163 @@ +var app = getApp(); +var util = require('../../utils/util.js'); +var wcache = require('../../utils/wcache.js'); +var status = require('../../utils/index.js'); + +Page({ + mixins: [require('../../mixin/cartMixin.js'), require('../../mixin/globalMixin.js')], + /** + * 页面的初始数据 + */ + data: { + list: [], + info: [], + cartNum: 0 + }, + supplyId: 0, + page: 1, + is_only_distribution: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + app.setShareConfig(); + this.supplyId = options.id || 0; + this.is_only_distribution = options.is_only_distribution || 0; + if (options.share_id != 'undefined' && options.share_id > 0) wcache.put('share_id', options.share_id); + this.getData(); + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + this.getData(); + this.setData({ + needAuth: false + }) + }, + + getData: function () { + wx.showLoading(); + var token = wx.getStorageSync('token'); + var that = this; + var cur_community = wx.getStorageSync('community'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'supply.get_details', + token: token, + page: that.page, + is_random: 1, + head_id: cur_community.communityId, + id: that.supplyId, + is_only_distribution: this.is_only_distribution + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + let oldList = that.data.list; + let info = res.data.data || []; + let list = oldList.concat(res.data.list); + let noData = false; + if(that.page == 1) { + wx.setNavigationBarTitle({ + title: info.storename || info.shopname || '商户' + }) + if (list.length==0) noData = true; + } + let noMore = false; + if (res.data.list.length == 0) noMore = true; + that.setData({ list, info, noMore, noData }) + } else { + that.setData({ noMore: true }) + } + } + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + util.check_login_new().then((res) => { + if (res) { + this.setData({ needAuth: false }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ cartNum: res.data }) + }); + } else { + let id = this.specialId; + this.setData({ needAuth: true, navBackUrl: `/eaterplanet_ecommerce/pages/supply/home?id=${id}` }); + } + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.data.noMore || (this.page++, this.getData()); + }, + + onShareAppMessage: function (res) { + var share_title = this.data.info.storename || '商户主页'; + var share_id = wx.getStorageSync('member_id'); + var id = this.supplyId; + var share_path = `eaterplanet_ecommerce/pages/supply/home?id=${id}&share_id=${share_id}`; + + return { + title: share_title, + path: share_path, + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 + } + } + }, + + onShareTimeline: function (res) { + var share_title = this.data.info.storename || '商户主页'; + var share_id = wx.getStorageSync('member_id'); + var id = this.supplyId; + var query = `id=${id}&share_id=${share_id}`; + return { + title: share_title, + query, + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 + } + } + } +}) diff --git a/eaterplanet_ecommerce/pages/supply/home.json b/eaterplanet_ecommerce/pages/supply/home.json new file mode 100644 index 0000000..a7c6a17 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/home.json @@ -0,0 +1,15 @@ +{ + "navigationBarTitleText": "", + "enablePullDownRefresh": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "i-img": "../../components/img/index", + "i-button": "../../components/button/index", + "i-router-link": "../../components/router-link/router-link", + "sku": "../../components/sku/index", + "i-cart-btn": "../../components/cartBtn/index", + "i-input-number": "../../components/input-number/index", + "i-aside-btn": "../../components/asideBtn/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/supply/home.wxml b/eaterplanet_ecommerce/pages/supply/home.wxml new file mode 100644 index 0000000..8f3bb73 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/home.wxml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/supply/home.wxss b/eaterplanet_ecommerce/pages/supply/home.wxss new file mode 100644 index 0000000..58ad825 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/home.wxss @@ -0,0 +1,154 @@ +.special { + min-height: 100vh; +} + +.topic-img { + width: 100%; +} + +.like { + padding-bottom: 100rpx; +} + +.like-list { + position: relative; + padding: 20rpx; + display: flex; + justify-content: space-between; + flex-wrap: wrap; + z-index: 0; +} + +.new-comers-item { + background-color: #fff; + width: 345rpx; + box-sizing: border-box; + padding: 30rpx; + border-radius: 10px; + font-size: 28rpx; + margin-bottom: 20rpx; +} + +.new-comers-item .new-img { + width: 285rpx; + height: 240rpx; + margin-bottom: 20rpx; +} + +.new-comers-item .title { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.new-comers-item .new-bot { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.new-comers-item .add-cart { + height: 48rpx; + line-height: 48rpx; + padding: 0 20rpx; + color: #fff; + border-radius: 22rpx; + margin: 0; + background: linear-gradient(270deg,#4facfe 0%,#00f2fe 100%); + font-size: 24rpx; +} + +.new-comers-item .add-cart.disabled { + background: #ccc; +} + +.new-comers-item .price { + color: #4facfe; +} + +.new-comers-item { + position: relative; +} + +.new-comers-item .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 50%; + top: 120rpx; + padding: 0 12rpx; + transform: translateX(-50%); +} + +.none-rush-list { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding-bottom: 140rpx; + padding-top: 140rpx; +} + +.none-rush-list .img-block { + width: 240rpx; + height: 240rpx; + margin-bottom: 30rpx; +} + +.none-rush-list .h1 { + font-size: 32rpx; + line-height: 32rpx; + color: #444; + margin-bottom: 20rpx; +} + +.none-rush-list .h2 { + font-size: 24rpx; + line-height: 24rpx; + color: #aaa; +} + +/* 数量加减 */ +.like-list .index-input-number { + position: absolute; + right: 20rpx; + bottom: 0; + display: flex; + justify-content: center; + align-items: center; +} + +.like-list .index-input-number .i-input-number-view { + width: 80rpx; + height: 80rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.like-list .index-input-number .i-input-number-view .img{ + width: 40rpx; + height: 40rpx; +} + +.like-list .index-input-number .i-input-number-minus { + justify-content: flex-end; +} + +.like-list .index-input-number .i-input-number-plus { + justify-content: flex-start; +} + +.like-list .index-input-number .input-number-text { + height: 88rpx; + line-height: 88rpx; + font-size: 24rpx; + color: #333; + width: 58rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/supply/index.js b/eaterplanet_ecommerce/pages/supply/index.js new file mode 100644 index 0000000..f48114d --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/index.js @@ -0,0 +1,212 @@ +var app = getApp(); +var util = require('../../utils/util.js'); + +Page({ + mixins: [require('../../mixin/cartMixin.js')], + /** + * 页面的初始数据 + */ + data: { + list: [], + supplyList: [], + noMore: false, + supply_diy_name: "商户" + }, + page: 1, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + app.setShareConfig(); + this.getData(); + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + let that = this; + this.page = 1; + this.setData({ + needAuth: false, + noMore: false, + list: [], + supplyList: [] + }, ()=>{ + that.getData(); + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + util.check_login_new().then((res) => { + if (res) { + this.setData({ needAuth: false }); + } else { + this.setData({ needAuth: true, navBackUrl: `/eaterplanet_ecommerce/pages/supply/index` }); + } + }) + }, + + getData: function () { + wx.showLoading(); + var token = wx.getStorageSync('token'); + var that = this; + var cur_community = wx.getStorageSync('community'); + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'supply.get_list', + token: token, + page: that.page, + head_id: cur_community.communityId + }, + dataType: 'json', + success: function (res) { + wx.stopPullDownRefresh(); + wx.hideLoading(); + if (that.page==1) { + let supply_diy_name = res.data.supply_diy_name || '商户'; + wx.setNavigationBarTitle({ + title: `${supply_diy_name}列表`, + }) + that.setData({ supply_diy_name }) + } + if (res.data.code == 0) { + let oldList = that.data.supplyList; + let supplyList = oldList.concat(res.data.data); + that.setData({ supplyList }) + } else { + that.setData({ noMore: true }) + } + } + }) + }, + + goDetails: function(e){ + let id = e.currentTarget.dataset.id || 0; + id && wx.navigateTo({ + url: `/eaterplanet_ecommerce/pages/supply/home?id=${id}`, + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + let that = this; + this.page = 1; + this.setData({ + noMore: false, + list: [], + supplyList: [] + }, () => { + that.getData(); + }) + }, + + openSku: function(e) { + if (!this.authModal()) return; + let shopidx = e.currentTarget.dataset.shopidx; + let supplyList = this.data.supplyList; + let rushList = supplyList[shopidx].goods_list || []; + this.setData({ list: rushList }) + + var that = this; + let idx = e.currentTarget.dataset.idx; + let spuItem = rushList[idx]; + + var goods_id = spuItem.actId; + var options = spuItem.skuList; + that.setData({ + addCar_goodsid: goods_id + }) + + let list = options.list || []; + let arr = []; + if (list.length > 0) { + for (let i = 0; i < list.length; i++) { + let sku = list[i]['option_value'][0]; + let temp = { + name: sku['name'], + id: sku['option_value_id'], + index: i, + idx: 0 + }; + arr.push(temp); + } + //把单价剔除出来begin + + var id = ''; + for (let i = 0; i < arr.length; i++) { + if (i == arr.length - 1) { + id = id + arr[i]['id']; + } else { + id = id + arr[i]['id'] + "_"; + } + } + var cur_sku_arr = options.sku_mu_list[id]; + that.setData({ + sku: arr, + sku_val: 1, + cur_sku_arr: cur_sku_arr, + skuList: spuItem.skuList, + visible: true, + showSku: true + }); + } else { + let goodsInfo = spuItem; + that.setData({ + sku: [], + sku_val: 1, + skuList: [], + cur_sku_arr: goodsInfo + }) + let formIds = { + detail: { + formId: "" + } + }; + formIds.detail.formId = "the formId is a mock one"; + that.gocarfrom(formIds); + } + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.data.noMore || (this.page++, this.getData()); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + onShareTimeline: function () { + + } +}) diff --git a/eaterplanet_ecommerce/pages/supply/index.json b/eaterplanet_ecommerce/pages/supply/index.json new file mode 100644 index 0000000..8f8bea4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/index.json @@ -0,0 +1,14 @@ +{ + "navigationBarTitleText": "商户列表", + "enablePullDownRefresh": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "i-img": "../../components/img/index", + "i-button": "../../components/button/index", + "i-router-link": "../../components/router-link/router-link", + "sku": "../../components/sku/index", + "i-empty": "../../components/empty/index", + "i-addcart": "../../components/addCartBtn/index" + } +} diff --git a/eaterplanet_ecommerce/pages/supply/index.wxml b/eaterplanet_ecommerce/pages/supply/index.wxml new file mode 100644 index 0000000..f76942f --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/index.wxml @@ -0,0 +1,42 @@ + + + + + + + + + {{shop.storename?shop.storename:shop.shopname}} + + + {{shop.goods_count}} + + + + + + + + + 已抢光 + {{item.spuName}} + + ¥{{item.actPrice[0]}}.{{item.actPrice[1]}} + + + + + + + + + + + + + 暂无{{supply_diy_name}}~ + + + + + diff --git a/eaterplanet_ecommerce/pages/supply/index.wxss b/eaterplanet_ecommerce/pages/supply/index.wxss new file mode 100644 index 0000000..b782bc6 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/index.wxss @@ -0,0 +1,148 @@ +.topic { + background-color: #fff; + margin-bottom: 20rpx; +} + +.supply { + position: relative; + display: flex; + justify-content: space-between; + align-items: center; + padding: 20rpx; + font-size: 32rpx; +} + +.supply::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + border-bottom: 1px solid #ececec; + transform-origin: 0 0; + transform: scaleY(0.5); +} + +.supply-l { + display: flex; + align-items: center; +} + +.supply .avatar { + position: relative; + width: 80rpx; + height: 80rpx; + border-radius: 50%; + background: #eee; + margin-right: 8px; +} + +.supply .avatar::before { + content: "供"; + position: absolute; + left: 0; + top: 0; + right: 0; + display: block; + line-height: 80rpx; + text-align: center; + color: #e5e5e5; + font-weight: bold; + z-index: 0; +} + +.supply .avatar image { + position: relative; + width: 80rpx; + height: 80rpx; + border-radius: 50%; + z-index: 1; +} + +.supply .name { + font-weight: bold; +} + +.icon-right { + width: 12rpx; + height: 22rpx; + margin-left: 5px; +} + +.new-comers { + position: relative; + padding: 10rpx 20rpx 30rpx; +} + +.new-comers-scroll { + max-height: 340rpx; +} + +.new-comers-wrap { + position: relative; + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + +.new-comers-item { + width: 240rpx; + box-sizing: border-box; + padding: 20rpx; + font-size: 28rpx; +} + +.new-comers-item .new-img { + width: 200rpx; + height: 180rpx; + margin-bottom: 20rpx; +} + +.new-comers-item .title { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.new-comers-item .new-bot { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.new-comers-item .add-cart { + width: 44rpx; + height: 44rpx; + padding: 0; + margin: 0; +} + +.new-comers-item .add-cart .img { + width: 44rpx; + height: 44rpx; + display: block; +} + +.new-comers-item .price { + color: #ff758c; +} + +.new-comers-item { + position: relative; +} + +.new-comers-item .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 50%; + top: 80rpx; + padding: 0 12rpx; + transform: translateX(-50%); +} diff --git a/eaterplanet_ecommerce/pages/supply/recruit.js b/eaterplanet_ecommerce/pages/supply/recruit.js new file mode 100644 index 0000000..c9b6aa4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/recruit.js @@ -0,0 +1,98 @@ +var app = getApp(); +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + onLoad: function (options) { + app.setShareConfig(); + status.setNavBgColor(); + let that = this; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'supply.get_apply_page' + }, + dataType: 'json', + success: function (res) { + let supply_diy_name = res.data.supply_diy_name || '商户'; + wx.setNavigationBarTitle({ + title: supply_diy_name, + }) + that.setData({ supply_diy_name }) + if (res.data.code == 0) { + console.log(res) + let article = res.data.data || ''; + that.setData({ article }) + } + } + }) + }, + + onShow: function () { + let that = this; + util.check_login_new().then((res) => { + that.setData({ needAuth: !res }); + }) + }, + + authModal: function () { + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + this.setData({ + needAuth: false, + showAuthModal: false + }) + }, + + goLink: function (event) { + if (!this.authModal()) return; + let url = event.currentTarget.dataset.link; + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ url }) + } else { + wx.navigateTo({ url }) + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + onShareTimeline: function () { + + } +}) diff --git a/eaterplanet_ecommerce/pages/supply/recruit.json b/eaterplanet_ecommerce/pages/supply/recruit.json new file mode 100644 index 0000000..04695f8 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/recruit.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "parser":"../../components/parser/parser" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/supply/recruit.wxml b/eaterplanet_ecommerce/pages/supply/recruit.wxml new file mode 100644 index 0000000..8e369eb --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/recruit.wxml @@ -0,0 +1,13 @@ + + + + + + + + 申请成为{{supply_diy_name}} + + + + + diff --git a/eaterplanet_ecommerce/pages/supply/recruit.wxss b/eaterplanet_ecommerce/pages/supply/recruit.wxss new file mode 100644 index 0000000..a73cbc7 --- /dev/null +++ b/eaterplanet_ecommerce/pages/supply/recruit.wxss @@ -0,0 +1,18 @@ +.section { + background: #fff; + margin-bottom: 20rpx; + padding: 0 10rpx 20rpx; +} + +.section .apply-btn { + width: 710rpx; + height: 96rpx; + background: #4facfe; + border-radius: 20rpx; + color: #fff; + font-size: 30rpx; + line-height: 96rpx; + text-align: center; + display: block; + margin: 16rpx auto 16rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/details.js b/eaterplanet_ecommerce/pages/type/details.js new file mode 100644 index 0000000..6e3392c --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/details.js @@ -0,0 +1,191 @@ +var app = getApp(); +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js'), require('../../mixin/compoentCartMixin.js')], + data: { + loadMore: true, + loadText: "加载中...", + rushList: [], + cartNum: 0, + showEmpty: false, + theme: 0 + }, + $data: { + id: 0, + pageNum: 1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + status.setNavBgColor(); + let id = options.id || ''; + this.$data.id = id; + if (id) { + this.getData(); + } else { + wx.showToast({ + title: '参数错误', + icon: 'none' + }, ()=>{ + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + }) + } + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + const that = this; + util.check_login_new().then((res) => { + let needAuth = !res; + that.setData({ needAuth }) + if (res) { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } + }) + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + const that = this; + this.$data.pageNum = 1; + this.setData({ + loadMore: true, + loadText: "加载中...", + rushList: [], + showEmpty: false, + needAuth: false + }, () => { + that.getData(); + }) + }, + + getData: function () { + let that = this; + return new Promise(function (resolve, reject) { + let token = wx.getStorageSync('token'); + let cur_community = wx.getStorageSync('community'); + let gid = that.$data.id; + wx.showLoading(); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_cate_goodslist', + token: token, + head_id: cur_community.communityId, + gid + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + let { full_money, full_reducemoney, is_open_fullreduction, list, is_show_cate_tabbar, user_service_switch, theme } = res.data; + let reduction = { full_money, full_reducemoney, is_open_fullreduction }; + let rushList = that.data.rushList.concat(list); + + var h = { + rushList: rushList, + pageEmpty: false, + reduction, + loadOver: true, + is_show_cate_tabbar, + user_service_switch, + theme + }; + if (list.length==0) { + h.showEmpty = true; + } + + wx.setNavigationBarTitle({ title: list.length && list[0].cate_info['name'] || '' }); + h.loadText = that.data.loadMore ? "加载中..." : "没有更多商品了~"; + that.setData(h, function () { + that.$data.pageNum += 1; + }) + } else if (res.data.code == 1) { + wx.showModal({ + title: '提示', + content: res.data.msg || '无数据', + showCancel: false, + success(){ + wx.navigateBack(); + } + }) + } + resolve(res); + } + }) + }); + }, + + changeCartNum: function (t) { + let that = this; + let e = t.detail; + (0, status.cartNum)(that.setData({ + cartNum: e + })); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + console.log('这是我的底线'); + // this.data.loadMore && (this.setData({ loadOver: false }),this.getData()); + }, + + loadImgFail: function(event) { + console.log(event) + this.setData({ + hideErrorImg: true + }) + }, + + onShareAppMessage: function (res) { + let rushList = this.data.rushList; + let cate_info = rushList && rushList[0].cate_info; + var share_title = (cate_info && cate_info.name) || '分类列表'; + var share_id = wx.getStorageSync('member_id'); + var id = this.$data.id; + var share_path = `eaterplanet_ecommerce/pages/type/details?id=${id}&share_id=${share_id}`; + + return { + title: share_title, + path: share_path, + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 + } + } + } +}) diff --git a/eaterplanet_ecommerce/pages/type/details.json b/eaterplanet_ecommerce/pages/type/details.json new file mode 100644 index 0000000..cca894e --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/details.json @@ -0,0 +1,16 @@ +{ + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "sku": "../../components/sku/index", + "i-cart-btn": "../../components/cartBtn/index", + "i-aside-btn": "../../components/asideBtn/index", + "i-load-more": "../../components/load-more/index", + "i-rush-spu-big": "../../components/rush-spu-big/index", + "i-new-rush-spu": "../../components/new-rush-spu/index", + "i-rush-spu": "../../components/rush-spu-col/index", + "i-tworow": "../../components/tworow/index", + "i-tabbar": "../../components/tabbar/index", + "i-vip-modal": "../../components/vipModal/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/details.wxml b/eaterplanet_ecommerce/pages/type/details.wxml new file mode 100644 index 0000000..ebc50fa --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/details.wxml @@ -0,0 +1,37 @@ + + + + + + + —— {{item.cate_info.name}} —— + + + + + + + + + + + + + + + + + + 暂时没有商品 + 我们正在为您准备更优惠的商品 + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/type/details.wxss b/eaterplanet_ecommerce/pages/type/details.wxss new file mode 100644 index 0000000..23808af --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/details.wxss @@ -0,0 +1,94 @@ +page { + background: #fff; +} + +.wrap { + padding-bottom: 100rpx; +} + +.topic-img { + width: 100%; +} + +.cate-title { + text-align: center; + margin: 20rpx 0; +} + +.title-img { + max-width: 100%; +} + +.list { + display: flex; + flex-wrap: wrap; +} + +.none-rush-list { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding-bottom: 140rpx; + padding-top: 140rpx; +} + +.none-rush-list .img-block { + width: 240rpx; + height: 240rpx; + margin-bottom: 30rpx; +} + +.none-rush-list .h1 { + font-size: 32rpx; + line-height: 32rpx; + color: #444; + margin-bottom: 20rpx; +} + +.none-rush-list .h2 { + font-size: 24rpx; + line-height: 24rpx; + color: #aaa; +} + +.cartBtn { + bottom: 180rpx !important; +} + +.comming-list { + padding: 10rpx 24rpx 20rpx; +} + +.comming-list .comming-spu-item { + width: 340rpx; + height: 526rpx; + height: 460rpx; + margin-bottom: 5rpx; + display: inline-block; + overflow: hidden; +} + +.themeTwo.comming-list .comming-spu-item { + height: 526rpx; +} + +.comming-list .comming-spu-item:nth-child(odd) { + margin-right: 20rpx; +} + +.theme3-list { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.theme3-list::after { + content:''; + width: 33.33%; +} + +.cate-subtitle { + font-size: 32rpx; + font-weight: bold; +} diff --git a/eaterplanet_ecommerce/pages/type/index.js b/eaterplanet_ecommerce/pages/type/index.js new file mode 100644 index 0000000..81b6d7d --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/index.js @@ -0,0 +1,855 @@ +var app = getApp(); +var a = require("../../utils/public"); +var status = require('../../utils/index.js'); +var util = require('../../utils/util.js'); +var wcache = require('../../utils/wcache.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js'), require('../../mixin/compoentCartMixin.js')], + data: { + cartNum: 0, + rushCategoryData: { + tabs: [], + activeIndex: 0 + }, + rushList: [], + categoryScrollBarTop: 0, + resetScrollBarTop: 50, + loadMore: true, + loadText: "加载中...", + scrollViewHeight: 0, + isFirstCategory: true, + isLastCategory: false, + pageEmpty: false, + active_sub_index: 0, + needPosition: true, + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + rightScrollTop: 0 + }, + $data: { + options: {}, + rushCategoryId: "", + pageNum: 1, + pageOverNum: 1, + actIds: [], + loading: true, + isScrollTop: true, + isScrollBottom: false, + scrollInfo: null, + isSetCategoryScrollBarTop: true, + touchStartPos: { + pageX: 0, + pageY: 0 + }, + rushList: [], + loadOver: false + }, + isFirst: 0, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + app.setShareConfig(); + wx.showLoading(); + wx.hideTabBar(); + status.setNavBgColor(); + status.setGroupInfo().then((groupInfo) => { that.setData({ groupInfo }) }); + let isIpx = app.globalData.isIpx; + let that = this; + this.getScrollViewHeight(); + this.setData({ + subCateHeight: this.getPx(44), + isIpx: isIpx ? true : false + }) + + console.log('options', options); + if (options && Object.keys(options).length != 0) { + let localCommunity = wx.getStorageSync('community'); + let localCommunityId = localCommunity.communityId || ''; + that.$data.options = options; + if (options.share_id != 'undefined' && options.share_id > 0) wcache.put('share_id', options.share_id); + + if (options.community_id != 'undefined' && options.community_id > 0) { + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.get_community_info', + community_id: options.community_id + }, + dataType: 'json', + success: function(res) { + var token = wx.getStorageSync('token'); + if (res.data.code == 0) { + let community = res.data.data; + let hide_community_change_btn = res.data.hide_community_change_btn; + if (options.community_id != localCommunityId) { + if (localCommunityId=='') { + wcache.put('community', community); + that.setData({ needPosition: false }) + } else { + that.setData({ + showChangeCommunity: true, + changeCommunity: community, + community: localCommunity, + hide_community_change_btn + }) + } + } + } + token && that.addhistory(); + } + }) + } + } + + this.$data.rushCategoryId = app.globalData.typeCateId || 0; + app.globalData.typeCateId = 0; + }, + + /** + * 生命周期函数--监听页面显示 + * JSON.stringify(obj) + */ + onShow: function() { + let that = this; + this.setData({ tabbarRefresh: true }) + this.get_cate_list().then(()=>{ + if (that.isFirst > 1) { + that.$data.rushCategoryId = app.globalData.typeCateId || 0; + console.log('typeCateId', that.$data.rushCategoryId); + app.globalData.typeCateId = 0; + if (that.$data.rushCategoryId) { + that.$data.loadOver = false; + that.$data.pageOverNum = 1; + let rushCategoryData = that.data.rushCategoryData; + let tabs = rushCategoryData.tabs; + let active_cate_id = that.$data.rushCategoryId; + let actIdxs = that.getTabsIndex(tabs, active_cate_id); + rushCategoryData.activeIndex = actIdxs[0]; + that.setData({ + rushCategoryData + }, () => { + console.log('setCategory', that.isFirst); + that.setCategory(rushCategoryData.activeIndex, actIdxs[1]); + }) + + } + } + }); + util.check_login_new().then((res) => { + if (res) { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + if (that.isFirst >= 1) { + let goodsListCarCount = app.globalData.goodsListCarCount; //[{ actId: 84, num: 2}] + let rushList = that.data.rushList; + if (goodsListCarCount.length > 0 && rushList.length > 0) { + let changeCarCount = false; + goodsListCarCount.forEach(function(item) { + let k = rushList.findIndex((n) => n.actId == item.actId); + if (k != -1 && rushList[k].skuList.length === 0) { + let newNum = item.num * 1; + rushList[k].car_count = newNum >= 0 ? newNum : 0; + changeCarCount = true; + } + }) + that.setData({ + rushList, + changeCarCount + }) + } + } + } else { + that.setData({ + needAuth: true + }) + } + }) + that.isFirst++; + }, + + getTabsIndex: function(tabs, active_cate_id) { + let activeIndex = -1; + let active_sub_index = 0; + tabs.forEach((p, index) => { + if(p.id == active_cate_id) { + activeIndex = index; + } else { + p.sub && p.sub.forEach((item, idx) => { + if(item.id == active_cate_id) { + activeIndex = index; + active_sub_index = idx + 1; + } + }) + } + }); + return [activeIndex, active_sub_index]; + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + this.$data = { + ...this.$data, ...{ + options: {}, + rushCategoryId: "", + pageNum: 1, + pageOverNum: 1, + actIds: [], + loading: true, + isScrollTop: true, + isScrollBottom: false, + scrollInfo: null, + isSetCategoryScrollBarTop: true, + touchStartPos: { + pageX: 0, + pageY: 0 + }, + loadOver: false + } + } + let that = this; + this.setData({ + needAuth: false, + showAuthModal: false, + rushList: [], + categoryScrollBarTop: 0, + resetScrollBarTop: 0, + loadMore: true, + loadText: "加载中...", + isFirstCategory: true, + isLastCategory: false, + pageEmpty: false, + active_sub_index: 0, + "rushCategoryData.activeIndex": 0 + },()=>{ + that.get_cate_list().then(()=>{ + that.initPageData(); + }); + }) + }, + + /** + * 确认切换社区 + */ + confrimChangeCommunity: function () { + let community = this.data.changeCommunity; + app.globalData.community = community; + wcache.put('community', community); + this.setData({ + showChangeCommunity: false, + needPosition: false + }, () => { + this.addhistory(); + }) + }, + + /** + * 关闭切换社区 + */ + closeChangeCommunity: function () { + this.setData({ + showChangeCommunity: false + }) + }, + + /** + * 跳转地址选择 + */ + goSelectCommunity: function () { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/position/community', + }) + }, + + /** + * 更新用户社区 + * id: 社区id + */ + addhistory: function(id = 0) { + let community_id = 0; + if (id == 0) { + var community = wx.getStorageSync('community'); + community_id = community.communityId || ''; + } else { + community_id = id; + } + console.log('history community_id=' + community_id); + var token = wx.getStorageSync('token'); + let that = this; + community_id !== void 0 && app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.addhistory_community', + community_id: community_id, + token: token + }, + dataType: 'json', + success: function(res) { + if (id != 0) that.getHistoryCommunity(), console.log('addhistory+id', id); + } + }) + }, + + //获取历史社区 + getHistoryCommunity: function() { + let that = this; + var token = wx.getStorageSync('token'); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_history_community', + token: token + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + console.log('getHistoryCommunity'); + let history_communities = res.data.list; + if (Object.keys(history_communities).length == 0 || history_communities.communityId == 0) isNotHistory = true; + + let resArr = history_communities && history_communities.fullAddress && history_communities.fullAddress.split('省'); + history_communities = Object.assign({}, history_communities, { + address: resArr[1] + }) + wcache.put('community', history_communities); + app.globalData.community = history_communities; + } else { + let options = that.options; + if (options !== void 0 && options.community_id) { + console.log('新人加入分享进来的社区id:', that.options); + that.addhistory(options.community_id); + } + } + } + }) + }, + + onPullDownRefresh: function() { + this.initPageData(); + }, + + /** + * 初始化数据 + */ + initPageData: function() { + var t = this; + this.setData({ + isFirstCategory: true, + isLastCategory: false, + rushList: [], + resetScrollBarTop: 0 + }, function() { + t.getHotList(); + }); + }, + + scrollBottom: function() { + var t = this, + e = this.$data, + loading = e.loading; + if (!loading) { + e.loading = true; + this.getHotList(); + } + }, + + scroll: function(t) { + var a = t.detail, + e = a.scrollTop, + o = a.scrollHeight, + i = this.data, + r = i.scrollViewHeight, + s = i.loadMore; + this.$data.scrollInfo = a, this.$data.isScrollTop = e <= 49, this.$data.isScrollBottom = !s && o - e - r <= 10; + }, + + /** + * 搜索栏高度 + */ + getScrollViewHeight: function() { + var that = this; + wx.createSelectorQuery().select(".search-bar").boundingClientRect(function(res) { + res.height && that.setData({ + scrollViewHeight: wx.getSystemInfoSync().windowHeight - res.height + }); + }).exec(); + }, + + changeCategory: function(t) { + var idx = t.currentTarget.dataset.index; + this.$data.loadOver = false; + console.log(idx) + idx !== this.data.rushCategoryData.activeIndex && this.setCategory(idx); + }, + + setCategory: function(t, active_sub_index=0) { + var that = this, + rushCategoryData = this.data.rushCategoryData, + tabs = rushCategoryData.tabs[t] || {}, + scrollViewHeight = this.data.scrollViewHeight; + + if(active_sub_index>0) { + this.$data.rushCategoryId = tabs.sub[active_sub_index-1].id || null; + } else { + this.$data.rushCategoryId = tabs.id || null; + } + this.$data.pageNum = 1; + this.$data.pageOverNum = 1; + this.$data.isSetCategoryScrollBarTop = false; + let isFirstCategory = !t; + let isLastCategory = (t == rushCategoryData.tabs.length - 1); + this.setData({ + "rushCategoryData.activeIndex": t, + resetScrollBarTop: 0, + categoryScrollBarTop: 50 * t - (scrollViewHeight - 50) / 2, + rushList: [], + canNext: false, + isFirstCategory, + isLastCategory, + active_sub_index, + showDrop: false + }, function() { + that.getHotList(); + }); + }, + + getHotList: function() { + var t = this, + e = this.$data, + rushCategoryId = e.rushCategoryId; + this.$data.loading = true; + + if(this.$data.loadOver) { + this.reqOverPromise().catch(function() { + var a = {}; + rushCategoryId || (a.pageEmpty = true), t.$data.loading = false, t.setData(a), wx.stopPullDownRefresh(); + }); + } else { + this.reqPromise().then(function() { + wx.stopPullDownRefresh(); + }).catch(function() { + t.reqOverPromise().catch(function() { + var a = {}; + rushCategoryId || (a.pageEmpty = true), t.$data.loading = false, t.setData(a), wx.stopPullDownRefresh(); + }); + }); + } + }, + + reqPromise: function() { + let that = this; + return new Promise(function(resolve, reject) { + let token = wx.getStorageSync('token'); + let cur_community = wx.getStorageSync('community'); + let rushCategoryId = that.$data.rushCategoryId; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_gps_goodslist', + token, + pageNum: that.$data.pageNum, + head_id: cur_community.communityId, + gid: rushCategoryId, + per_page: 30 + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let list = res.data.list; + let h = {}; + let rushList = that.data.rushList.concat(list); + let { full_money, full_reducemoney, is_open_fullreduction, is_open_vipcard_buy, is_vip_card_member, is_member_level_buy } = res.data; + let reduction = { full_money, full_reducemoney, is_open_fullreduction } + + // 是否可以会员折扣购买 + let canLevelBuy = false; + if (is_open_vipcard_buy == 1) { + if (is_vip_card_member != 1 && is_member_level_buy == 1) canLevelBuy = true; + } else { + (is_member_level_buy == 1) && (canLevelBuy = true); + } + + h = { + ...h, + rushList: rushList, + pageEmpty: false, + cur_time: res.data.cur_time, + reduction, + rushCategoryData: that.data.rushCategoryData, + is_open_vipcard_buy: is_open_vipcard_buy || 0, + is_vip_card_member, + is_member_level_buy, + canLevelBuy + }; + h.vipInfo = { is_open_vipcard_buy, is_vip_card_member, is_member_level_buy }; + + // if (that.$data.pageNum == 1) h.resetScrollBarTop = 51; + h.loadText = that.data.loadMore ? "加载中..." : "没有更多商品了~"; + that.$data.isSetCategoryScrollBarTop && (h.categoryScrollBarTop = 50 * h.rushCategoryData.activeIndex - (that.data.scrollViewHeight - 50) / 2); + that.setData(h, function() { + that.$data.loading = false, that.$data.pageNum += 1, !rushCategoryId && h.rushCategoryData.tabs && h.rushCategoryData.tabs[0] && (that.$data.rushCategoryId = h.rushCategoryData.tabs[0].id); //,that.setData({ resetScrollBarTop: 50 }) + }) + if(list.length<30) { + that.$data.loadOver = true; + reject(); + } + } else if (res.data.code == 1) { + that.$data.loadOver = true; + reject(); + } else if (res.data.code == 2) { + //no login + that.setData({ + needAuth: true + }) + } + resolve(res); + } + }) + }); + }, + + reqOverPromise: function() { + let that = this; + return new Promise(function(resolve, reject) { + let token = wx.getStorageSync('token'); + let cur_community = wx.getStorageSync('community'); + let rushCategoryId = that.$data.rushCategoryId; + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'index.load_over_gps_goodslist', + token, + pageNum: that.$data.pageOverNum, + head_id: cur_community.communityId, + gid: rushCategoryId, + per_page: 30 + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let list = res.data.list; + let h = {}; + if(list.length<30) { h.loadMore = false;h.canNext = true; } + let rushList = that.data.rushList.concat(list); + let { full_money, full_reducemoney, is_open_fullreduction, is_open_vipcard_buy, is_vip_card_member, is_member_level_buy } = res.data; + let reduction = { full_money, full_reducemoney, is_open_fullreduction } + + // 是否可以会员折扣购买 + let canLevelBuy = false; + if (is_open_vipcard_buy == 1) { + if (is_vip_card_member != 1 && is_member_level_buy == 1) canLevelBuy = true; + } else { + (is_member_level_buy == 1) && (canLevelBuy = true); + } + + h = { + ...h, + rushList: rushList, + pageEmpty: false, + cur_time: res.data.cur_time, + reduction, + rushCategoryData: that.data.rushCategoryData, + is_open_vipcard_buy: is_open_vipcard_buy || 0, + is_vip_card_member, + is_member_level_buy, + canLevelBuy + }; + h.vipInfo = { is_open_vipcard_buy, is_vip_card_member, is_member_level_buy }; + + // if (that.$data.pageNum == 1) h.resetScrollBarTop = 51; + h.loadText = that.data.loadMore ? "加载中..." : "没有更多商品了~"; + that.$data.isSetCategoryScrollBarTop && (h.categoryScrollBarTop = 50 * h.rushCategoryData.activeIndex - (that.data.scrollViewHeight - 50) / 2); + that.setData(h, function() { + that.$data.loading = false, that.$data.pageOverNum += 1, !rushCategoryId && h.rushCategoryData.tabs && h.rushCategoryData.tabs[0] && (that.$data.rushCategoryId = h.rushCategoryData.tabs[0].id); //,that.setData({ resetScrollBarTop: 50 }) + }) + } else if (res.data.code == 1) { + //无数据 + let s = { + loadMore: false, + canNext: true + } + if (that.$data.pageOverNum == 1&&that.data.rushList.length==0) { + console.log('无数据'); + s.pageEmpty = true; + } + that.$data.loading = true; + that.setData(s); + } else if (res.data.code == 2) { + //no login + that.setData({ + needAuth: true + }) + } + resolve(res); + } + }) + }); + }, + + getPx: function(t) { + return Math.round(app.globalData.systemInfo.windowWidth / 375 * t); + }, + + goResult: function(e) { + let keyword = e.detail.value.keyword.replace(/\s+/g, ''); + if (!keyword) { + wx.showToast({ + title: '请输入关键词', + icon: 'none' + }) + return; + } + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?keyword=' + keyword, + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + this.setData({ + tabbarRefresh: false, + changeCarCount: false + }) + }, + + showDrop: function() { + this.setData({ + showDrop: !this.data.showDrop + }) + }, + + get_cate_list: function() { + let that = this; + return new Promise((resolve, reject)=>{ + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'goods.get_category_list', + is_type_show: 1 + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let leftList = res.data.data || []; + if(leftList.length==0){ + wx.hideLoading(); + that.setData({ noCateList: true }) + return; + } + + //判断分类是否变化 + let cateNochange = false; + let oldRushCategoryData = that.data.rushCategoryData; + if(oldRushCategoryData && oldRushCategoryData.tabs && JSON.stringify(oldRushCategoryData.tabs) == JSON.stringify(leftList)) { + cateNochange = true; + } + + let rushCategoryId = that.$data.rushCategoryId || leftList && leftList[0] && leftList[0].id || 0; + let active_index = 0; + let active_sub_index = 0; + if (that.$data.rushCategoryId) { + let actIdxs = that.getTabsIndex(leftList, that.$data.rushCategoryId); + active_index = actIdxs[0]; + active_sub_index = actIdxs[1]; + } + if(active_sub_index>0) { + that.setData({ active_sub_index }) + rushCategoryId = leftList && leftList[active_index].sub && leftList[active_index].sub[active_sub_index-1].id || null; + } + that.$data.rushCategoryId = rushCategoryId; + let rushCategoryData = { + tabs: leftList, + activeIndex: active_index + } + let isFirstCategory = !rushCategoryData.activeIndex; + let isLastCategory = rushCategoryData.activeIndex == rushCategoryData.tabs.length - 1; + + console.log('cateNochange', cateNochange); + console.log('isFirst', that.isFirst); + if(!cateNochange) { + let h = {}; + if(that.isFirst > 1) { + that.$data.pageNum = 1; + rushCategoryData = { + tabs: leftList, + activeIndex: 0 + } + isFirstCategory = true; + isLastCategory = false; + that.$data.rushCategoryId = leftList[0] && leftList[0].id || 0; + h= { + rushList: [], + categoryScrollBarTop: 0, + resetScrollBarTop: 50, + loadMore: true, + loadText: "加载中...", + pageEmpty: false, + active_sub_index: 0 + }; + } + that.setData({ + ...h, + rushCategoryData, + isFirstCategory, + isLastCategory, + noCateList: false + }, () => { + that.initPageData(); + wx.hideLoading(); + }) + } + } else { + // 分类不存在 todo + } + resolve(); + }, + fail: function(res) { + reject(res) + } + }) + }) + }, + + // 切换子栏目 + change_sub_cate: function(e) { + this.$data.loadOver = false; + let rushCategoryData = this.data.rushCategoryData; + let tabs = rushCategoryData.tabs; + let active_index = rushCategoryData.activeIndex; //当前大栏目选中索引 + let active_sub_index = e.currentTarget.dataset.idx; //当前子栏目选中索引 + let active_cate_id = tabs[active_index].id; //当前大栏目选中id + let active_subcate_id = e.currentTarget.dataset.id || active_cate_id; + let scrollLeft = this.getPx(64) * active_sub_index; + console.log(scrollLeft); + let that = this; + that.$data.pageNum = 1; + this.$data.pageOverNum = 1; + that.$data.rushCategoryId = active_subcate_id; + that.setData({ + showDrop: false, + active_cate_id: active_subcate_id, + active_sub_index: active_sub_index, + rushList: [], + scrollLeft: scrollLeft, + showEmpty: false, + loadMore: true, + loadText: '加载中', + resetScrollBarTop: 50, + rightScrollTop: 0 + }, () => { + that.getHotList(); + }) + }, + + show_search: function() { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/search', + }) + }, + + clickAdv: function(e) { + let info = e.currentTarget.dataset.info || ''; + let type = info.linktype; + let url = info.link; + if (type == 0) { + // 跳转webview + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/web-view?url=' + encodeURIComponent(url), + }) + } else if (type == 1) { + if (url.indexOf('eaterplanet_ecommerce/pages/index/index') != -1 || url.indexOf('eaterplanet_ecommerce/pages/order/shopCart') != -1 || url.indexOf('eaterplanet_ecommerce/pages/user/me') != -1 || url.indexOf('eaterplanet_ecommerce/pages/type/index') != -1) { + url && wx.switchTab({ url }) + } else { + url && wx.navigateTo({ url }) + } + } else if (type == 2) { + // 跳转小程序 + let appId = info.appid; + appId && wx.navigateToMiniProgram({ + appId, + path: url, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if (type == 3) { + if(this.data.pos==0) { + this.triggerEvent("switchType", url); + } else { + getApp().globalData.indexCateId = url; + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }) + } + } else if (type == 4) { + //独立分类 + getApp().globalData.typeCateId = url; + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/type/index' + }) + } else if (type==5){ + // 跳转小程序 + let appId = info.appid; + appId && wx.navigateToMiniProgram({ + appId, + path: url, + extraData: {}, + envVersion: 'release', + success(res) { + // 打开成功 + }, + fail(error) { + console.log(error) + } + }) + } else if(type==6) { + //领券 + wx.navigateTo({ + url: '/eaterplanet_ecommerce/moduleA/coupon/getCoupon?id='+url + }) + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + var community = wx.getStorageSync('community'); + var community_id = community.communityId || ''; + var member_id = wx.getStorageSync('member_id') || ''; + console.log("eaterplanet_ecommerce/pages/type/index?community_id=" + community_id + '&share_id=' + member_id); + return { + path: "eaterplanet_ecommerce/pages/type/index?community_id=" + community_id + '&share_id=' + member_id, + success: function() {}, + fail: function() {} + }; + }, + + onShareTimeline: function() { + var community = wx.getStorageSync('community'); + var community_id = community.communityId || ''; + var member_id = wx.getStorageSync('member_id') || ''; + var query= `share_id=${member_id}&community_id=${community_id}`; + return { + query, + success: function() {}, + fail: function() {} + }; + } +}) diff --git a/eaterplanet_ecommerce/pages/type/index.json b/eaterplanet_ecommerce/pages/type/index.json new file mode 100644 index 0000000..fcec821 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/index.json @@ -0,0 +1,17 @@ +{ + "navigationBarTitleText": "分类", + "disableScroll": true, + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-tabbar": "../../components/tabbar/index", + "i-load-more": "../../components/load-more/index", + "i-img": "../../components/img/index", + "i-type-item": "./type-item", + "i-modal": "../../components/modal/index", + "i-new-auth": "../../components/new-auth/index", + "i-change-community": "../../components/changeCommunity/index", + "i-empty": "../../components/empty/index", + "i-sku": "../../components/sku/index", + "ad-alert": "../../components/ad-alert/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/index.wxml b/eaterplanet_ecommerce/pages/type/index.wxml new file mode 100644 index 0000000..a402dda --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/index.wxml @@ -0,0 +1,92 @@ + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + 全部 + {{item.name}} + + + + + + + 全部 + {{item.name}} + + + + + + + + + + + {{item.label_info.tagcontent}} + + + + + + + + + 暂时没有商品 + 我们正在为您准备更优惠的商品 + + + + + + 看到我的底线了吗~ + + 该分类下没有更多商品了~ + + + + + + + 暂无分类~ + + + + + + + + + + + + + diff --git a/eaterplanet_ecommerce/pages/type/index.wxss b/eaterplanet_ecommerce/pages/type/index.wxss new file mode 100644 index 0000000..84c08c3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/index.wxss @@ -0,0 +1,351 @@ +.page-wrap { + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: center; + width: 100vw; + height: 100vh; + background: #fff; +} + +/* 搜索 */ + +.search-bar { + padding: 12rpx 0rpx; + background-color: linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%); + width: 100%; + box-sizing: border-box; +} + +.search-box { + background-color: #ffffff; + height: 56rpx; + line-height: 56rpx; + border-radius: 28rpx; + color: #fff; + display: flex; + align-content: center; + flex: 1; +} + +.search-icon { + color: rgb(99, 99, 99); + position: absolute; + left: 20rpx; + margin-left: 25rpx; + margin-right: 12rpx; +} + +.search-icon .iconfont { + font-size: 34rpx; + padding-top: 10rpx; +} + +.search-box .ipt { + padding: 0 30rpx 0 60rpx; + line-height: 56rpx; + height: 56rpx; + width: 100%; + box-sizing: border-box; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +/* 列表 */ + +.page-content { + position: relative; + width: 750rpx; + flex-shrink: 0; + flex-grow: 1; +} + +.page-category { + position: absolute; + top: 0; + left: 0; + width: 160rpx; + height: 100%; + background: linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%); + padding-bottom: 0rpx; + box-shadow: inset -20rpx 0rpx 30rpx rgba(0,0,0,0.2) ; +} + +.category-item { + position: relative; + width: 160rpx; + height: 100rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + color: #fff; + line-height: 30rpx; + border-radius: 20px 0px 0px 20px; +} + +.category-item view { + max-width: 136rpx; + text-align: center; +} + +.category-item .item-border { + position: absolute; + top: 36rpx; + left: 0; + display: none; + width: 8rpx; + height: 28rpx; + background: linear-gradient(linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%),#00f2fe); +} + +.category-item.active { + background: #fff; + font-weight: 500; + color: #333; + box-shadow: 0 0rpx 20rpx rgba(0,0,0,0.2); +} + +.category-item.active .item-border { + display: block; +} + +.page-list { + position: absolute; + top: 0; + left: 160rpx; + width: 590rpx; + height: 1000rpx; + padding-top: 0; + box-sizing: border-box; + border-radius: 20px 20px 0px 20px; +} + +.page-list .scroll-col-tip-top, .page-list .scroll-col-tip-bottom { + height: 100rpx; + display: flex; + justify-content: center; + align-items: center; + color: #aaa; + font-size: 24rpx; + line-height: 24rpx; +} + +.page-list .scroll-col-tip-top image, .page-list .scroll-col-tip-bottom image { + width: 24rpx; + height: 16rpx; + margin-right: 8rpx; +} + +.mask { + position: fixed; + left: 0; + right: 0; + top: 84rpx; + bottom: 0; + background: rgba(0, 0, 0, 0.4); + z-index: 10; +} + +.tabbar { + position: relative; + height: 100rpx; + width: 100%; +} + +.none-rush-list { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding-bottom: 140rpx; + padding-top: 140rpx; +} + +.none-rush-list .img-block { + width: 240rpx; + height: 240rpx; + margin-bottom: 30rpx; +} + +.none-rush-list .h1 { + font-size: 32rpx; + line-height: 32rpx; + color: #444; + margin-bottom: 20rpx; +} + +.none-rush-list .h2 { + font-size: 24rpx; + line-height: 24rpx; + color: #aaa; +} + +/* 子栏目 */ +.sub-cate { + position: sticky; + line-height: 88rpx; + overflow: hidden; + white-space: nowrap; + width: 590rpx; + padding: 0 20rpx; + box-sizing: border-box; + font-size: 26rpx; + z-index: 20; + background-color: #fff; + display: flex; + left: 0; + right: 0; + top: 0; +} + +.sub-cate-scroll { + flex: 1; + width:0; +} + +.sub-cate::after { + content: ""; + position: absolute; + left: 20rpx; + right: 20rpx; + bottom: 0; + border-bottom: 1rpx solid #e5e5e5; +} + +.sub-cate-item { + display: inline-block; + min-width: 80rpx; + text-align: center; + padding: 0 20rpx; +} + +.sub-cate-item.active { + color: linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%); +} + +.icon-open { + padding: 0 8rpx 0 20rpx; + background-color: rgba(255, 255, 255, .9); +} + +.openImg { + width: 20rpx; + height: 12rpx; + transition: all 300ms ease-in; +} + +.openImg.down { + transform: rotate(180deg); +} + +.hide-sub-item { + line-height: 58rpx; + text-align: right; + width: 30%; +} + +.upImg { + width: 16rpx; + height: 8rpx; + vertical-align: middle; +} + +.sub-cate-hide { + position: sticky; + left: 0; + right: 0; + top: 89rpx; + z-index: 500; + background-color: #fff; + padding: 20rpx; + display: flex; + flex-wrap: wrap; + max-height: 300rpx; + overflow-y: auto; + align-items: center; +} + +.sub-cate-hide .sub-cate-item { + border: 1rpx solid #e7614d; + line-height: 58rpx; + border-radius: 29rpx; + color: #999; + margin: 0 1% 10rpx; + width: 22%; + font-size: 24rpx; + padding-top: 10rpx; + padding-bottom: 10rpx; +} + +.sub-cate-hide .sub-cate-item.active { + background-color: linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%); + color: #fff; + border: 1rpx solid linear-gradient(90deg, #e7614d 0%, #eb8a7b 100%); +} + +.pt50 { + padding-top: 100rpx; +} + +.mask { + position: fixed; + left: 160rpx; + right: 0; + top: 84rpx; + bottom: 0; + background: rgba(0,0,0,.4); + z-index: 10; +} + +/* 标签 */ +.item-tag { + position: absolute; + left: 24rpx; + top: 28rpx; + width: 54rpx; + height: 62rpx; + z-index: 1; + color: #fff; + text-align: center; +} + +.item-tag-bg { + position: absolute; + left: 0; + top: 0; + width: 54rpx; + height: 62rpx; + z-index: 0; +} + +.item-tag .tag-name { + position: relative; + padding-top: 6rpx; + font-size: 20rpx; + line-height: 1; + font-weight: 600; + z-index: 1; +} + +.item-tag .tag-name.two-word { + font-size: 22rpx; + padding-top: 14rpx; +} + +.advimg-box { + width: 546rpx; + height: 182rpx; + margin: 0 24rpx; + overflow: hidden; +} + +.advimg { + width: 546rpx; + height: 182rpx; + box-sizing: border-box; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/result.js b/eaterplanet_ecommerce/pages/type/result.js new file mode 100644 index 0000000..73334d9 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/result.js @@ -0,0 +1,186 @@ +var app = getApp(); +var util = require('../../utils/util.js'); +var a = require("../../utils/public"); +var status = require('../../utils/index.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js'), require('../../mixin/compoentCartMixin.js')], + data: { + cartNum: 0, + showEmpty: false, + showLoadMore: true, + rushList: [], + needAuth: false + }, + pageNum: 1, + keyword: '', + type: 0, + good_ids: '', + gid: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.showLoading(); + this.keyword = options.keyword || ''; + this.type = options.type || 0; + this.good_ids = options.good_ids || ''; + this.gid = options.gid || 0; + this.getData(); + }, + + onShow: function() { + const that = this; + util.check_login_new().then((res) => { + let needAuth = !res; + that.setData({ needAuth }) + if(res) { + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } + }) + }, + + // 获取数据 + getData: function() { + if (!this.hasRefeshin) { + this.hasRefeshin = true; + let that = this; + that.setData({ + showLoadMore: true, + loadMore: true, + loadText: '加载中' + }); + let token = wx.getStorageSync('token'); + let cur_community = wx.getStorageSync('community'); + let keyword = this.keyword; + let type = this.type; + let good_ids = this.good_ids; + let gid = this.gid; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'index.load_condition_goodslist', + token: token, + pageNum: that.pageNum, + head_id: cur_community.communityId, + keyword, + type, + good_ids, + gid + }, + dataType: 'json', + success: function(res) { + if (res.data.code == 0) { + let rushList = that.data.rushList.concat(res.data.list); + + let nowtime = Date.parse(new Date())/1000; + for (var i in rushList) { + if (rushList[i]['end_time'] < nowtime) { + rushList[i].actEnd = true + } + } + + let reduction = { + full_money: res.data.full_money, + full_reducemoney: res.data.full_reducemoney, + is_open_fullreduction: res.data.is_open_fullreduction + } + that.pageNum += 1; + that.hasRefeshin = false; + that.setData({ + showLoadMore: false, + rushList, + loadMore: false, + cur_time: res.data.cur_time, + reduction + }); + if (that.data.rushList.length == 0) that.setData({ + showEmpty: true + }) + } else if (res.data.code == 1) { + if (that.pageNum == 1 && that.data.rushList.length == 0) that.setData({ + showEmpty: true + }) + that.setData({ + showLoadMore: true, + loadMore: false, + loadText: '没有更多了' + }) + that.hasRefeshin = true; + } else if (res.data.code == 2) { + //no login + that.setData({ + needAuth: true + }) + } + }, + complete: function() { + wx.hideLoading(); + } + }) + } + }, + + /** + * 授权成功回调 + */ + authSuccess: function() { + const that = this; + this.pageNum = 1; + this.setData({ + showEmpty: false, + showLoadMore: true, + rushList: [], + needAuth: false + }, ()=>{ + that.getData(); + }) + }, + + /** + * 关闭购物车选项卡 + */ + closeSku: function() { + this.setData({ + visible: 0, + stopClick: false + }); + }, + + changeCartNum: function (t) { + let that = this; + let e = t.detail; + (0, status.cartNum)(that.setData({ + cartNum: e + })); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + console.log('这是我的底线'); + this.getData(); + } +}) \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/result.json b/eaterplanet_ecommerce/pages/type/result.json new file mode 100644 index 0000000..3995e17 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/result.json @@ -0,0 +1,14 @@ +{ + "navigationBarTitleText": "搜索结果", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-new-auth": "../../components/new-auth/index", + "i-tabbar": "../../components/tabbar/index", + "i-load-more": "../../components/load-more/index", + "i-img": "../../components/img/index", + "i-type-item": "./type-item", + "i-sku": "../../components/sku/index", + "i-cart-btn": "../../components/cartBtn/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/result.wxml b/eaterplanet_ecommerce/pages/type/result.wxml new file mode 100644 index 0000000..83de6d1 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/result.wxml @@ -0,0 +1,22 @@ + + + + + + + + + 暂时没有商品 + 我们正在为您准备更优惠的商品 + + + + + + + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/result.wxss b/eaterplanet_ecommerce/pages/type/result.wxss new file mode 100644 index 0000000..5511152 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/result.wxss @@ -0,0 +1,27 @@ +.none-rush-list { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding-bottom: 140rpx; + padding-top: 140rpx; +} + +.none-rush-list .img-block { + width: 240rpx; + height: 240rpx; + margin-bottom: 30rpx; +} + +.none-rush-list .h1 { + font-size: 32rpx; + line-height: 32rpx; + color: #444; + margin-bottom: 20rpx; +} + +.none-rush-list .h2 { + font-size: 24rpx; + line-height: 24rpx; + color: #aaa; +} diff --git a/eaterplanet_ecommerce/pages/type/search.js b/eaterplanet_ecommerce/pages/type/search.js new file mode 100644 index 0000000..7201347 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/search.js @@ -0,0 +1,160 @@ +var app = getApp(); +var util = require('../../utils/util.js'); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + is_login: true, + wxSearchData: [] + }, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + + onLoad: function(e) { + wx.showLoading(), this.getHisKeys(); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + wx.showLoading(); + this.getHisKeys(); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + wx.hideLoading() + }, + + goResult: function(e){ + let keyword = e.detail.value.replace(/\s+/g, ''); + if (!keyword) { + wx.showToast({ + title: '请输入关键词', + icon: 'none' + }) + return; + } + this.wxSearchAddHisKey(keyword); + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?keyword=' + keyword, + }) + }, + + goResultName: function (e) { + console.log(e) + let keyword = e.currentTarget.dataset.name; + if (!keyword) { + wx.showToast({ + title: '请输入关键词', + icon: 'none' + }) + return; + } + this.wxSearchAddHisKey(keyword); + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?keyword=' + keyword, + }) + }, + + // 获取记录 + getHisKeys: function() { + var value = []; + let that = this; + try { + value = wx.getStorageSync('wxSearchHisKeys') + if (value) { + that.setData({ + wxSearchData: value + }); + } + } catch (e) { + // Do something when catch error + } + + }, + + // 清空历史记录 + clearHis: function() { + var that = this; + wx.removeStorage({ + key: 'wxSearchHisKeys', + success: function(res) { + var value = []; + that.setData({ + wxSearchData: value + }); + } + }) + }, + + // 添加搜索记录 + wxSearchAddHisKey: function (keyword) { + var text = {} + let that = this; + text.name = keyword; + if (typeof(text) == "undefined" || text.length == 0) { + return; + } + var value = wx.getStorageSync('wxSearchHisKeys'); + if (value) { + if (JSON.stringify(value).indexOf(JSON.stringify(text)) < 0) { + if (value.length > 4) { + value.pop(); + } + value.unshift(text); + } + wx.setStorage({ + key: "wxSearchHisKeys", + data: value, + success: function() { + that.getHisKeys(); + } + }) + } else { + value = []; + value.push(text); + wx.setStorage({ + key: "wxSearchHisKeys", + data: value, + success: function() { + that.getHisKeys(); + } + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + } +}) diff --git a/eaterplanet_ecommerce/pages/type/search.json b/eaterplanet_ecommerce/pages/type/search.json new file mode 100644 index 0000000..3bf3d4e --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/search.json @@ -0,0 +1,11 @@ +{ + "navigationBarTitleText": "搜索", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-load-more": "../../components/load-more/index", + "i-img": "../../components/img/index", + "i-type-item": "./type-item" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/search.wxml b/eaterplanet_ecommerce/pages/type/search.wxml new file mode 100644 index 0000000..9249b2a --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/search.wxml @@ -0,0 +1,17 @@ + + + + + + + + + + + + 搜索历史 + + {{item.name}} + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/search.wxss b/eaterplanet_ecommerce/pages/type/search.wxss new file mode 100644 index 0000000..d401c9d --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/search.wxss @@ -0,0 +1,67 @@ +/* eaterplanet_ecommerce/pages/type/search.wxss */ + +.search-bar { + padding: 12rpx 25rpx; + background-color: #fff; +} + +.search-box { + background-color: #f0f0f0; + height: 56rpx; + line-height: 56rpx; + border-radius: 28rpx; + color: #acacac; + display: flex; + align-content: center; +} + +.search-box .ipt { + padding: 0 30rpx 0 60rpx; + line-height: 56rpx; + height: 56rpx; + width: 100%; + box-sizing: border-box; +} + +.search-icon { + position: absolute; + left: 20rpx; + margin-left: 25rpx; + margin-right: 12rpx; +} + +.search-icon .iconfont { + font-size: 34rpx; + padding-top: 10rpx; +} + +.tag-wrap { + margin-top: 16rpx; + padding: 0 30rpx; +} + +.tag-title { + color: #a8a8a8; + font-size: 26rpx; + margin-bottom: 36rpx; + display: flex; + justify-content: space-between; +} + +.icon-del { + font-size: 30rpx; + color: #666; +} + +.tag-list { + display: flex; + flex-wrap: wrap; + color: #666666; +} + +.tag-list .item { + padding: 10rpx 30rpx; + border-radius: 50rpx; + border: 2rpx solid #efefef; + margin-right: 20rpx; +} diff --git a/eaterplanet_ecommerce/pages/type/type-item.js b/eaterplanet_ecommerce/pages/type/type-item.js new file mode 100644 index 0000000..95882c8 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/type-item.js @@ -0,0 +1,5 @@ +var goodsBehavior = require('../../components/behavior/goods.js'); + +Component({ + behaviors: [goodsBehavior] +}); \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/type-item.json b/eaterplanet_ecommerce/pages/type/type-item.json new file mode 100644 index 0000000..5dff914 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/type-item.json @@ -0,0 +1,11 @@ +{ + "component": true, + "usingComponents": { + "i-img": "../../components/img/index", + "i-router-link": "../../components/router-link/router-link", + "i-button": "../../components/button/index", + "i-input-number": "../../components/input-number/index", + "i-vip-price": "../../components/vipPrice/vipPrice", + "i-addcart": "../../components/addCartBtn/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/type/type-item.wxml b/eaterplanet_ecommerce/pages/type/type-item.wxml new file mode 100644 index 0000000..b5391b5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/type-item.wxml @@ -0,0 +1,49 @@ +
+ +
+ diff --git a/eaterplanet_ecommerce/pages/type/type-item.wxss b/eaterplanet_ecommerce/pages/type/type-item.wxss new file mode 100644 index 0000000..22a2c47 --- /dev/null +++ b/eaterplanet_ecommerce/pages/type/type-item.wxss @@ -0,0 +1,309 @@ +.i-btn { + text-align: center; + vertical-align: middle; + touch-action: manipulation; + cursor: pointer; + background-image: none; + white-space: nowrap; + user-select: none; + font-size: 28rpx; + border: 0 !important; + position: relative; + text-decoration: none; + height: 88rpx; + line-height: 88rpx; + background: none; + color: #495060; + border-radius: 0; + margin: 0; + box-shadow: none; +} + +.i-btn::after { + border: none; +} + +.spu { + width: 100%; + display: block; +} + +.spu .img-class { + width: 180rpx; + height: 180rpx; + border-radius: 20rpx 0 0 20rpx; + /**box-shadow: 0 0rpx 10rpx rgba(0,0,0,0.05) ;**/ +} + +.spu .spu-content { + background:linear-gradient(100deg, #cbebfd 0%, #cbebfd 1%, #e5e8eb 100%); + + border-radius: 20rpx; + overflow: hidden; + position: relative; + box-shadow: -10rpx -10rpx 30rpx 5rpx #ffffff,10rpx 10rpx 20rpx 0rpx #4571a1a1; + + margin: 20rpx 20rpx 20rpx 20rpx; + display: flex; + + box-sizing: border-box; +} + +.spu .spu-content::after { + content: ''; + position: absolute; + bottom: 0; + left: 18rpx; + right: 18rpx; + border-bottom: 1rpx solid #e5e5e5; +} + +.spu .spu-content.disabled { + opacity: 0.6; +} + +.spu .spu-content .item-left { + width: 180rpx; + height: 180rpx; + position: relative; +} + +.spu .spu-content .item-right { + flex: 1; + box-sizing: border-box; + margin: 12rpx 16rpx 12rpx 20rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + max-height: 180rpx; +} + +.spu .spu-content .item-right .spu-title { + color: #222; + font-size: 26rpx; + height: 30rpx; + margin-bottom: 6rpx; + margin-top: 10rpx; + font-weight: 400; + position: relative; +} + +.spu .spu-content .item-right .spu-title .span { + width: 100%; + height: 40rpx; + position: absolute; + left: 0; + top: -4rpx; + line-height: 40rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 0; +} + +.spu .spu-content .item-right .spu-desc { + font-size: 22rpx; + line-height: 26rpx; + color: #999; + position: relative; + width: 350rpx; + height: 26rpx; + margin-bottom: 12rpx; +} + +.spu .spu-content .item-right .spu-desc .em { + width: 100%; + height: 32rpx; + position: absolute; + left: 0; + top: -2rpx; + line-height: 32rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.spu .spu-content .add-cart { + width: 68rpx; + height: 68rpx; + padding: 0; + margin: 0; + position: absolute; + right: 28rpx; + bottom: 20rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.spu .spu-content .add-cart .img { + width: 54rpx; + height: 54rpx; + display: block; +} + +.spu .spu-content .item-right .spu-price { + display: flex; + flex-direction: column; + /* align-items: flex-end; */ + font-size: 24rpx; + line-height: 24rpx; + overflow: hidden; + margin-top: 10rpx; +} + +.spu .spu-content .item-right .spu-price .sale-price { + font-family: DIN; + color: #ff758c; + margin-right: 12rpx; +} + +.spu .spu-content .item-right .spu-price .sale-price .span { + font-family: DIN; + font-size: 36rpx; + line-height: 36rpx; + margin: 0; +} + +.spu .spu-content .item-right .spu-price .market-price { + font-family: DIN; + text-decoration: line-through; + color: #999; + margin-right: 30rpx; + margin-top: 5rpx; +} + +.spu .mask { + background: rgba(255, 255, 255, 0.5); + width: 170rpx; + height: 170rpx; + position: absolute; + left: 24rpx; + top: 28rpx; +} + +.spu .act-end { + position: absolute; + height: 60rpx; + border-radius: 10rpx; + background: rgba(0, 0, 0, 0.5); + color: #fff; + font-size: 28rpx; + text-align: center; + line-height: 60rpx; + left: 90rpx; + top: 70rpx; + padding: 0 12rpx; + transform: translateX(-50%); +} + +.spu .tag { + position: absolute; + left: 0; + bottom: 0; + background: linear-gradient(to right,#4facfe,#00f2fe); + border-radius: 0 14rpx 14rpx 0; + padding: 0 12rpx; + height: 30rpx; + font-size: 22rpx; + line-height: 30rpx; + color: #fff; + display: inline-block; + align-items: center; + justify-content: center; + width: auto; + max-width: 180rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + z-index: 1; +} + +.spu .index-input-number { + position: absolute; + right: 0; + bottom: 10rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.spu .index-input-number .iNumberView { + width: 80rpx; + height: 80rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.spu .index-input-number .iNumberView:first-child { + justify-content: flex-end; +} + +.spu .index-input-number .iNumberView:last-child { + justify-content: flex-start; +} + +.spu .index-input-number .iNumberImg { + width: 44rpx; + height: 44rpx; +} + +.spu .index-input-number .input-number-text { + height: 88rpx; + line-height: 88rpx; + font-size: 24rpx; + color: #333; + width: 58rpx; +} + +/* 标签 */ + +.spu .item-tag { + position: absolute; + left: -1rpx; + top: 0; + width: 54rpx; + height: 62rpx; + z-index: 1; + color: #fff; + text-align: center; +} + +.item-tag-bg { + position: absolute; + left: 0; + top: 0; + width: 54rpx; + height: 62rpx; + z-index: 0; +} + +.spu .item-tag .tag-name { + position: relative; + padding-top: 6rpx; + font-size: 20rpx; + line-height: 1; + font-weight: 600; + z-index: 1; +} + +.spu .item-tag .tag-name.two-word { + font-size: 22rpx; + padding-top: 14rpx; +} + +.spu-play { + position: absolute; + left: 50%; + top: 50%; + width: 80rpx; + height: 80rpx; + margin-top: -40rpx; + margin-left: -40rpx; +} + +.spu-play .img { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/articleProtocol.js b/eaterplanet_ecommerce/pages/user/articleProtocol.js new file mode 100644 index 0000000..f5c19d2 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/articleProtocol.js @@ -0,0 +1,110 @@ +// eaterplanet_ecommerce/pages/user/articleProtocol.js +var app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: '' + }, + token: '', + articleId: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let id = options.id || 0; + this.articleId = id; + let about = options.about || 0; + var token = wx.getStorageSync('token'); + this.token = token; + wx.showLoading({ title: '加载中' }); + if (about){ + this.get_about_us(); + }else{ + this.get_article(); + } + }, + + /** + * 获取列表 + */ + get_article: function () { + let that = this; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'article.get_article', + 'token': that.token, + 'id': that.articleId + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + var list = res.data.data; + that.setData({ article: list.content, title: list.title }) + wx.setNavigationBarTitle({ + title: list.title, + }) + } + } + }) + }, + + /** + * 获取列表 + */ + get_about_us: function () { + let that = this; + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'user.get_about_us' + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + var list = res.data.data; + that.setData({ article: list }) + wx.setNavigationBarTitle({ + title: '关于我们' + }) + } + } + }) + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + return { + title: this.data.title, + path: "", + imageUrl: "", + success: function() {}, + fail: function() {} + }; + } +}) diff --git a/eaterplanet_ecommerce/pages/user/articleProtocol.json b/eaterplanet_ecommerce/pages/user/articleProtocol.json new file mode 100644 index 0000000..b0dc7a4 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/articleProtocol.json @@ -0,0 +1,8 @@ +{ + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "parser":"../../components/parser/parser" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/articleProtocol.wxml b/eaterplanet_ecommerce/pages/user/articleProtocol.wxml new file mode 100644 index 0000000..5aeb189 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/articleProtocol.wxml @@ -0,0 +1,6 @@ + + + + + + diff --git a/eaterplanet_ecommerce/pages/user/articleProtocol.wxss b/eaterplanet_ecommerce/pages/user/articleProtocol.wxss new file mode 100644 index 0000000..ac02055 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/articleProtocol.wxss @@ -0,0 +1,8 @@ +.article { + background: #fff; + padding: 20rpx 30rpx; + font-size: 28rpx; + box-sizing: border-box; + + +} diff --git a/eaterplanet_ecommerce/pages/user/charge.js b/eaterplanet_ecommerce/pages/user/charge.js new file mode 100644 index 0000000..aacaf06 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/charge.js @@ -0,0 +1,269 @@ +var app = getApp(); +var util = require('../../utils/util.js'); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + canPay: false, + money: '', + onFocus: false, + accountMoney: 0, + chargetype_list: [], + activeTypeId: '', + recharge_get_money: '', + rewardIdx: -1, + chargeArr: [] + }, + rech_id: 0, + revenue: [], + reward: [], + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getAccountMoney(); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if (!util.check_login()) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + } + }, + + getAccountMoney() { + let token = wx.getStorageSync('token'); + let that = this; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_account_money', + token: token + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let rdata = res.data; + let member_charge_publish = rdata.member_charge_publish; + let chargetype_list = rdata.chargetype_list; + let recharge_get_money = rdata.recharge_get_money || ''; + + let chargeArr = chargetype_list.sort(function (a, b) { + return a.money - b.money; + }); + let revenue = []; + let reward = []; + chargeArr.forEach(item => { + revenue.push(item.money * 1); + reward.push(item.send_money * 1); + }) + that.revenue = revenue; + that.reward = reward; + + let excharge_nav_name = res.data.excharge_nav_name || '详情'; + wx.setNavigationBarTitle({ + title: excharge_nav_name, + }) + + that.setData({ + accountMoney: rdata.data, + chargetype_list, + member_charge_publish, + recharge_get_money, + chargeArr + }) + } else if (res.data.code == 1) { + wx.redirectTo({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + } + } + }) + }, + + getMoney: function (e) { + var val = e.detail.value; + val ? this.setData({ + canPay: true + }) : this.setData({ + canPay: false + }); + let money = val; + let rewardIdx = -1; + if(this.data.recharge_get_money==1) { + rewardIdx = this.canAwardMoney(money); + console.log('rewardIdx', rewardIdx); + } + this.setData({ + money, + rewardIdx + }); + // return money; + }, + + /** + * 获得送金额提示 + */ + canAwardMoney: function (money) { + let revenue = this.revenue; + let reward = this.reward; + //小于最小值 + if (money < Math.min.apply(null, revenue)) { + return -1; + } + if (money >= Math.max.apply(null, revenue)) { + return revenue.length - 1; + } + + let idx = 0, i = 0, j = revenue.length; + for (i; i < j; i++) { + if (revenue[i] > money) { + idx = i; + break; + } + } + return idx-1; + }, + +/** + * 余额充值 + */ +wxcharge: function (sendMoney = 0) { + let oriMoney = 0; + if (sendMoney > 0) { + oriMoney = sendMoney; + } else { + oriMoney = this.data.money; + var reg = /^\d+(\.\d+)?$/; + if (!reg.test(oriMoney)) { + wx.showToast({ + title: '请输入正确的金额', + icon: 'none' + }) + return false; + } + } + let money = parseFloat(oriMoney).toFixed(2) || 0; + let token = wx.getStorageSync('token'); + let that = this; + + that.data.canPay && app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'car.wxcharge', + token: token, + money: money, + rech_id: that.rech_id + }, + dataType: 'json', + success: function (res) { + wx.requestPayment({ + "appId": res.data.appId, + "timeStamp": res.data.timeStamp, + "nonceStr": res.data.nonceStr, + "package": res.data.package, + "signType": res.data.signType, + "paySign": res.data.paySign, + 'success': function (wxres) { + that.setData({ + canPay: false, + activeTypeId: 0 + }) + that.getAccountMoney(); + that.rech_id = 0; + wx.showToast({ + icon: 'none', + title: '充值成功', + }) + setTimeout(() => { + wx.reLaunch({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + }, 2000) + }, + 'fail': function (error) { + if (that.rech_id > 0) that.setData({ + canPay: false, + activeTypeId: 0 + }), that.rech_id = 0; + wx.showToast({ + icon: 'none', + title: '充值失败,请重试!', + }) + } + }) + } + }) +}, + +/** + * 获得焦点 + */ +bindIptFocus: function () { + this.rech_id = 0; + this.setData({ + onFocus: true, + activeTypeId: 0, + money: '', + canPay: false + }) +}, + +/** + * 失去焦点 + */ +bindIptBlur: function () { + this.setData({ + onFocus: false + }) +}, + +goCharge: function (e) { + let that = this; + let chargetype_list = this.data.chargetype_list; + let idx = e.currentTarget.dataset.idx; + let rech_id = chargetype_list[idx].id; + let money = chargetype_list[idx].money; + this.rech_id = rech_id; + this.setData({ + canPay: true + }, () => { + that.wxcharge(money); + }) +}, + +selChargeType: function (e) { + let that = this; + let chargetype_list = this.data.chargetype_list; + let idx = e.currentTarget.dataset.idx; + let activeTypeId = chargetype_list[idx].id || 0; + let money = chargetype_list[idx].money; + this.rech_id = activeTypeId; + that.setData({ + activeTypeId, + money, + canPay: true + }) +} +}) diff --git a/eaterplanet_ecommerce/pages/user/charge.json b/eaterplanet_ecommerce/pages/user/charge.json new file mode 100644 index 0000000..5acf143 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/charge.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "详情", + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "parser":"../../components/parser/parser" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/charge.wxml b/eaterplanet_ecommerce/pages/user/charge.wxml new file mode 100644 index 0000000..d6074df --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/charge.wxml @@ -0,0 +1,38 @@ + + + + + 余额: + 明细 + + {{accountMoney}} + + + + 金额: + + + + {{item.money}}元 + 充{{item.money}}送{{item.send_money}} + + + + + + + + + + + 充值满{{chargeArr[rewardIdx].money}}元,赠送{{chargeArr[rewardIdx].send_money}}元 + + + 确认 + + 说明: + + + + + diff --git a/eaterplanet_ecommerce/pages/user/charge.wxss b/eaterplanet_ecommerce/pages/user/charge.wxss new file mode 100644 index 0000000..4f907df --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/charge.wxss @@ -0,0 +1,130 @@ +.charge-form { + padding: 30rpx; + background-color: #fff; +} + +.tit { + font-size: 32rpx; + color: #000; + margin-bottom: 30rpx; + display: flex; + justify-content: space-between; + align-items: baseline; +} + +.charge-yue { + font-family: DIN; + color: #ff758c; + font-size: 60rpx; +} + +.details { + margin-left: 20rpx; + font-size: 26rpx; + color: rgb(59,140,232); +} + +.flex-ipt { + position: relative; + display: flex; + font-size: 40rpx; + color: #000; + justify-content: center; + align-content: center; + overflow: hidden; +} + +.flex-ipt .money { + font-size: 30rpx; + flex: 1; + padding: 20rpx 0; + border-bottom: 2rpx solid #ececec; +} + +.flex-ipt .bottom-line { + position: absolute; + bottom: 0; + left: 0; + width: 0; + height: 4rpx; + background-color: rgb(59,140,232); + transition: 200ms all ease-in; + +} + +.flex-ipt .bottom-line.ipt-focus { + width: 100%; +} + +.btn { + margin: 50rpx 30rpx; + background-color: #4facfe; + color: #fff; + text-align: center; + line-height: 88rpx; + font-size: 30rpx; + border-radius: 10rpx; +} + +.btn.disable { + background-color: linear-gradient(100deg,#4facfe 0%,#00f2fe 100%); +} + +.desc { + padding: 0 30rpx; + line-height: 1.6; + font-size: 26rpx; + color: #666; +} + +.desc .h2 { + font-size: 30rpx; + margin-bottom: 10rpx; +} + +.list { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + margin: 30rpx 0; +} + +.list-item { + width: 30%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + border: 1rpx solid rgb(59,140,232); + border-radius: 5px; + height: 110rpx; + background-color: transparent; + line-height: initial; + box-sizing: initial; + padding: 0; + margin: 0 0 24rpx; +} + +.list-item_empty { + height: 0; + width: 30%; +} + +.item-tit { + color: #408ce2; + font-size: 32rpx; +} + +.item-subtit { + color: #7dbdf8; + font-size: 22rpx; +} + +.item-hover { + background-color: rgb(59,140,232); +} + +.item-hover .item-tit, +.item-hover .item-subtit { + color: #fff; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/coupon.js b/eaterplanet_ecommerce/pages/user/coupon.js new file mode 100644 index 0000000..a0310b9 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/coupon.js @@ -0,0 +1,148 @@ +var util = require('../../utils/util.js'); +var app = getApp(); + +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + is_login: true, + tab_index: 1, + isHideLoadMore: true, + no_order: 0, + quan: [], + loadText: '加载中' + }, + page: 1, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + util.check_login() ? this.setData({is_login: true}) : this.setData({is_login: false}); + this.getData(); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + wx.reLaunch({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + }, + + tabchange: function (e) { + var index = e.currentTarget.dataset.index; + this.page = 1; + this.setData({ + quan: [], + tab_index: index + }) + this.getData(); + }, + + getData: function () { + this.setData({ + isHideLoadMore: true + }) + wx.showLoading(); + this.data.no_order = 1 + var page = this.page; + var tab_index = this.data.tab_index; + var token = wx.getStorageSync('token'); + var self = this; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.myvoucherlist', + token: token, + type: tab_index, + page: page, + pre_page: 5, + + }, + dataType: 'json', + method: 'POST', + success: function (data) { + wx.hideLoading(); + if (data.data.code == 0) { + var agoData = self.data.quan; + var goods = data.data.list; + goods.map(function (good) { + agoData.push(good); + }); + self.setData({ + quan: agoData, + no_order: 0 + }); + } else { + self.setData({ + isHideLoadMore: true + }) + return false; + } + } + }) + }, + + goUse: function (e) { + let idx = e.currentTarget.dataset.idx; + let quan = this.data.quan || []; + if (quan.length>=idx) { + if(quan[idx].is_limit_goods_buy==0) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index', + }) + } else if (quan[idx].is_limit_goods_buy == 1) { + let id = quan[idx].limit_goods_list; + let ids = id.split(','); + let url = ''; + if(ids.length>1) { + url = '/eaterplanet_ecommerce/pages/type/result?type=2&good_ids=' + id; + } else { + url = '/eaterplanet_ecommerce/pages/goods/goodsDetail?id=' + id; + } + wx.navigateTo({ url: url }) + } else if (quan[idx].is_limit_goods_buy == 2) { + let gid = quan[idx].goodscates || 0; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/pages/type/result?type=1&gid=' + gid, + }) + } + } + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if (this.data.no_order == 1) return false; + this.page += 1; + this.getData(); + this.setData({ + isHideLoadMore: false + }) + } +}) diff --git a/eaterplanet_ecommerce/pages/user/coupon.json b/eaterplanet_ecommerce/pages/user/coupon.json new file mode 100644 index 0000000..4f28897 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/coupon.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "我的优惠券", + "navigationBarBackgroundColor": "#FFF", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-load-more": "../../components/load-more/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/coupon.wxml b/eaterplanet_ecommerce/pages/user/coupon.wxml new file mode 100644 index 0000000..b61e9f5 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/coupon.wxml @@ -0,0 +1,52 @@ + + + + + + + + + + 未使用 + + + 已使用/已过期 + + + + + + + + + + + {{item.credit}} + + {{item.limit_money >0.01 ?'满'+item.limit_money+'元可用':'不限制'}} + + + {{item.tag}} {{item.voucher_title}} + 使用范围:所有商品 + 使用范围:指定商品 + 使用范围:指定分类 + + + 去使用 + + + + + + 邀新奖励 + 有效期:{{item.begin_time}}~{{item.end_time}} + + + + + 暂无任何记录~ + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/coupon.wxss b/eaterplanet_ecommerce/pages/user/coupon.wxss new file mode 100644 index 0000000..2e4ce26 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/coupon.wxss @@ -0,0 +1,355 @@ +.tabs { + box-sizing: border-box; + position: relative; + overflow: hidden; + zoom: 1; + color: #666; +} + +.tabs:after, .tabs:before { + content: " "; + display: table; +} + +.tabs:after { + clear: both; + visibility: hidden; + font-size: 0; + height: 0; +} + +.tabs-bar { + outline: none; + width: 100%; + background-color: #fff; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10; +} + +.tabs-link-bar { + z-index: 1; + position: absolute; + left: 0; + bottom: 2rpx; + box-sizing: border-box; + height: 2rpx; + background-color: #4facfe; + transition: transform 0.3s cubic-bezier(0.645,0.045,0.355,1); + transform-origin: 0 0; +} + +.tabs-bar { + border-bottom: 1px solid #d9d9d9; + box-sizing: border-box; +} + +.tabs-nav--container { + overflow: hidden; + font-size: 14rpx; + line-height: 1.5; + box-sizing: border-box; + position: relative; + white-space: nowrap; + margin-bottom: -1px; + zoom: 1; +} + +.tabs-nav--container:after, .tabs-nav--container:before { + content: " "; + display: table; +} + +.tabs-nav--container:after { + clear: both; + visibility: hidden; + font-size: 0; + height: 0; +} + +.tabs-tab-btn-disabled { + cursor: not-allowed; +} + +.tabs-tab-btn-disabled, .tabs-tab-btn-disabled:hover { + color: #ccc; +} + +.tabs-nav--wrap { + overflow: hidden; + margin-bottom: -1rpx; +} + +.tabs-nav { + display: flex; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding-left: 0; + transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1); + position: relative; + margin: 0; + list-style: none; +} + +.tabs-nav:after, .tabs-nav:before { + display: table; + content: " "; +} + +.tabs-nav:after { + clear: both; +} + +.tabs-nav .tabs-tab-disabled { + pointer-events: none; + cursor: default; + color: #ccc; +} + +.tabs-nav .tabs-tab { + flex: 1; + display: block; + height: 90rpx; + line-height: 90rpx; + margin: 0 12rpx; + box-sizing: border-box; + position: relative; + transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + cursor: pointer; + text-decoration: none; + text-align: center; + font-size: 30rpx; + color: #333; +} + +.tabs-nav .tabs-tab:active { + color: #4facfe; +} + +.tabs-nav .tabs-tab .anticon { + width: 14rpx; + height: 14rpx; + margin-right: 8rpx; +} + +.tabs-nav .tabs-tab-active { + color: #4facfe; +} + +.tabs-nav .tabs-tab-active::after { + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 3px; + background: linear-gradient(90deg,#4facfe 0%,#00f2fe 100%); + box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(255,89,0,0.25); + border-radius: 24rpx; +} + +.tabs.tabs-card>.tabs-bar .tabs-link-bar { + visibility: hidden; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab { + margin: 0; + border: 1px solid #d9d9d9; + border-bottom: 0; + border-radius: 6rpx 6rpx 0 0; + transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + background: #f9f9f9; + margin-right: 2rpx; +} + +.tabs.tabs-card>.tabs-bar .tabs-tab-active { + background: #fff; + transform: translateZ(0); + border-color: #d9d9d9; + color: #4facfe; +} + +.tabs.tabs-card>.tabs-bar .tabs-nav--wrap { + margin-bottom: 0; +} + +.empty-wrap { + padding-top: 300rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.empty-wrap .empty-img { + width: 218rpx; + height: 218rpx; +} + +.empty-wrap .empty-txt { + font-size: 30rpx; + font-weight: 400; + color: #777; + margin-top: 32rpx; +} + +/* 新优惠券 */ + +.list { + padding: 90rpx 30rpx 20rpx; +} + +/* 新优惠券 */ + +.coupon { + background-color:#ff7eb3; + position: relative; + padding: 0 20rpx; + border-radius: 6rpx; + margin-top: 24rpx; +} + +.coupon:before, .coupon:after { + content: ''; + position: absolute; + width: 20rpx; + height: 40rpx; + background: #f6f6f6; + top: 70rpx; + z-index: 1; +} + +.coupon:before { + border-radius: 0 40rpx 40rpx 0; + left: 0; +} + +.coupon:after { + border-radius: 40rpx 0 0 40rpx; + right: 0; +} + +.coupon .header { + display: flex; + padding: 15rpx 0; + border-bottom: 2rpx dashed #fff; + height: 140rpx; +} + +.coupon .footer { + color: #fff; + font-size: 24rpx; + padding: 22rpx 0 20rpx 0; +} + +.coupon .price { + color: #fff; + width: 175rpx; + text-align: center; + border-right: 2rpx dashed #fff; +} + +.coupon .price .reduce-price { + color: #fff; + font-size: 38rpx; + font-weight: bold; + padding-top: 30rpx; +} + +.coupon .price .reduce-price text { + font-size: 24rpx; +} + +.coupon .price .reduce-desc { + font-size: 20rpx; + margin-top: 10rpx; +} + +.coupon .info { + padding-left: 30rpx; + flex: 1; +} + +.coupon .info .reduce-title { + color: #000; + font-size: 28rpx; + font-weight: bold; + padding-top: 20rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; +} + +.coupon .info .reduce-type { + color: #fff; + font-weight: normal; + font-size: 20rpx; + background: #4facfe; + padding: 2rpx 8rpx; + border-radius: 4rpx; +} + +.coupon .status { + width: 130rpx; + text-align: center; +} + +.coupon .status image { + width: 90rpx; + height: 90rpx; + margin-top: 20rpx; +} + +.coupon.used, +.coupon.expired { + background: #fafafa; +} + +.coupon.used .price, +.coupon.expired .price { + color: #949494; +} + +.coupon.used .reduce-price, +.coupon.expired .reduce-price, +.coupon.used .reduce-title, +.coupon.expired .reduce-title { + color: #7a7a7a; +} + +.coupon.used .reduce-type, +.coupon.expired .reduce-type { + background: #eeaea6; +} + +.coupon.used .footer, +.coupon.expired .footer { + color: #b6b6b6; +} + +.reduce-area { + font-size: 24rpx; + color: #fff; + margin-top: 10rpx; +} + +.go-shop { + background:#ff758c; + border: 1rpx solid #fff; + border-radius: 30rpx; + color: #fff; + font-size: 24rpx; + margin-top: 60rpx; + margin-right: 12rpx; + line-height: 38rpx; +} + +.footer-tag { + font-size: 20rpx; + border-radius: 5rpx; + color: #fff; + padding: 2rpx 5rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/me.js b/eaterplanet_ecommerce/pages/user/me.js new file mode 100644 index 0000000..27f7def --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/me.js @@ -0,0 +1,623 @@ +//index.js +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var wcache = require('../../utils/wcache.js'); +var app = getApp() +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +const defaultAvatarUrl2 = 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132' +const height = wx.getSystemInfoSync().windowHeight +Page({ + mixins: [require('../../mixin/globalMixin.js')], + data: { + height: height, + statusBarHeight: app.globalData.statusBarHeight + 44 + 'px', + searchBarHeight: app.globalData.statusBarHeight + 'px', + rushboxHeight: app.globalData.statusBarHeight + 200 + 'px', + tablebar: 4, + canIUse: wx.canIUse("getUserProfile"), + theme_type: '', + add_mo: 0, + is_show_on: 0, + level_name: '', + member_level_is_open: 0, + is_yue_open: 0, + needAuth: false, + opencommiss: 0, + inputValue: 0, + getfocus: false, + showguess: true, + items: [], + auditStatus: 5, + isShowCoder: false, + myCoderList: [], + qrcodebase64: "", + setInter: null, + copyright: '', + common_header_backgroundimage: '', + enabled_front_supply: 0, + cartNum: 0, + is_show_about_us: 0, + groupInfo: { + group_name: '社区', + owner_name: '团长' + }, + is_show_score: 0, + showGetPhone: false, + user_tool_icons: {}, + community: '', + showUserProfile: false, + }, + isCalling: false, + $data: { + statusBarHeight: app.globalData.statusBarHeight + 44, + top: 0, + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.hideTabBar(); + let that = this; + status.setNavBgColor(); + status.setGroupInfo().then((groupInfo) => { + that.setData({ groupInfo }) + }); + wx.showLoading(); + }, + + getMemberInfo: function () { + var token = wx.getStorageSync('token'); + this.getCommunityInfo(); + + let that = this; + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'user.get_user_info', + token: token + }, + + dataType: 'json', + success: function (res) { + // wx.hideLoading(); + setTimeout(function () { wx.hideLoading(); }, 1000); + if (res.data.code == 0) { + let showGetPhone = false; + if (res.data.is_show_auth_mobile == 1 && !res.data.data.telephone) showGetPhone = true; + let member_info = res.data.data || ''; + let params = {}; + let invalidAvatars = [defaultAvatarUrl, defaultAvatarUrl2, "", "undefined"]; + let invalidUsernames = ["微信用户", "", "undefined"]; + if (invalidAvatars.includes(member_info.avatar)&&invalidUsernames.includes(member_info.username)&&!showGetPhone) { + that.setData({ showUserProfile: true }); + } + if (member_info) { + member_info.member_level_info && (member_info.member_level_info.discount = (member_info.member_level_info.discount / 10).toFixed(1)); + //开启分销 + if (res.data.commiss_level > 0) { + //还差多少人升级 + let commiss_share_member_update = res.data.commiss_share_member_update * 1; + let share_member_count = res.data.share_member_count * 1; + let need_num_update = res.data.commiss_share_member_update * 1 - res.data.share_member_count * 1; + + //判断表单状态状态 + let formStatus = 0; //未填写 1 已填写未审核 2 已审核 + if (member_info.is_writecommiss_form == 1) { + formStatus = 1; + //已填写 + if (member_info.comsiss_flag == 1) { + member_info.comsiss_state == 0 ? formStatus = 1 : formStatus = 2; + } + } + + params = { + formStatus, + commiss_level: res.data.commiss_level, + commiss_sharemember_need: res.data.commiss_sharemember_need, + commiss_share_member_update, + commiss_biaodan_need: res.data.commiss_biaodan_need, + share_member_count, + today_share_member_count: res.data.today_share_member_count, + yestoday_share_member_count: res.data.yestoday_share_member_count, + need_num_update + }; + } + } else { + params.needAuth = true; + } + + let { + is_supply, + is_open_vipcard_buy, + modify_vipcard_name, + is_vip_card_member, + modify_vipcard_logo, + isopen_signinreward, + show_signinreward_icon, + is_open_supplymobile, + needAuth, + show_user_tuan_mobile, + is_localtown_distributionman, + user_tool_showtype, + isopen_presale, + is_open_invite_invitation, + virtualcard_name_modify, + is_open_virtualcard_show, + isopen_admin_managefront, + isopen_virtualcard + } = res.data; + that.setData({ + ...params, + member_info, + is_supply: is_supply || 0, + showGetPhone: showGetPhone, + is_open_vipcard_buy: is_open_vipcard_buy || 0, + modify_vipcard_name: modify_vipcard_name || "会员", + is_vip_card_member: is_vip_card_member || 0, + modify_vipcard_logo, + show_signinreward_icon, + isopen_signinreward, + is_open_supplymobile, + needAuth, + show_user_tuan_mobile, + is_localtown_distributionman, + user_tool_showtype: user_tool_showtype || 0, + isopen_presale: isopen_presale || 0, + is_open_invite_invitation, + virtualcard_name_modify: virtualcard_name_modify || 0, + is_open_virtualcard_show: is_open_virtualcard_show || 0, + isopen_admin_managefront, + isopen_virtualcard: isopen_virtualcard || 0 + }); + } else { + //needAuth + that.setData({ + needAuth: true + }) + wx.setStorage({ + key: "member_id", + data: null + }) + } + } + }) + }, + + getCommunityInfo: function () { + let that = this; + let community = wx.getStorageSync('community'); + if (community && community.headDoorphoto) { + if (!community.head_mobile) { + util.getCommunityById(community.communityId).then(res => { + let head_mobile = res.data.disUserMobile || res.data.head_mobile; + head_mobile && (res.data.hideTel = util.filterTel(head_mobile)); + that.setData({ community: res.data }) + }) + } else { + let head_mobile = community.disUserMobile || community.head_mobile; + head_mobile && (community.hideTel = util.filterTel(head_mobile)); + that.setData({ community }) + } + } else { + var token = wx.getStorageSync('token'); + token && util.getCommunityInfo().then(res => { + let head_mobile = res.disUserMobile || res.head_mobile; + head_mobile && (res.hideTel = util.filterTel(head_mobile)); + that.setData({ community: res }) + }) + } + }, + + getCopyright: function () { + let that = this; + app.util.request({ + 'url': 'entry/wxapp/user', + 'data': { + controller: 'user.get_copyright' + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let rdata = res.data; + let { + enabled_front_supply, + is_open_yue_pay, + is_show_score, + user_order_menu_icons, + close_community_apply_enter, + user_tool_icons, + ishow_user_loginout_btn, + commiss_diy_name, + supply_diy_name, + user_service_switch, + fetch_coder_type, + show_user_pin, + common_header_backgroundimage, + is_show_about_us, + show_user_change_comunity, + show_user_change_comunity_map, + open_danhead_model, + default_head_info, + is_open_solitaire, + user_top_font_color, + excharge_nav_name, + hide_community_change_btn, + hide_community_change_word, + close_community_index + } = rdata; + + let h = {}; + if (open_danhead_model == 1) { + let hideTel = (default_head_info.head_mobile && util.filterTel(default_head_info.head_mobile)) || ''; + default_head_info.hideTel = hideTel; + h.community = default_head_info; + wx.setStorageSync('community', default_head_info); + } + + commiss_diy_name = commiss_diy_name || '分销'; + supply_diy_name = supply_diy_name || '商户'; + wcache.put('commiss_diy_name', commiss_diy_name); + wcache.put('supply_diy_name', supply_diy_name); + + that.setData({ + copyright: rdata.data || '', + common_header_backgroundimage: common_header_backgroundimage || '', + is_show_about_us: is_show_about_us || 0, + enabled_front_supply, + is_open_yue_pay, + is_show_score, + user_order_menu_icons: user_order_menu_icons || {}, + commiss_diy_name, + close_community_apply_enter: close_community_apply_enter || 0, + user_tool_icons: user_tool_icons || {}, + ishow_user_loginout_btn: ishow_user_loginout_btn || 0, + supply_diy_name, + user_service_switch, + fetch_coder_type: fetch_coder_type || 0, + show_user_pin, + show_user_change_comunity, + show_user_change_comunity_map, + open_danhead_model, + is_open_solitaire, + user_top_font_color, + excharge_nav_name: excharge_nav_name || '查看', + hide_community_change_btn: hide_community_change_btn || 0, + hide_community_change_word: hide_community_change_word || 0, + close_community_index, + ...h + }) + } + } + }) + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + let that = this; + wx.showLoading(); + that.setData({ needAuth: false, showAuthModal: false, tabbarRefresh: true, showUserProfile: false }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + that.getMemberInfo(); + }, + authModal: function () { + + if (this.data.needAuth) { + this.setData({ showAuthModal: !this.data.showAuthModal }); + return false; + } + return true; + }, + + modalProfile: function () { + this.getMemberInfo(); + if (!this.data.needAuth) { + this.setData({ showUserProfile: !this.data.showUserProfile }); + return false; + } + return true; + }, + + /** + * 跳转团长中心 + */ + goToGroup: function () { + 5 === this.data.auditStatus ? wx.navigateTo({ + url: "/eaterplanet_ecommerce/moduleA/groupCenter/index" + }) : wx.navigateTo({ + url: "/eaterplanet_ecommerce/moduleA/groupCenter/apply" + }); + }, + + /** + * 更新资料,转手动更新头像&昵称 + */ + bindGetUserInfo: function (e) { + let that = this; + wx.getUserProfile({ + desc: "获取你的昵称、头像、地区及性别", + success: function (msg) { + var userInfo = msg.userInfo; + var userInfo = Object.assign({}, wx.getStorageSync("userInfo"), { + avatarUrl: userInfo.avatarUrl, + nickName: userInfo.nickName + }); + let { nickName, avatarUrl } = userInfo; + app.globalData.userInfo = userInfo, wx.setStorage({ + key: "userInfo", + data: userInfo + }), that.setData({ + userInfo: userInfo + }), wx.showToast({ + title: "资料已更新", + icon: "none", + duration: 2000 + }), nickName && app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: 'user.update_user_info', + token: wx.getStorageSync("token"), + nickName, + avatarUrl + }, + dataType: 'json', + success: function (res) { + if (res.data.code == 0) { + let member_info = that.data.member_info; + let user_info = Object.assign({}, member_info, { + avatar: userInfo.avatarUrl, + username: userInfo.nickName + }); + that.setData({ + member_info: user_info + }) + } + } + }) + }, + fail: () => { + wx.showToast({ + title: "资料更新失败。", + icon: "none" + }); + } + }) + }, + + /** + * 预览图片 + */ + previewImage: function (e) { + var current = e.currentTarget.dataset.src; + current && wx.previewImage({ + current: current, + urls: [current] + }) + }, + + goLink2: function (event) { + + if (!this.authModal()) return; + let link = event.currentTarget.dataset.link; + + var pages_all = getCurrentPages(); + if (pages_all.length > 3) { + wx.redirectTo({ + url: link + }) + } else { + wx.navigateTo({ + url: link + }) + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + util.check_login_new().then((res) => { + console.log(res) + if (res) { + that.setData({ tabbarRefresh: true }); + (0, status.cartNum)('', true).then((res) => { + res.code == 0 && that.setData({ + cartNum: res.data + }) + }); + } else { + that.setData({ needAuth: true }); + wx.hideLoading(); + } + }) + that.getCopyright(); + that.getMemberInfo(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + this.setData({ + tabbarRefresh: false + }) + }, + + /** + * 设置手机号 + */ + getReceiveMobile: function (e) { + wx.showToast({ + icon: 'none', + title: '授权成功', + }) + this.setData({ + showGetPhone: false + }); + }, + + /** + * 关闭手机授权 + */ + close: function () { + this.setData({ + showGetPhone: false + }); + }, + + /** + * 关闭分销 + */ + closeDistribution: function () { + this.setData({ + showDistribution: false + }) + }, + + /** + * 分销下一步 + */ + goDistribution: function () { + let member_info = this.data.member_info; + //判断是不是分销商 + if (member_info.comsiss_flag == 0) { + this.distributionNext(); + } else { + if (member_info.comsiss_state == 0) { + //分销商未审核 + this.distributionNext(); + } else { + //分销商已审核 + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/me', + }) + } + } + }, + + distributionNext: function () { + if (this.data.commiss_sharemember_need == 1) { + console.log('需要分享'); + let url = '/eaterplanet_ecommerce/distributionCenter/pages/recruit'; + wx.navigateTo({ + url + }) + } else if (this.data.commiss_biaodan_need == 1) { + console.log('需要表单'); + // let url = '/eaterplanet_ecommerce/pages/distribution/apply'; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/recruit', + }) + } else { + // 跳转表单自动审核 + let status = 0; + let member_info = this.data.member_info; + if (member_info.comsiss_flag == 1) { + member_info.comsiss_state == 0 ? status = 1 : status = 2; + } + let url = '/eaterplanet_ecommerce/distributionCenter/pages/recruit'; + if (status == 2) { + url = '/eaterplanet_ecommerce/distributionCenter/pages/me'; + } + wx.navigateTo({ + url + }) + } + }, + + goNext: function (e) { + console.log(e) + let status = 0; + let member_info = this.data.member_info; + if (member_info.comsiss_flag == 1) { + member_info.comsiss_state == 0 ? status = 1 : status = 2; + } + let type = e.currentTarget.dataset.type; + if (type == 'share') { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/share', + }) + } else if (type == 'commiss') { + if (status == 2) { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/me', + }) + } else { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/recruit', + }) + } + } else if (type == 'form') { + if (status == 2) { + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/me', + }) + } else { + // let url = '/eaterplanet_ecommerce/pages/distribution/apply'; + wx.navigateTo({ + url: '/eaterplanet_ecommerce/distributionCenter/pages/recruit', + }) + } + } + }, + + loginOut: function () { + wx.removeStorageSync('community'); + wx.removeStorage({ + key: 'token', + success(res) { + wx.reLaunch({ + url: '/eaterplanet_ecommerce/pages/user/me', + }) + } + }) + }, + + toggleFetchCoder: function () { + if (!this.authModal()) return; + this.setData({ + isShowCoder: !this.data.isShowCoder + }) + }, + + /** + * 拨打电话 + */ + callTelphone: function (e) { + var that = this; + var phoneNumber = e.currentTarget.dataset.phone; + if (phoneNumber) { + this.isCalling || (this.isCalling = true, wx.makePhoneCall({ + phoneNumber: phoneNumber, + complete: function () { + that.isCalling = false; + } + })); + } + }, + + /** + * 查看地图 + */ + gotoMap: function () { + let community = this.data.community; + let postion = { lat: community.lat, lon: community.lon }; + let longitude = parseFloat(postion.lon), + latitude = parseFloat(postion.lat), + name = community.disUserName, + address = `${community.fullAddress}(${community.communityName})`; + wx.openLocation({ + latitude: latitude, + longitude: longitude, + name: name, + address: address, + scale: 28 + }) + }, +}) diff --git a/eaterplanet_ecommerce/pages/user/me.json b/eaterplanet_ecommerce/pages/user/me.json new file mode 100644 index 0000000..6d5f40b --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/me.json @@ -0,0 +1,15 @@ +{ + "navigationBarTitleText": "个人中心", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "ep-modal-userProfile": "../../components/modal-userProfile", + "i-tabbar": "../../components/tabbar/index", + "component-modal": "../../components/modal/index", + "i-fetch-coder": "../../components/fetch-coder/index", + "i-modal": "../../components/modal/index", + "i-get-phone": "../../components/get-phone/index", + "i-new-auth": "../../components/new-auth/index", + "ad-alert": "../../components/ad-alert/index", + "advimg": "../../components/advimg/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/me.wxml b/eaterplanet_ecommerce/pages/user/me.wxml new file mode 100644 index 0000000..960904a --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/me.wxml @@ -0,0 +1,665 @@ + + + + 提货码 + + + + + + + + + + + + + + + + {{member_info.username}} + + + + 用户ID: {{member_info.member_id}} + + + + + {{member_info.member_level_info.level_name}} + + + 享受{{member_info.member_level_info.discount}}折 + + + + + + 点击登录账户 + + + + 积分签到 + + + + + + + + + + + + “{{modify_vipcard_name}}” 尊享特权·会员专享价 + + 立即开通 + 立即查看 + 已到期,立即续费 + + + + + + + + + + + + 我的订单 + + 查看全部订单 + + + + + + {{member_info.wait_pay_count}} + + 待付款 + + + {{member_info.wait_send_count}} + + 待配送 + + + {{member_info.wait_get_count}} + + 待提货 + + + + 已提货 + + + + 售后服务 + + + + + + + + + + + + + + + + + + + + + + + 我的粉丝 + + 查看 + + + + {{share_member_count}} + + {{today_share_member_count}} + 今日新增 + + + {{yestoday_share_member_count}} + 昨日新增 + + + + + 分享{{need_num_update}}位新粉丝可升级为{{commiss_diy_name}} + + + 差一步就成为{{commiss_diy_name}}人员啦! + 恭喜你填写成功,等待审核! + 恭喜你成为{{commiss_diy_name}}人员! + + + 差一步就成为{{commiss_diy_name}}人员啦! + 恭喜你填写成功,等待审核! + 恭喜你成为{{commiss_diy_name}}人员! + + 立即分享 + 进入{{commiss_diy_name}}中心 + + 立即升级 + + + 进入{{commiss_diy_name}}中心 + + + + + + + + {{commiss_diy_name}}中心 + + + + + + + + + + + + + + 我的当前自提点 + + + + + 切换 + + + + + + + + + + + {{community.communityName}} + + {{community.fullAddress}} + + + 电话: + + {{community.head_mobile||community.disUserMobile}} + {{community.hideTel}} + + + + 路线 + + + + + + + + + + + + + + + 我的拼团 + + + + + 拼团收益 + + + + + + + + + + + 配送员中心 + + + + + + + + + + + + 余额: ¥{{member_info.account_money||0}} + + + {{excharge_nav_name}} + + + + + + + + + 我的接龙 + + + + + + + + 到店核销 + + + + + + + + + 积分 + + + 立即签到 + + + + + + + + + 积分 + + + + + + + + + 优惠券 + + + + + + + + 核销管理 + + + + + + + + + {{groupInfo.owner_name}}中心 + + + + + + + + {{groupInfo.owner_name}}审核中 + + + + + + + + + + + + 申请成为{{groupInfo.owner_name}} + + + + + + + + + + + + + {{supply_diy_name}}中心 + + + + + + + + + + + + 申请成为{{supply_diy_name}} + + + + + + + + + {{supply_diy_name}}审核中 + + + + + + + + {{supply_diy_name}}中心 + + + + + + + 您已是{{supply_diy_name}} + + + + + + + + + 预售中心 + + + + + + + + 邀新有礼 + + + + + + + + {{virtualcard_name_modify}} + + + + + + + + 常见帮助 + + + + + + + + + 关于我们 + + + + + + + + 平台管理 + + + + + + + + 卡密充值 + + + + + + + + + 退出登录 + + + + + + + + + + + + + 余额 + + + + + + 我的接龙 + + + + + + 到店核销 + + + + + + + 积分 + + + + + + 积分 + + + + + + + 优惠券 + + + + + + 核销管理 + + + + + + + {{groupInfo.owner_name}}中心 + + + + + + {{groupInfo.owner_name}}审核中 + + + + + + + 申请成为{{groupInfo.owner_name}} + + + + + + + + {{supply_diy_name}}中心 + + + + + + + 申请成为{{supply_diy_name}} + + + + + + {{supply_diy_name}}审核中 + + + + + + {{supply_diy_name}}中心 + + + + 您已是{{supply_diy_name}} + + + + + + + 预售中心 + + + + + + 邀新有礼 + + + + + + {{virtualcard_name_modify}} + + + + + + 常见帮助 + + + + + + + 关于我们 + + + + + + 平台管理 + + + + + + 卡密充值 + + + + + + 退出登录 + + + + + + + + + 登录后显示 + + + + 向{{groupInfo.owner_name}}出示二维码提货 + + + + + + + + {{copyright}} + + + + + + + 开发&著作权所有:蒂佳芙科技(云南)有限公司\n©2023 DEJAVU.Tech ALL RIGHTS RESERVED. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/me.wxss b/eaterplanet_ecommerce/pages/user/me.wxss new file mode 100644 index 0000000..b99b137 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/me.wxss @@ -0,0 +1,915 @@ +@import "/eaterplanet_ecommerce/resource/css/vip.wxss"; +page { + background-color: #121b24; + } + +.personal { + width: 100%; + /**background: #4facfe;**/ + position: relative; + overflow: hidden; + border-radius: 0px 0px 0px 0px; +} + +.personal .basicInform { + width: 100%; + height: 240rpx; +} + +.personal .basicInform .back-img { + width: 800rpx; + height: 363rpx; + opacity: 0.5; + margin:30rpx 0 0 20rpx; +} + +.personal .basicInform .modify { + width: 34rpx; + height: 30rpx; + line-height: 30rpx; + margin-left: 10rpx; + font-size: 22rpx; + border: none; + background: transparent; + padding: 0; + color: #fff; +} + +.personal .basicInform .modify::after { + border: none; +} +.mecenter { + position: relative; + width: 100%; + border-radius: 30px 30px 30px 30px; + margin: -180rpx 0 0 0rpx; + background: #fff; + + box-shadow: 0 0rpx 40rpx rgba(0,0,0,0.1); +} + +.personal .order { + position: relative; + margin: 20rpx 30rpx 20rpx 30rpx; + z-index: 3; + +} + +.personal .order .my-order { + margin-bottom: 20rpx; + background:linear-gradient(270deg,#2e3440 0%,#1d252f 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 22rpx 22rpx; + align-items: center; + overflow: hidden; + justify-content: space-between; +} + +.personal .order .my-order .my-order-title { + display: flex; + justify-content: space-between; + margin: 0rpx 20rpx 0rpx 20rpx; + flex: 1; + font-weight: 500; + color: #fff; + padding-bottom: 10rpx; + border-bottom: 2rpx solid #666; +} + +.personal .order .my-order .order-right { + margin-right: 20rpx; +} + +.personal .order .my-order .to-order { + font-size: 24rpx; + color: #aaa; + margin-right: 10rpx; +} + +.personal .order .orderTab { + overflow: hidden; + display: flex; + align-items: center; + justify-content: space-between; +} + +.personal .order .orderTab .order_status { + padding: 16rpx 20rpx; + width:90rpx; + border-radius: 30rpx 30rpx 30rpx 30rpx; + position: relative; + color: #fff; + font-size: 22rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.personal .order .orderTab .order_status .num { + width: 28rpx; + height: 28rpx; + background: #fff; + font-size: 20rpx; + color: #fff; + border: 2rpx solid #fff; + background: #ff758c; + border-radius: 50%; + position: absolute; + right: 8rpx; + top: 8rpx; + display: flex; + justify-content: center; + align-items: center; + z-index: 1; +} + +.personal .order .orderTab .order_status .icon-img { + height: 80rpx; + width: 80rpx; + margin-bottom: 10rpx; + opacity: 0.8; +} + +.personal .icon-right { + padding-top: 10rpx; + color:#fff; + width: 12rpx; + height: 22rpx; +} + +.personal .tool .toolList2 { + color: #fff; + } + +.personal .tool1 { + position: relative; + margin: 20rpx 30rpx 20rpx 30rpx; + z-index: 3; + + background: linear-gradient(270deg,#2e3440 0%,#1d252f 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 22rpx 22rpx; + align-items: center; + overflow: hidden; + justify-content: space-between; +} + +.personal .tool .border-top-bottom { + border-top: 1rpx solid #efefef; + border-bottom: 1rpx solid #efefef; +} + +.personal .tool .item-main { + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 30rpx 40rpx; + margin: 5rpx; + background:linear-gradient(270deg,#2e3440 0%,#1d252f 100%); + overflow: hidden; + position:relative; +} + +.personal .tool .item-main .item-title { + height: 40rpx; + width: 265rpx; + color: #fff; + font-size: 28rpx; + display: flex; + align-items: center; + text-align: center; +} + +.personal .tool .item-main .tool-right { + font-size: 24rpx; + color: #aaa; + float: right; + display: flex; + align-items: center; + margin-top: -36rpx; + z-index: 2; +} + +.personal .tool .item-main1 { + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 30rpx 40rpx; + margin: 10rpx; + background:linear-gradient(270deg,#2e3440 0%,#1d252f 100%); +overflow: hidden; + position:relative; +} + +.personal .tool .item-main1 .item-title { + height: 40rpx; + + color: #fff; + font-size: 28rpx; + display: flex; + align-items: center; +} + +.personal .tool .item-main1 .tool-right { + font-size: 24rpx; + color: #aaa; + float: right; + display: flex; + align-items: center; + margin-top: -30rpx; +} +button { + + display: block; + margin-left: 0; + margin-right: 0; + padding-left: 0; + padding-right: 0; + box-sizing: border-box; + font-size: 18px; + text-align: center; + text-decoration: none; + line-height: 2.55555556; + border-radius: 5px; + -webkit-tap-highlight-color: transparent; + overflow: hidden; + color: #000; + background-color: #f8f8f800; + + } + +.personal .tool .item-fav { + + display: block; + +} +.personal .tool .item-fav ::after { + + width: 100%; + height: 100%; +} + +.personal .tool button::after { + border: none; +} + +.personal .canvas-content { + position: relative; + margin: 20rpx 30rpx 20rpx 30rpx; + z-index: 3; + background: linear-gradient(270deg,#2e3440 0%,#1d252f 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 22rpx 22rpx; + align-items: center; + overflow: hidden; + justify-content: space-between; + text-align: center; + overflow: hidden; + display: flex; + font-family: PingFangSC-Regular; + font-weight: 400; +} + +.personal .canvas-content .left { + position: relative; +} + +.personal .canvas-content .right { + flex: 1; +} + +.personal .canvas-content .icon-sm-logo { + position: absolute; + height: 56rpx; + width: 56rpx; + top: 122rpx; + left: 122rpx; +} + +.personal .canvas-content .canvas { + height: 220rpx; + width: 220rpx; + margin: 10rpx 10rpx; + border-radius: 20rpx 20rpx 20rpx 20rpx; +} + +.personal .canvas-content .title1 { + text-align: center; + font-size: 30rpx; + line-height: 30rpx; + color: #fff; +} + +.personal .canvas-content .title2 { + text-align: center; + font-size: 28rpx; + line-height: 28rpx; + color: #949494; +} + +.personal .canvas-content .btn { + text-align: center; + box-sizing: border-box; + border-radius: 26rpx; + border: 2rpx solid #4facfe; + padding: 14rpx 0; + margin: 20rpx auto 0; + width: 184rpx; + font-size: 24rpx; + line-height: 24rpx; + color: #4facfe; +} + +.version { + /*height: 200rpx;*/ + width: 100%; + font-size: 24rpx; + color: rgb(255, 255, 255); + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + margin-top: 50rpx; +} + +.personal .basicInform .personalCon { + width: 100%; + height: 210rpx; + padding-top: 30rpx; + position: absolute; + left: 0; + top: 0; + z-index: 3; +} + +.personal .basicInform .personalCon .userInfo { + justify-content: flex-start; + align-items: center; + text-align: center; +} + +.personal .basicInform .personalCon .noAuth { + padding-top: 40rpx; + font-size: 32rpx; + align-items: center; +} + +.personal .basicInform .personalCon .userInfo .userAvatarUrl { + border-radius: 50%; + width: 100%; + height: 100%; + margin-left: 0rpx; + margin-right: 0rpx; + box-shadow: 0 0 10rpx rgba(0,0,0,0.2); + display: flex; + text-align: center; + justify-content: center; +} + +.personal .basicInform .personalCon .userInfo .user-name { + text-align:center; + justify-content: center; + color: #fff; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top { + font-size: 30rpx; + font-weight: bold; + display: flex; + align-items: center; + justify-content: center; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top view:first-of-type { + max-width: 400rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top .refresh { + position: relative; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top .refresh .modify { + width: 24rpx; + height: 24rpx; + background: #4facfe; + opacity: 0; + border: none; + position: absolute; + left: 0; + top: 0; + padding: 20rpx 40rpx; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top .refresh .modify::after { + border: none; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top .refresh .updateWx { + color: #fff; + margin-left: 190rpx; +} + +.personal .basicInform .personalCon .userInfo .user-name .user-name-top .refreshImg { + width: 24rpx; + height: 24rpx; + margin-left: 20rpx; +} + +.personal .basicInform .personalCon .userInfo .user-name .member { + font-size: 24rpx; + color: #fff; + margin-top: 4rpx; +} + +.personal .basicInform .personalCon .pineCones { + padding: 0 50rpx; + margin-top: 60rpx; + display: flex; + justify-content: space-between; +} + +.personal .basicInform .personalCon .pineCones .myPineCones { + color: #00f2fe; + font-size: 28rpx; + font-weight: bold; + display: flex; + align-items: center; +} + +.personal .basicInform .personalCon .pineCones .myPineCones .pineConesImg { + width: 28rpx; + height: 30rpx; + margin-right: 10rpx; +} + +.personal .basicInform .personalCon .pineCones .myPineCones .pineConeRules { + font-size: 20rpx; + margin-left: 28rpx; + text-decoration: underline; +} + +.personal .basicInform .personalCon .pineCones .myPineCones navigator { + margin-top: -8rpx; +} + +.personal .basicInform .personalCon .pineCones .pineconeDetail { + color: #00f2fe; + font-size: 24rpx; + padding: 2rpx 20rpx; + border: 0.1rpx solid #00f2fe; + border-radius: 22rpx; +} + +.personal .order.close-yue { + position: relative; + margin-top: -100rpx; + z-index: 2; +} + +.yuenav .tool-right { + margin-top: -38rpx !important; +} + +/* 会员分销 */ +.disModal { + width: 90%; +} + +.modal-content { + position: relative; + background-color: #fff; + box-sizing: border-box; + border-radius: 10rpx; + font-size: 28rpx; +} + + + +.my-distribution-title { + display: flex; + justify-content: space-between; + margin: 0rpx 20rpx 0rpx 20rpx; + flex: 1; + font-weight: 500; + color: #fff; + padding-bottom: 10rpx; + border-bottom: 2rpx solid #666; +} +.to-distribution { + font-size: 24rpx; + color: #aaa; + margin-right: 10rpx; +} + +.distribution-right { + float: right; + display: flex; +} + +.modal-foot { + position: relative; + padding: 20rpx 20rpx; +} + +.modal-foot1 { + position: relative; + padding: 20rpx 0rpx; +} + +.modal-head::after,.modal-foot::before { + content: ''; + position: absolute; + left: 0; + right: 0; + height: 1px; + transform: scaleY(.5); +} + +.modal-head::after { + border-bottom: 0px solid #c8c7cc; + bottom: 0; +} + +.modal-foot::before { + border-top: 0px solid #c8c7cc; + top: 0; +} + +.modal-foot .tot,.modal-head-r { + color: #4facfe; +} + +.modal-head-l { + color: #333; + font-size: 30rpx; + font-weight: bold; +} + +.modal-body { + margin: 10rpx 0rpx; + padding: 0rpx 20rpx; + color: #fff; +} + +.modal-foot-l { + color: #fff; +} + +.modal-foot-r.btn { + margin-left: 20rpx; + color: #fff; + background-color: #4facfe; + padding: 6rpx 30rpx; + border-radius: 8rpx; +} + +.distribut-new { + text-align: center; +} + +.bor-r { + position: relative; + padding-right: 20rpx; + margin-right: 20rpx; +} + +.bor-r::after { + content: ''; + position: absolute; + top: 0; + bottom: 0; + right: 0; + width: 1px; + transform: scaleX(.5); + border-right: 2px solid #fff; +} + +.distribut-tot { + color: #ff758c; + font-family: DIN; + font-size: 80rpx; + font-weight: bold; + padding-left: 30rpx; +} + +.model-close { + text-align: center; + margin: 30rpx 0; +} + +.model-close .close { + width: 60rpx; + height: 60rpx; +} + + +.personal .tool-distribution { + + + margin: 50rpx 30rpx 20rpx 30rpx; + + z-index: 3; + box-shadow: 0 0 0rpx rgba(0,0,0,0.1); +} + +.personal .tool-distribution .border-top-bottom { + border-top: 1rpx solid #efefef; + border-bottom: 1rpx solid #efefef; +} + +.personal .tool-distribution .item-main { + margin-bottom: 20rpx; + padding: 22rpx 40rpx; + background:#eef7ff; + border-radius: 30rpx 30rpx 30rpx 30rpx; +} + +.personal .tool-distribution .item-main .item-title { + height: 40rpx; + width: 400rpx; + color: #444; + font-size: 28rpx; + display: flex; + align-items: center; +} + +.personal .tool1 .item-main { + padding: 22rpx 40rpx; + background: linear-gradient(270deg,#4a5366 0%,#334152 100%); + border-radius: 30rpx 30rpx 30rpx 30rpx; +} + +.personal .tool1 .item-main .item-title { + height: 40rpx; + width: 200rpx; + color: #fff; + font-size: 32rpx; + text-align: center; +} +.personal .tool-distribution .item-main .tool-right { + float: right; + display: flex; + align-items: center; + margin-top: -30rpx; +} + +.personal .tool-distribution .item-fav { + background: #fff; + margin: 0; + padding: 0; + height: 108rpx; +} + +.personal .tool-distribution button::after { + border: none; +} +.personal .tool-distribution .my-distribution { + padding: 22rpx 30rpx; + display: flex; + align-items: center; +} + +.personal .tool-distribution .my-distribution .my-distribution-title { + flex: 1; + font-weight: 500; + color: #444; +} + +.personal .tool-distribution .my-distribution .to-distribution { + font-size: 24rpx; + color: #aaa; + margin-right: 20rpx; +} + + + +.toolList { + justify-content: center; + align-items: center; + display: flex; + overflow: hidden; + flex-wrap: wrap; +} + +.toolList2 { + border-radius: 20rpx 20rpx 20rpx 20rpx; + padding: 30rpx 50rpx; + margin-top: 80rpx; + background: rgba(255, 255, 255, 0.179); + margin-bottom: -20rpx; +} + +.nocode { + height: 220rpx; + width: 220rpx; + margin: 10rpx 10rpx; + border-radius: 20rpx 20rpx 20rpx 20rpx; + border: 1rpx solid #e5e5e5; + line-height: 220rpx; + background: rgba(0, 0, 0, 0.1); + text-align: center; + color: #fff; +} + +.toolIcon { + position: absolute; + width: 160rpx; + max-height: 160rpx; + margin-left: 160rpx; + display:block; + z-index: 1; +} + +.toolIconbig { + position: absolute; + width: 240rpx; + max-height: 150rpx; + top: -20rpx; + right: 10rpx; + display:block; + z-index: 1; +} +.userLevel { + display: flex; + justify-content: center; + align-items: center; + margin-top: 10rpx; + color: #fff; +} + +.userLevelName { + background: #372d35; + border-radius: 20rpx; + padding: 0 15rpx; + height: 38rpx; + line-height: 38rpx; + text-align: center; + font-size: 22rpx; +} + +.userLevelName .iconfont { + color: #fae9bb; + font-size: 24rpx; +} + +.userLevel .userLeveldiscount { + font-size: 24rpx; + margin-left: 10rpx; +} + +.fetch-coder { + position: absolute; + margin-top: 10rpx; + right: 30rpx; + text-align: center; + color: #fff; + z-index: 20; +} + +.fetch-coder .iconfont { + color: #fff; + font-size: 48rpx; + width: 42rpx; + height: 42rpx; + text-align: center; + line-height: 42rpx; + border-radius: 50%; + display: inline-block; +} + +.fetch-coder-text { + font-size: 20rpx; + margin-top: 4rpx; +} + +.personal .tool .distribution .hasVip { + margin-top: 15rpx; +} + +.vip { + margin-right: 30rpx; + margin-left: 30rpx; + background: linear-gradient(to right, #e6b980 0%, #eacda3 100%); + height: 76rpx; + padding: 0 20rpx; + font-size: 24rpx; + color: #72491d; + border-radius: 20rpx; + margin-top: 30rpx; + z-index: 3; + position: relative; +} + +.signIn { + right: 122rpx; +} + +/* 自提点 */ + + +.waptoolList.toolList { + display: flex; + flex-wrap: wrap; + text-align: center; + padding: 50rpx 0 20rpx; +} + +.waptoolList.toolList > view, +.waptoolList.toolList > button, +.waptoolList.toolList > navigator { + width: 25%; + margin-bottom: 30rpx; +} + +.waptoolList.toolList .item-title { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.waptoolList.toolList .item-title .toolIcon { + margin-right: 0; + width: 60rpx; + height: 60rpx!important; + margin-bottom: 15rpx; + max-height: initial; +} + +.waptoolList.toolList .item-fav { + height: 108rpx; + font-size: 26rpx; + font-weight: 400; + color: #333; + line-height: 1.4; +} + +.waptoolList.toolList .item-title text { + font-size: 26rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + width: 96%; +} + +.dejavu { + height: 55rpx; + width: 55rpx; +} + +.dejavu-version { + position: relative; + margin: 0rpx 40rpx 30rpx 40rpx; + z-index: 3; + padding: 22rpx 20rpx; + align-items: center; + overflow: hidden; + justify-content: space-between; + text-align: center; + overflow: hidden; + display: flex; + font-family: PingFangSC-Regular; + font-weight: 400; +} + +.dejavu-version .left { + margin-left: 30rpx; + margin-top: 10rpx; + position: relative; +} + +.dejavu-version .right { + flex: 1; + color: #fff; + font-size: 22rpx; +} +.luxian { + position: relative; + padding-left: 30rpx; + margin-left: 30rpx; +} + +.luxian::before { + content: ""; + position: absolute; + top: 25%; + bottom: 25%; + left: 0; + border: 1px solid #e5e5e5; + transform-origin: 0 0; + transform: scaleX(0.5); +} + +.community-flex { + display: flex; + justify-content: space-between; +} +.edituserbtn { + position: absolute; + right: 290rpx; + top: 0; + z-index: 1000; + font-size: 28rpx; + color: #fff; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/protocol.js b/eaterplanet_ecommerce/pages/user/protocol.js new file mode 100644 index 0000000..ab9d237 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/protocol.js @@ -0,0 +1,82 @@ +// eaterplanet_ecommerce/pages/user/protocol.js +var util = require('../../utils/util.js'); +var status = require('../../utils/index.js'); +var app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: [], + noMore: false + }, + token: '', + pageNum: 1, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + status.setNavBgColor(); + var token = wx.getStorageSync('token'); + this.token = token; + this.get_list(); + }, + + /** + * 获取列表 + */ + get_list: function(){ + let that = this; + wx.showLoading(); + app.util.request({ + url: 'entry/wxapp/index', + data: { + controller: 'article.get_article_list', + token: this.token, + page: this.pageNum + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + let oldList = that.data.list; + let list = res.data.data; + let h = {}; + if(list.length < 30) h.noMore = true; + list = list.concat(oldList); + h.list = list; + that.pageNum++; + that.setData(h) + } else { + let h = {}; + h.noMore = true; + if(that.pageNum == 1) h.noData = true; + that.setData(h) + } + } + }) + }, + + onReachBottom: function() { + this.data.noMore || this.get_list(); + } +}) diff --git a/eaterplanet_ecommerce/pages/user/protocol.json b/eaterplanet_ecommerce/pages/user/protocol.json new file mode 100644 index 0000000..669049f --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/protocol.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "常见帮助", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-empty": "../../components/empty/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/protocol.wxml b/eaterplanet_ecommerce/pages/user/protocol.wxml new file mode 100644 index 0000000..92a39bb --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/protocol.wxml @@ -0,0 +1,8 @@ + + + + {{item.title}} + + + +暂无内容~ diff --git a/eaterplanet_ecommerce/pages/user/protocol.wxss b/eaterplanet_ecommerce/pages/user/protocol.wxss new file mode 100644 index 0000000..f070ba3 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/protocol.wxss @@ -0,0 +1,18 @@ +.list-item { + height: 100rpx; + background: #fff; + border-bottom: 0.1rpx solid #e4e4e4; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20rpx; +} + +.list-item span { + font-size: 28rpx; +} + +.list-item .icon-right { + width: 12rpx; + height: 22rpx; +} diff --git a/eaterplanet_ecommerce/pages/user/rechargeDetails.js b/eaterplanet_ecommerce/pages/user/rechargeDetails.js new file mode 100644 index 0000000..bfbf90c --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rechargeDetails.js @@ -0,0 +1,120 @@ +var app = getApp(); +var util = require('../../utils/util.js'); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: [], + showData: 1, + loadText: '加载中', + remark: [ + '', + '前台充值', + '', + '余额支付', + '订单退款', + '后台充值', + '商品退款', + '', + '后台扣除', + '分销提现至余额', + '团长提现至余额', + '拼团佣金提现至余额', + '配送佣金提现到余额', + '', + '', + '', + '', + '', + '', + '', + '礼品卡兑换', + '拼团返利' + ] + }, + page: 1, + no_data: 0, + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + util.check_login() ? this.setData({ is_login: true }) : this.setData({ is_login: false }); + this.getData(); + }, + + /** + * 授权成功回调 + */ + authSuccess: function () { + wx.reLaunch({ + url: '/eaterplanet_ecommerce/pages/user/rechargeDetails', + }) + }, + + getData: function(){ + var token = wx.getStorageSync('token'); + let that = this; + wx.showLoading(); + this.setData({ isHideLoadMore: false }) + app.util.request({ + 'url': 'entry/wxapp/index', + 'data': { + controller: 'user.get_user_charge_flow', + token: token, + page: that.page + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if(res.data.code==0){ + var list = that.data.list; + list = list.concat(res.data.data); + that.setData({ list, isHideLoadMore: true }) + } else if (res.data.code == 1) { + if (that.data.list.length == 0 && that.page == 1) that.setData({ showData: 0}); + that.no_data = 1; + that.setData({ isHideLoadMore: true }) + return false; + } else if (res.data.code == 2) { + that.setData({ is_login: false }) + } + }, + fail: (error)=>{ + console.log(error) + wx.showLoading(); + } + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if (this.no_data == 1) return false; + this.page += 1; + this.getData(); + this.setData({ + isHideLoadMore: false + }) + } +}) diff --git a/eaterplanet_ecommerce/pages/user/rechargeDetails.json b/eaterplanet_ecommerce/pages/user/rechargeDetails.json new file mode 100644 index 0000000..e736f40 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rechargeDetails.json @@ -0,0 +1,11 @@ +{ + "navigationBarTitleText": "明细", + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTextStyle": "black", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "i-auth": "../../components/auth/index", + "i-load-more": "../../components/load-more/index", + "i-card": "../../components/card/index" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/rechargeDetails.wxml b/eaterplanet_ecommerce/pages/user/rechargeDetails.wxml new file mode 100644 index 0000000..12387d2 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rechargeDetails.wxml @@ -0,0 +1,26 @@ + + + + + + 暂无任何明细记录 + + + + + + + {{remark[item.state]}} {{item.state==3 || item.state==8?'-':'+'}}{{item.money}}(送:{{item.give_money}}) + + 余额:{{item.current_yuer}} + + {{item.trans_id}} + {{item.charge_time}} + {{item.remark}} + + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/rechargeDetails.wxss b/eaterplanet_ecommerce/pages/user/rechargeDetails.wxss new file mode 100644 index 0000000..f929c05 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rechargeDetails.wxss @@ -0,0 +1,116 @@ +.charge-box { + padding-top: 30rpx; +} + +.noDistributionList { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + margin-top: 200rpx; +} + +.noDistributionList .noDistributionListImg { + width: 218rpx; + height: 218rpx; + margin-bottom: 32rpx; +} + +.noDistributionList .noDistributionListTit { + font-size: 30rpx; + color: #666; + line-height: 30rpx; +} + +.searchData { + padding: 30rpx 20rpx; + border-top: 0.1rpx solid #efefef; + display: flex; + align-items: center; + justify-content: space-between; +} + +.searchData .choose-day { + padding: 4rpx 20rpx 4rpx 30rpx; + background: #fff; + border-radius: 24rpx; + font-size: 28rpx; + color: #444; + display: flex; + align-items: center; +} + +.searchData .choose-day .arrow { + width: 0rpx; + height: 0rpx; + font-size: 0; + line-height: 0; + overflow: hidden; + margin-left: 14rpx; + margin-top: 10rpx; + border-width: 8rpx; + border-style: solid dashed dashed dashed; + border-color: #444 transparent transparent transparent; +} + +.searchData .getData { + font-size: 28rpx; + color: #aaa; +} + +.searchData .getData text { + margin-right: 30rpx; +} + +.list { + padding: 0 20rpx; +} + +.list .listData { + padding: 30rpx; + border-bottom: 0.1rpx solid #eee; +} + +.list .listData:last-child { + border: none; +} + +.list .listData .list-tit { + line-height: 28rpx; + margin-bottom: 24rpx; + display: flex; + justify-content: space-between; +} + +.list .listData .list-tit .tit { + font-size: 30rpx; + color: #444; +} + +.list .listData .list-tit .num { + font-size: 32rpx; + color: #ff5344; + font-weight: bold; +} + +.list .listData .list-tit .num.yue { + color: #666; + font-weight: normal; + font-size: 30rpx; +} + +.list .listData .list-tit .num2 { + color: #999; +} + +.list .listData .list-orderNo { + font-size: 26rpx; + color: #444; + margin-bottom: 16rpx; +} + +.list .listData .list-time { + font-size: 26rpx; + color: #aaa; + line-height: 22rpx; +} diff --git a/eaterplanet_ecommerce/pages/user/rule.js b/eaterplanet_ecommerce/pages/user/rule.js new file mode 100644 index 0000000..592ff25 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rule.js @@ -0,0 +1,94 @@ +var app = getApp(); + +Page({ + handlerGobackClick(delta) { + const pages = getCurrentPages(); + if (pages.length >= 2) { + wx.navigateBack({ + delta: delta + }); + } else { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + } + }, + handlerGohomeClick(url) { + wx.switchTab({ + url: '/eaterplanet_ecommerce/pages/index/index' + }); + }, + onLoad: function (options) { + let type = options.type || ""; + if (!type) { + wx.showModal({ + title: '提示', + content: '参数错误', + showCancel: false, + confirmColor: '#F75451', + success(res) { + if (res.confirm) { + wx.navigateBack() + } + } + }) + return false; + } + let navTitle = { + vipcard: '权益规则', + pintuan: '拼团规则', + signin: '活动规则', + solitaire: '接龙规则', + pintuanRebate: '拼团返利规则', + } + wx.setNavigationBarTitle({ + title: navTitle[type] || '规则' + }) + wx.showLoading(); + this.getData(type); + }, + + getData: function (type) { + wx.showLoading(); + let urls = { + vipcard: 'vipcard.get_vipcard_baseinfo', + pintuan: 'group.pintuan_slides', + signin: 'signinreward.get_signinreward_baseinfo', + solitaire: 'solitaire.get_rule', + pintuanRebate: 'group.pintuan_slides' + } + var token = wx.getStorageSync('token'); + let that = this; + app.util.request({ + url: 'entry/wxapp/user', + data: { + controller: urls[type], + token: token + }, + dataType: 'json', + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + let article = ''; + if (type == 'vipcard') { + let { vipcard_buy_pagenotice } = res.data.data; + article = vipcard_buy_pagenotice; + } else if (type == 'pintuan') { + let { pintuan_publish } = res.data; + article = pintuan_publish; + } else if (type == 'signin') { + let { signinreward_pagenotice } = res.data.data; + article = signinreward_pagenotice; + } else if (type == 'solitaire') { + let { solitaire_notice } = res.data; + article = solitaire_notice; + } else if (type == 'pintuanRebate') { + let { pintuan_rebate_publish } = res.data; + article = pintuan_rebate_publish; + } + that.setData({ article }) + } + } + }) + } +}) \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/rule.json b/eaterplanet_ecommerce/pages/user/rule.json new file mode 100644 index 0000000..c9aeb90 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rule.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "", + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTextStyle": "white", + "usingComponents": { + "ep-navBar": "../../components/navigation-bar", + "parser":"../../components/parser/parser" + } +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/rule.wxml b/eaterplanet_ecommerce/pages/user/rule.wxml new file mode 100644 index 0000000..8801566 --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rule.wxml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/user/rule.wxss b/eaterplanet_ecommerce/pages/user/rule.wxss new file mode 100644 index 0000000..48efe8a --- /dev/null +++ b/eaterplanet_ecommerce/pages/user/rule.wxss @@ -0,0 +1,5 @@ +.article { + background: #fff; + padding: 20rpx 30rpx; + font-size: 28rpx; +} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/web-view.js b/eaterplanet_ecommerce/pages/web-view.js new file mode 100644 index 0000000..4333698 --- /dev/null +++ b/eaterplanet_ecommerce/pages/web-view.js @@ -0,0 +1,74 @@ +function prop(e, a, t) { + return a in e ? Object.defineProperty(e, a, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[a] = t, e; +} + +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: "", + shareMessage: { + title: "", + path: "", + imageUrl: "" + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // let url = decodeURIComponent(options.url) + "?" + Math.random(); + let url = decodeURIComponent(options.url); + options.url && this.setData(prop({ + url: url + }, "shareMessage.path", "/eaterplanet_ecommerce/pages/web-view?url=" + url)); + console.log("webviewUrl", this.data.url); + }, + + getPostMessage: function (e) { + var a = e.detail; + console.log("收到的信息", a); + var shareMessage = Object.assign({}, this.data.shareMessage, a.data[0]); + this.setData({ + shareMessage: shareMessage + }), wx.showShareMenu({ + withShareTicket: !0, + success: function () { + console.log("成功"); + }, + fail: function () { + console.log("失败"); + } + }), wx.updateShareMenu(); + }, + + onPageLoad: function (e) { + e.detail; + }, + + onPageError: function (e) { + e.detail; + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + return console.log(this.data.shareMessage), Object.assign({}, this.data.shareMessage, { + success: function () { + console.log("share succeed"); + }, + error: function () { + console.log("share failed"); + } + }); + } +}) diff --git a/eaterplanet_ecommerce/pages/web-view.json b/eaterplanet_ecommerce/pages/web-view.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/eaterplanet_ecommerce/pages/web-view.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/web-view.wxml b/eaterplanet_ecommerce/pages/web-view.wxml new file mode 100644 index 0000000..a8a6bb2 --- /dev/null +++ b/eaterplanet_ecommerce/pages/web-view.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/eaterplanet_ecommerce/pages/web-view.wxss b/eaterplanet_ecommerce/pages/web-view.wxss new file mode 100644 index 0000000..62a2226 --- /dev/null +++ b/eaterplanet_ecommerce/pages/web-view.wxss @@ -0,0 +1 @@ +/* eaterplanet_ecommerce/pages/web-view.wxss */