|
@@ -13,14 +13,14 @@
|
|
|
>
|
|
|
<view class="video-item">
|
|
|
<view>
|
|
|
- <u-image :src="item.imageSet[0]" height="140px" width="100%"></u-image>
|
|
|
- <view class="back-price">返<text>¥15</text></view>
|
|
|
+ <u-image :src="item.productImage" height="140px" width="100%"></u-image>
|
|
|
+ <view class="back-price">返<text>¥{{item.promoRuleValue}}</text></view>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <view class="product-name">{{item.name}}</view>
|
|
|
- <view class="product-guige">{{item.origCode}}</view>
|
|
|
+ <view class="product-name">{{item.productName}}</view>
|
|
|
+ <view class="product-guige">{{item.productOrigCode}}</view>
|
|
|
<view class="product-button">
|
|
|
- <view class="price-txt">¥<text>{{item.price}}</text></view>
|
|
|
+ <view class="price-txt">¥<text>{{item.cost}}</text></view>
|
|
|
<view>
|
|
|
<u-button v-if="!item.checked" :throttle-time="50" @click="chooseProduct(item)" size="mini" type="primary" shape="circle"><u-icon name="plus"></u-icon></u-button>
|
|
|
<u-button v-else :throttle-time="50" @click="chooseProduct(item)" size="mini" type="success" shape="circle"><u-icon name="plus"></u-icon>{{item.qty}}</u-button>
|
|
@@ -82,14 +82,14 @@
|
|
|
<view class="choose-product-item">
|
|
|
<view>
|
|
|
<view class="choose-product-item-img">
|
|
|
- <u-image :src="item.images" height="200rpx" width="100%"></u-image>
|
|
|
- <view class="back-price">返<text>¥15</text></view>
|
|
|
+ <u-image :src="item.productImage" height="200rpx" width="100%"></u-image>
|
|
|
+ <view class="back-price">返<text>¥{{item.promoRuleValue}}</text></view>
|
|
|
</view>
|
|
|
<view class="choose-product-item-info">
|
|
|
- <view class="choose-product-item-left-info-name">{{item.name}}</view>
|
|
|
- <view class="choose-product-item-left-info-guige">{{item.origCode}}</view>
|
|
|
+ <view class="choose-product-item-left-info-name">{{item.productName}}</view>
|
|
|
+ <view class="choose-product-item-left-info-guige">{{item.productOrigCode}}</view>
|
|
|
<view class="choose-product-item-left-info-price">
|
|
|
- <view class="price-txt">¥<text>{{item.price}}</text></view>
|
|
|
+ <view class="price-txt">¥<text>{{item.cost}}</text></view>
|
|
|
<view>
|
|
|
<u-number-box v-model="item.qty" :index="item.id" :input-width="60" :input-height="60" size="mini" :min="0" @change="changeQty"></u-number-box>
|
|
|
</view>
|
|
@@ -112,6 +112,7 @@
|
|
|
mapMutations,
|
|
|
} from 'vuex'
|
|
|
import { queryPromoProductByPage } from '@/api/video.js'
|
|
|
+ import { purchaseSave } from '@/api/purchase.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -157,6 +158,7 @@
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: opts.title||'促销活动产品'
|
|
|
})
|
|
|
+ this.$store.state.vuex_tempData = null
|
|
|
this.promoActiveSn = opts.promoActiveSn
|
|
|
this.pageInit()
|
|
|
},
|
|
@@ -267,7 +269,7 @@
|
|
|
})
|
|
|
this.chooseProductList.splice()
|
|
|
},
|
|
|
- // 清空已选列表
|
|
|
+ // 确定清空已选列表
|
|
|
claerChoose(){
|
|
|
const _this = this
|
|
|
uni.showModal({
|
|
@@ -276,15 +278,19 @@
|
|
|
confirmText: '确定',
|
|
|
success(res) {
|
|
|
if(res.confirm){
|
|
|
- _this.chooseList = []
|
|
|
- _this.chooseProductList = []
|
|
|
- _this.showChoosePopu = false
|
|
|
- // 重置已选状态
|
|
|
- _this.list.filter(item => item.checked).map(item=>item.checked = false)
|
|
|
+ _this.clearChooseData()
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 清空已选数据
|
|
|
+ clearChooseData(){
|
|
|
+ this.chooseList = []
|
|
|
+ this.chooseProductList = []
|
|
|
+ this.showChoosePopu = false
|
|
|
+ // 重置已选状态
|
|
|
+ this.list.filter(item => item.checked).map(item=>item.checked = false)
|
|
|
+ },
|
|
|
// scroll-view到底部加载更多
|
|
|
onreachBottom() {
|
|
|
if(this.list.length < this.total){
|
|
@@ -309,7 +315,11 @@
|
|
|
this.status = "loading"
|
|
|
queryPromoProductByPage(params).then(res => {
|
|
|
if (res.code == 200 || res.status == 204 || res.status == 200) {
|
|
|
- _this.list = _this.list.concat(res.data.list||[])
|
|
|
+ const list = res.data.list||[]
|
|
|
+ list.map(k => {
|
|
|
+ k.checked = false
|
|
|
+ })
|
|
|
+ _this.list = _this.list.concat(list)
|
|
|
_this.total = res.data.count || 0
|
|
|
} else {
|
|
|
_this.list = []
|
|
@@ -322,9 +332,34 @@
|
|
|
// 提交订单
|
|
|
submitOrder(){
|
|
|
if(this.showChoosePopu){
|
|
|
- console.log(this.chooseList)
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pagesB/procureOrder?id='
|
|
|
+ uni.showLoading({
|
|
|
+ title: '提交中...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ const detailList = []
|
|
|
+ this.chooseList.map(item => {
|
|
|
+ detailList.push({
|
|
|
+ promoActiveSn: this.promoActiveSn,
|
|
|
+ promoRuleSn:item.promoRuleSn,
|
|
|
+ productSn:item.productSn,
|
|
|
+ productCode:item.productCode,
|
|
|
+ qty:item.qty,
|
|
|
+ price:item.cost,
|
|
|
+ giveAmount:item.promoRuleValue
|
|
|
+ })
|
|
|
+ })
|
|
|
+ purchaseSave({
|
|
|
+ promoActiveSn: this.promoActiveSn,
|
|
|
+ detailList: detailList
|
|
|
+ }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.clearChooseData()
|
|
|
+ this.$store.state.vuex_tempData = res.data
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pagesB/procureOrder?id='+res.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ uni.hideLoading()
|
|
|
})
|
|
|
}else{
|
|
|
this.openChoose()
|
|
@@ -406,6 +441,7 @@
|
|
|
background: #ffffff;
|
|
|
border-radius: 10upx;
|
|
|
box-shadow: 1px 1px 3px #EEEEEE;
|
|
|
+ height: 100%;
|
|
|
> view{
|
|
|
&:first-child{
|
|
|
position: relative;
|