Prechádzať zdrojové kódy

feat(activity): 小程序活动创建表单添加会员价输入

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
E2E Test Bot 1 mesiac pred
rodič
commit
15a93dd3
1 zmenil súbory, kde vykonal 9 pridanie a 1 odobranie
  1. 9 1
      cfc-frontend/pages/activity/create.vue

+ 9 - 1
cfc-frontend/pages/activity/create.vue

@@ -76,6 +76,12 @@
         </view>
       </view>
 
+      <!-- 会员价 -->
+      <view class="form-item">
+        <text class="form-label">会员价(元)</text>
+        <input class="form-input" type="digit" v-model="memberPriceYuan" placeholder="留空等于普通价" />
+      </view>
+
       <!-- 封面图片 -->
       <view class="form-item">
         <text class="form-label">封面图片</text>
@@ -143,6 +149,7 @@ export default {
         checkinPoints: 0
       },
       priceYuan: '0',
+      memberPriceYuan: '',
       maxParticipantsStr: '0',
       datePart: '',
       timePart: '',
@@ -197,6 +204,7 @@ export default {
           self.form.visibility = d.visibility || 'public'
           self.maxParticipantsStr = String(self.form.maxParticipants)
           self.priceYuan = self.form.price ? (self.form.price / 100).toString() : '0'
+          self.memberPriceYuan = self.form.memberPrice && self.form.memberPrice > 0 ? (self.form.memberPrice / 100).toString() : ''
           if (d.startTime) {
             var sd = new Date(d.startTime.replace ? d.startTime.replace(/-/g, '/') : d.startTime)
             self.datePart = self.fmtDate(sd)
@@ -336,7 +344,7 @@ export default {
       var payload = Object.assign({}, this.form)
       payload.maxParticipants = parseInt(this.maxParticipantsStr) || 0
       payload.price = Math.round((parseFloat(this.priceYuan) || 0) * 100)
-      payload.memberPrice = payload.price // 会员价默认等于普通价
+      payload.memberPrice = this.memberPriceYuan ? Math.round(parseFloat(this.memberPriceYuan) * 100) : payload.price
       if (this.activityId) payload.id = this.activityId
       return payload
     },