Browse Source

修改优惠劵政策

master
mike 4 years ago
parent
commit
21b109cd72
  1. 30
      packages/agent/agent.vue
  2. 2
      pages/write/baseInfo.vue
  3. 16
      service/index.js

30
packages/agent/agent.vue

@ -7,13 +7,13 @@
/>
<view class="flex-col section_2">
<view class="flex-col items-center section_3">
<text class="text_2">783489248292</text>
<text class="text_3">有效期2022-05-17至2022-05-31</text>
<text class="text_2">{{userData.agent_code}}</text>
<text class="text_3">有效期{{unixTimeFormat(userData.start_time)}} {{unixTimeFormat(userData.end_time)}}</text>
</view>
<text class="text_4">重新生成后没使用的优惠码将失效</text>
<view class="flex-col group_6">
<view class="flex-col items-center button" @click="copy()"><text class="text_5">复制分销优惠码</text></view>
<view class="flex-col items-center button_1"><text class="text_6">重新生成优惠码</text></view>
<view class="flex-col items-center button_1" @click="refreshCode()"><text class="text_6">重新生成优惠码</text></view>
</view>
</view>
</view>
@ -22,17 +22,31 @@
</template>
<script>
import { couponSearch,couponUpdate } from '@/service/index.js';
import { dateFormat } from '@/common/dateFtt.js';
export default {
data(){
return {
userData:null
}
},
onLoad() {
couponSearch({}).then((res)=>{
this.userData = res.data.datas
console.log("couponSearch",res);
})
},
methods: {
unixTimeFormat(t){
return dateFormat(new Date(t*1000),'yyyy-MM-dd')
},
copy(){
let userInfo = uni.getStorageSync('userInfo');
console.log(11111);
uni.setClipboardData({
data:userInfo.agent_code,
data:this.userData.agent_code,
showToast:true,
success() {
uni.showToast({
@ -41,6 +55,12 @@
}
})
},
refreshCode(){
couponUpdate({}).then((res)=>{
this.userData = res.data.datas
console.log("couponUpdate",res);
})
},
}
}
</script>

2
pages/write/baseInfo.vue

@ -110,7 +110,7 @@
</view>
<view class="flex-row group_15">
<text class="text_11">优惠券</text>
<u-input v-model="couponText" placeholder="请输入优惠券码"></u-input>
<u-input v-model="couponText" placeholder="非必填,请输入优惠券码"></u-input>
</view>
<view class="flex-col group_21">
<view class="flex-col items-center button" @click="next">

16
service/index.js

@ -6,4 +6,20 @@ export async function my() {
url: '/api/v1/my',
method: 'post',
})
}
// 获取优惠码
export async function couponSearch() {
return await request({
url: '/api/v1/coupon_search',
method: 'post',
})
}
// 更新优惠码
export async function couponUpdate() {
return await request({
url: '/api/v1/coupon_update',
method: 'post',
})
}
Loading…
Cancel
Save