123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <view>
- <view class="mvxyck" style="padding-top: 50rpx;">
- <view v-for="(item, index) in goodlist" :key="index">
- <view class="rectangular_54nz">
- <view class="rectangular_46ue">
- <view class="ynusc">{{index+1}}</view>
- <view class="the_warehouse">号仓</view>
- </view>
- <view class="box_fff">
- <view class="bnrmd">
- <view class="rectangular_67lk">{{item.name}}</view>
- <image :src="item.litpic" mode="widthFix" class="the_mask_73jy"></image>
- <view class="since">{{item.price}}</view>
- </view>
- <view class="stwdcp">
- <view class="le_ticket">乐票:
- <view class="sfwitk">{{ item.lpnum }} / {{item.cgkc}}%</view>
- </view>
- <view class="cycle_day">周期:
- <view class="sfwitk">{{ item.tianshu }}天 / {{ item.shouyi }}%</view>
- </view>
- <view class="ws60cef">{{ item.kssj}} ~ {{ item.jssj}}</view>
- <view class="cycle_day" style="color: #829c52;">库存余量:
- <view class="sfwitk" style="color: #829c52;font-weight: bold;">{{ item.kucun }}</view>
- </view>
- <view class="fjpar">
- <!-- <view class="rectangular_61de_ismxl" @click="shifang(item.id, 1, index)" v-if="item.kucun>0 && item.zt==0">释放一单</view> -->
- <view class="rectangular_61de" v-if="item.kucun==0">库存已满</view>
- <view class="rectangular_61de" v-if="item.zt==1">释放中</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- constants: {},
- goodlist: [],
- num: 0,
- id: 0,
- userinfo: null
- };
- },
- onShow() {
- var user = this.$api.getUserinfo();
- if (user) {
- this.userinfo = user;
- } else {
- this.userinfo = null;
- }
- this.getMhGoodlist();
- },
- filters: {
- formatDate: function(value, args) {
- var dt = new Date(value);
- if (args == 'yyyy-M-d') {
- // yyyy-M-d
- let year = dt.getFullYear();
- let month = dt.getMonth() + 1;
- let date = dt.getDate();
- return `${year}-${month}-${date}`;
- } else if (args == 'yyyy-M-d H:m:s') {
- // yyyy-M-d H:m:s
- let year = dt.getFullYear();
- let month = dt.getMonth() + 1;
- let date = dt.getDate();
- let hour = dt.getHours();
- let minute = dt.getMinutes();
- let second = dt.getSeconds();
- return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
- } else if (args == 'yyyy-MM-dd') {
- // yyyy-MM-dd
- let year = dt.getFullYear();
- let month = (dt.getMonth() + 1).toString().padStart(2, '0');
- let date = dt
- .getDate()
- .toString()
- .padStart(2, '0');
- return `${year}-${month}-${date}`;
- } else if (args == 'HH:mm') {
- // yyyy-MM-dd
- let hour = dt
- .getHours()
- .toString()
- .padStart(2, '0');
- let minute = dt
- .getMinutes()
- .toString()
- .padStart(2, '0');
- return `${hour}:${minute}`;
- } else {
- // yyyy-MM-dd HH:mm:ss
- let year = dt.getFullYear();
- let month = (dt.getMonth() + 1).toString().padStart(2, '0');
- let date = dt
- .getDate()
- .toString()
- .padStart(2, '0');
- let hour = dt
- .getHours()
- .toString()
- .padStart(2, '0');
- let minute = dt
- .getMinutes()
- .toString()
- .padStart(2, '0');
- let second = dt
- .getSeconds()
- .toString()
- .padStart(2, '0');
- return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
- }
- }
- },
- onLoad(option) {
- // console.log(option);
- },
- methods: {
- shifang(id, num, index) {
- if (!this.userinfo) {
- uni.showToast({
- title: '请先登录',
- icon: 'none'
- });
- return;
- }
- var that = this;
- that.goodlist[index].zt = 1
- var data = new Object();
- data.cid = id;
- data.uid = this.userinfo.id;
- data.num = num;
- //console.log(data)
- this.$api
- .MhGetModel(data, 'ppb/shifang')
- .then(res => {
- //console.log(res.data)
- if (res.data.code == 0) {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- });
- that.getMhGoodlist()
- that.goodlist[index].zt = 0
- return;
- } else {
- uni.redirectTo({
- url: 'zrcg?lx=1'
- });
- }
- })
- .catch(err => {
- // console.log('request fail', JSON.stringify(err));
- });
- },
- getMhGoodlist() {
- var data = new Object();
- data.uid = this.userinfo.id;
- this.$api
- .MhGetModel(data, 'ppb/list')
- .then(res => {
- if (res.data.code != 1) {
- uni.showModal({
- title: '提示',
- content: res.data.msg,
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.navigateBack({
- delta: 1
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- return;
- } else {
- uni.hideLoading();
- this.goodlist = res.data.data;
- }
- })
- .catch(err => {
- // console.log('request fail', JSON.stringify(err));
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @import "../lanhu_jingxi/index.scss";
- </style>
- <style>
- page {
- background: #f1f2f6;
- }
- </style>
|