123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view>
- <swiper class="screen-swiper square-dot" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000"
- duration="500">
- <swiper-item v-for="(item,index) in goods.picall" :key="index">
- <image :src="item" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- <view class="echo-article-title bg-white">
- <text class="text-xl">{{goods.title}}</text>
- </view>
- <view class="echo-article-meta bg-white">
- <text>{{goods.summary}}</text>
- </view>
- <view class="echo-article-meta bg-white">
- <text class="text-xl text-red">{{goods.integral}}积分 + ¥{{goods.paymoney}}</text>
- </view>
- <view class="echo-article-meta bg-white">
- <view class="echo-article-meta-left">
- <text>库存: {{goods.stock}}件</text>
- </view>
- <view class="echo-article-meta-right">
- <text>已兑出:{{goods.sales}}件</text>
- </view>
- </view>
- <view class="bg-white padding-top-xs padding-bottom-sm margin-bottom"></view>
- <view class="cu-bar bg-white solids-bottom">
- <view class="action">
- <text class="cuIcon-titles text-blue"></text> 商品详情
- </view>
- </view>
- <view class="echo-article-details bg-white">
- <u-parse :content="goods.details" noData="详情内容..." @navigate="navigate"></u-parse>
- </view>
- <view class="padding-xl"></view>
- <view class="cu-bar bg-white tabbar border shop foot">
- <view class="bg-white submit">
- <view class="btn-group text-xxl flex justify-around">
- <view class="cuIcon-move" @tap="setNumber(-1)"></view>
- <view>{{buynumber}}</view>
- <view class="cuIcon-add" @tap="setNumber(1)"></view>
- </view>
- </view>
- <view class="bg-orange submit flex-wrap">
- <view style="width: 100%;">{{integral}} 积分</view>
- <view style="width: 100%;">¥{{paymoney}}</view>
- </view>
- <view class="bg-red submit" @tap="setOrder">立即订购</view>
- </view>
- </view>
- </template>
- <script>
- import uParse from '@/components/gaoyia-parse/parse.vue';
- var _this;
- export default {
- components: {
- uParse
- },
- data() {
- return {
- goods: {},
-
- isRotate: false,
- buynumber: 1,
- integral: 0,
- paymoney: 0.00
- }
- },
- onLoad: function(option) {
- _this = this;
- var goodsid = option.goodsid || 0;
- _this.$req.ajax({
- path: "mall/getgoods",
- data: {
- goodsid: goodsid
- }
- }).then((data) => {
- _this.goods = data.goods;
- _this.setNumber(0);
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- },
- onShareAppMessage: function(res) {
- return {
- title: _this.goods.title,
- path: "/pages/mall/detail?goodsid=" + _this.goods.id
- }
- },
- methods: {
- setOrder: function() {
- if(_this.isRotate){
- return false;
- }
- _this.isRotate = true;
- var userinfo = uni.getStorageSync('userinfo') || false;
- if (userinfo == false) {
- uni.showModal({
- title: '信息提示',
- content: "你还未登录账号。",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- });
- _this.isRotate = false;
- }
- }
- });
- return false;
- }
- var msg = "提交该订单将会扣除" + _this.integral + "积分";
- if (_this.paymoney != 0.00) {
- msg += ",并需要支付¥" + _this.paymoney + "元";
- }
- msg += "。确认要提交订单吗?";
- uni.showModal({
- title: '信息提示',
- content: msg,
- success: function(res) {
- if (res.confirm) {
- _this.$req.ajax({
- path: "mall/setorder",
- data: {
- goodsid: _this.goods.id,
- userid: userinfo.id,
- buynumber: _this.buynumber
- }
- }).then((data) => {
- uni.navigateTo({
- url: '/pages/mall/order?orderid=' + data.orderid
- });
- _this.isRotate = false;
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- } else if (res.cancel) {
- _this.isRotate = false;
- }
- }
- });
- },
- setNumber: function(val) {
- var newbuynumber = parseInt(_this.buynumber) + val;
- newbuynumber = Math.max(1, newbuynumber);
- newbuynumber = Math.min(newbuynumber, parseInt(_this.goods.stock));
- _this.integral = (newbuynumber * _this.goods.integral);
- _this.paymoney = (newbuynumber * _this.goods.paymoney).toFixed(2);
- _this.buynumber = newbuynumber;
- },
- navigate: function(href, e) {
- // #ifdef H5
- location.href = href;
- // #endif
- // #ifndef H5
- uni.navigateTo({
- url: '/pages/tool/webview?pagesrc=' + encodeURIComponent(href)
- });
- // #endif
- }
- }
- }
- </script>
- <style lang="scss">
- .screen-swiper {
- height: 750rpx;
- }
- </style>
|