kevin_zhangl 3 лет назад
Родитель
Сommit
4703f6ad79

+ 6 - 6
src/components/LangSelect/index.vue

@@ -10,12 +10,12 @@
       <el-dropdown-item :disabled="language==='en'" command="en">
         English
       </el-dropdown-item>
-      <el-dropdown-item :disabled="language==='es'" command="es">
-        Español
-      </el-dropdown-item>
-      <el-dropdown-item :disabled="language==='ja'" command="ja">
-        日本語
-      </el-dropdown-item>
+<!--      <el-dropdown-item :disabled="language==='es'" command="es">-->
+<!--        Español-->
+<!--      </el-dropdown-item>-->
+<!--      <el-dropdown-item :disabled="language==='ja'" command="ja">-->
+<!--        日本語-->
+<!--      </el-dropdown-item>-->
     </el-dropdown-menu>
   </el-dropdown>
 </template>

+ 0 - 4
src/store/modules/user.js

@@ -2,10 +2,6 @@ import { login, isLoginVerify, getUserInfo, getBaseInfo, getMessageData } from '
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import router, { resetRouter } from '@/router'
 import usersInfo from '@/utils/usersInfo'
-import {
-  clearBaseInfo,
-  setBaseInfo
-} from '@/utils/localUserInfo'
 
 const state = {
   token: getToken(),

+ 49 - 12
src/views/profile/components/Account.vue

@@ -1,18 +1,27 @@
 <template>
-  <el-form>
-    <el-form-item label="Name">
-      <el-input v-model.trim="user.name" />
+  <el-form wi v-loading="loading">
+    <el-form-item :label="$t('shop.memberCode')">
+      <el-input size="medium" v-model.trim="user.name" prefix-icon="el-icon-user-solid" readonly />
     </el-form-item>
-    <el-form-item label="Email">
-      <el-input v-model.trim="user.email" />
+		<el-form-item :label="$t('shop.memberName')">
+			<el-input size="medium" v-model.trim="user.realName" prefix-icon="el-icon-user" readonly />
+		</el-form-item>
+		<el-form-item :label="$t('shop.phoneNumber')">
+			<el-input size="medium" v-model.trim="user.mobile" prefix-icon="el-icon-phone-outline" readonly />
+		</el-form-item>
+    <el-form-item :label="$t('user.email')">
+      <el-input size="medium" v-model.trim="user.email" prefix-icon="el-icon-s-comment" />
     </el-form-item>
     <el-form-item>
-      <el-button type="primary" @click="submit">Update</el-button>
+      <el-button type="primary" size="small" @click="submit">{{ $t('common.save') }}</el-button>
     </el-form-item>
   </el-form>
 </template>
 
 <script>
+
+import { updateInfo } from '@/api/user'
+import usersInfo from '@/utils/usersInfo'
 export default {
   props: {
     user: {
@@ -20,18 +29,46 @@ export default {
       default: () => {
         return {
           name: '',
-          email: ''
+          email: '',
+					mobile: '',
+					realName: '',
         }
       }
     }
   },
+	data() {
+		return {
+			loading: false,
+		}
+	},
   methods: {
     submit() {
-      this.$message({
-        message: 'User information has been updated successfully',
-        type: 'success',
-        duration: 5 * 1000
-      })
+			const data = {
+				email: this.user.email,
+			}
+
+			this.loading = true
+			updateInfo(data).then(() => {
+				setTimeout(() => {
+					this.loading = false
+				}, 1.5 * 1000)
+				this.$message({
+					message: 'User information has been updated successfully.',
+					type: 'success',
+					duration: 5 * 1000
+				})
+				// 覆盖localStorage
+				usersInfo.userEmail(this.user.email)
+				// 页面重载
+				location.reload()
+			}).catch((err) => {
+				this.$message({
+					message: err,
+					type: 'error',
+					duration: 5 * 1000
+				})
+				this.loading = false
+			})
     }
   }
 }

+ 65 - 0
src/views/profile/components/LoginPassword.vue

@@ -0,0 +1,65 @@
+<template>
+  <el-form wi v-loading="loading">
+    <el-form-item :label="$t('shop.originalPassword')">
+      <el-input size="medium" type="password" v-model.trim="password.oldPassword" prefix-icon="el-icon-user-solid" readonly />
+    </el-form-item>
+		<el-form-item :label="$t('shop.memberName')">
+			<el-input size="medium" type="password" v-model.trim="password.password" prefix-icon="el-icon-user" readonly />
+		</el-form-item>
+		<el-form-item :label="$t('shop.phoneNumber')">
+			<el-input size="medium" type="password" v-model.trim="password.verifyPassword" prefix-icon="el-icon-phone-outline" readonly />
+		</el-form-item>
+    <el-form-item>
+      <el-button type="primary" size="small" @click="submit">{{ $t('common.save') }}</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script>
+import { updateInfo } from '@/api/user'
+import usersInfo from '@/utils/usersInfo'
+export default {
+  props: {
+
+  },
+	data() {
+		return {
+			loading: false,
+			password: {
+				type: Object,
+				default: () => {
+					return {
+						oldPassword: '',
+						password: '',
+						verifyPassword: '',
+					}
+				}
+			}
+		}
+	},
+  methods: {
+    submit() {
+			this.loading = true
+			updateInfo(this.password).then(response => {
+				setTimeout(() => {
+					this.loading = false
+				}, 1.5 * 1000)
+				this.$message({
+					message: 'User login password has been updated successfully.',
+					type: 'success',
+					duration: 5 * 1000
+				})
+				// 强制重新登录
+				usersInfo.logout()
+			}).catch((err) => {
+				this.$message({
+					message: err,
+					type: 'error',
+					duration: 5 * 1000
+				})
+				this.loading = false
+			})
+    }
+  }
+}
+</script>

+ 67 - 0
src/views/profile/components/PaymentPassword.vue

@@ -0,0 +1,67 @@
+<template>
+  <el-form wi v-loading="loading">
+    <el-form-item :label="$t('shop.memberCode')">
+      <el-input size="medium" v-model.trim="user.name" prefix-icon="el-icon-user-solid" readonly />
+    </el-form-item>
+		<el-form-item :label="$t('shop.memberName')">
+			<el-input size="medium" v-model.trim="user.realName" prefix-icon="el-icon-user" readonly />
+		</el-form-item>
+		<el-form-item :label="$t('shop.phoneNumber')">
+			<el-input size="medium" v-model.trim="user.mobile" prefix-icon="el-icon-phone-outline" readonly />
+		</el-form-item>
+    <el-form-item>
+      <el-button type="primary" size="small" @click="submit">{{ $t('common.save') }}</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script>
+import { updateInfo } from '@/api/user'
+import usersInfo from '@/utils/usersInfo'
+export default {
+  props: {
+    user: {
+      type: Object,
+      default: () => {
+        return {
+          name: '',
+          email: '',
+					mobile: '',
+					realName: '',
+        }
+      }
+    }
+  },
+	data() {
+		return {
+			loading: false,
+		}
+	},
+  methods: {
+    submit() {
+			const data = {
+				email: this.user.email,
+			}
+
+			this.loading = true
+			updateInfo(data).then(() => {
+				setTimeout(() => {
+					this.loading = false
+				}, 1.5 * 1000)
+				this.$message({
+					message: 'User information has been updated successfully.',
+					type: 'success',
+					duration: 5 * 1000
+				})
+			}).catch((err) => {
+				this.$message({
+					message: err,
+					type: 'error',
+					duration: 5 * 1000
+				})
+				this.loading = false
+			})
+    }
+  }
+}
+</script>

+ 151 - 38
src/views/profile/components/UserCard.vue

@@ -1,59 +1,163 @@
 <template>
-  <el-card style="margin-bottom:20px;">
+  <el-card>
     <div slot="header" class="clearfix">
-      <span>About me</span>
+      <span>{{ $t('profile.personalInformation') }}</span>
     </div>
 
     <div class="user-profile">
       <div class="box-center">
         <pan-thumb :image="user.avatar" :height="'100px'" :width="'100px'" :hoverable="false">
           <div>Hello</div>
-          {{ user.role }}
         </pan-thumb>
       </div>
       <div class="box-center">
-        <div class="user-name text-center">{{ user.name }}</div>
-        <div class="user-role text-center text-muted">{{ user.role | uppercaseFirst }}</div>
+        <div class="user-name text-center"><svg-icon icon-class="user" /> {{ user.name }}</div>
+<!--        <div class="user-role text-center text-muted">{{ user.role | uppercaseFirst }}</div>-->
       </div>
     </div>
 
     <div class="user-bio">
-      <div class="user-education user-bio-section">
-        <div class="user-bio-section-header"><svg-icon icon-class="education" /><span>Education</span></div>
-        <div class="user-bio-section-body">
-          <div class="text-muted">
-            JS in Computer Science from the University of Technology
-          </div>
-        </div>
-      </div>
-
-      <div class="user-skills user-bio-section">
-        <div class="user-bio-section-header"><svg-icon icon-class="skill" /><span>Skills</span></div>
-        <div class="user-bio-section-body">
-          <div class="progress-item">
-            <span>Vue</span>
-            <el-progress :percentage="70" />
-          </div>
-          <div class="progress-item">
-            <span>JavaScript</span>
-            <el-progress :percentage="18" />
-          </div>
-          <div class="progress-item">
-            <span>Css</span>
-            <el-progress :percentage="12" />
-          </div>
-          <div class="progress-item">
-            <span>ESLint</span>
-            <el-progress :percentage="100" status="success" />
-          </div>
-        </div>
-      </div>
+			<div class="user-skills user-bio-section">
+				<div class="user-bio-section-header"></div>
+				<div class="user-bio-section-body">
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-time"></i>
+									<span>Current System Time</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+	<!--						<span>{{ tool.getTimestamp() }}</span>-->
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-time"></i>
+									<span>Member Join Time</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>{{ user.joinAt | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-star-on"></i>
+									<span>Member Level</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-s-data"></i>
+									<span>Remain BV</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-medal"></i>
+									<span>Highest Director</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-medal-1"></i>
+									<span>Highest Crown</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-picture-outline-round"></i>
+									<span>Current Pay Cycle</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+
+					<div class="progress-item" style="margin-top: 15px;">
+						<el-row>
+							<el-col :span="12">
+								<div class="grid-content bg-purple">
+									<i class="el-icon-time"></i>
+									<span>Active Deadline Date</span>
+								</div>
+							</el-col>
+							<el-col :span="12">
+								<div class="grid-content bg-purple-light">
+									<span>VIP</span>
+								</div>
+							</el-col>
+						</el-row>
+					</div>
+				</div>
+			</div>
     </div>
   </el-card>
 </template>
 
 <script>
 import PanThumb from '@/components/PanThumb'
+import tool from '@/utils/tool'
+import { parseTime } from '@/utils'
+import usersInfo from "@/utils/usersInfo"
 
 export default {
   components: { PanThumb },
@@ -65,11 +169,20 @@ export default {
           name: '',
           email: '',
           avatar: '',
-          role: ''
+          role: '',
+					decLv: '',
+					empLv: '',
+					crownLv: '',
+					joinAt: 0,
         }
       }
-    }
-  }
+    },
+  },
+	data() {
+		return {
+			tool: tool,
+		}
+	},
 }
 </script>
 

+ 32 - 15
src/views/profile/index.vue

@@ -3,21 +3,21 @@
     <div v-if="user">
       <el-row :gutter="20">
 
-        <el-col :span="6" :xs="24">
+        <el-col :span="8" :xs="24">
           <user-card :user="user" />
         </el-col>
 
-        <el-col :span="18" :xs="24">
+        <el-col :span="8" :xs="24">
           <el-card>
             <el-tabs v-model="activeTab">
-              <el-tab-pane label="Activity" name="activity">
-                <activity />
+              <el-tab-pane :label="$t('profile.account')" name="account">
+                <account :user="user" />
               </el-tab-pane>
-              <el-tab-pane label="Timeline" name="timeline">
-                <timeline />
+              <el-tab-pane :label="$t('profile.loginPassword')" name="loginPassword">
+                <login-password />
               </el-tab-pane>
-              <el-tab-pane label="Account" name="account">
-                <account :user="user" />
+              <el-tab-pane :label="$t('profile.paymentPassword')" name="paymentPassword">
+                <activity />
               </el-tab-pane>
             </el-tabs>
           </el-card>
@@ -34,22 +34,33 @@ import UserCard from './components/UserCard'
 import Activity from './components/Activity'
 import Timeline from './components/Timeline'
 import Account from './components/Account'
+import usersInfo from '@/utils/usersInfo'
+import { parseTime } from '@/utils'
+import LoginPassword from '@/views/profile/components/LoginPassword'
 
 export default {
   name: 'Profile',
-  components: { UserCard, Activity, Timeline, Account },
+  components: { LoginPassword, UserCard, Activity, Timeline, Account },
   data() {
     return {
       user: {},
-      activeTab: 'activity'
+      activeTab: 'account'
     }
   },
   computed: {
     ...mapGetters([
       'name',
       'avatar',
-      'roles'
+      'roles',
+      'email',
+      'mobile',
+      'realName',
+      'decLv',
+      'crownLv',
+      'remainBV',
+      'joinAt'
     ])
+
   },
   created() {
     this.getUser()
@@ -57,10 +68,16 @@ export default {
   methods: {
     getUser() {
       this.user = {
-        name: this.name,
-        role: this.roles.join(' | '),
-        email: 'admin@test.com',
-        avatar: this.avatar
+				role: this.roles.join(' | '),
+        name: usersInfo.userName(),
+        email: usersInfo.baseData().EMAIL,
+        mobile: usersInfo.baseData().MOBILE,
+        realName: usersInfo.baseData().REAL_NAME,
+        avatar: usersInfo.baseData().AVATAR ? usersInfo.baseData().AVATAR : 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
+        decLv: usersInfo.baseData().DEC_LV,
+        empLv: usersInfo.baseData().EMP_LV,
+        crownLv: usersInfo.baseData().CROWN_LV,
+        joinAt: usersInfo.baseData().CREATED_AT
       }
     }
   }

+ 1 - 1
src/views/shop/dec-order-list.vue

@@ -131,7 +131,7 @@ import tool from '@/utils/tool'
 import Pagination from '@/components/Pagination'
 
 export default {
-  name: 'OrderList',
+  name: 'decOrderList',
   components: { Pagination },
   directives: { waves },
   filters: {

+ 1 - 1
src/views/shop/order-list.vue

@@ -127,7 +127,7 @@ import tool from '@/utils/tool'
 import Pagination from '@/components/Pagination'
 
 export default {
-  name: 'OrderList',
+  name: 'orderList',
   components: { Pagination },
   directives: { waves },
   filters: {

+ 440 - 0
src/views/shop/shopping-cart.vue

@@ -0,0 +1,440 @@
+<template>
+    <div v-loading="loading">
+        <div class="white-box">
+            <el-table :data="goods" style="width: 100%" show-summary :summary-method="getSummaries">
+                <el-table-column label="Product Picture" >
+                    <template slot-scope="{row}">
+                        <el-image
+													style="width: 100px; height: 100px"
+													:src="tool.getArImage(row.COVER, '/files/')"
+													:preview-src-list="[tool.getArImage(row.COVER, '/files/')]">
+												</el-image>
+                    </template>
+                </el-table-column>
+
+							<el-table-column label="Product Name" prop="GOODS_NAME"></el-table-column>
+
+                <el-table-column label="Product Price" prop="member_price">
+                    <template slot-scope="scope">
+                        <span>{{ Math.round(scope.row.member_price * 100) / 100 }}</span>
+                    </template>
+                </el-table-column>
+
+                <el-table-column label="Tax Rate" prop="TAX_RATE">
+                    <template slot-scope="scope">
+                        <span>{{ Math.round(scope.row.TAX_RATE * 100) / 100 }}</span>
+                    </template>
+                </el-table-column>
+
+                <el-table-column label="Tax" prop="tax_amount_plus">
+                    <template slot-scope="scope">
+                        <span>{{ Math.round(scope.row.tax_amount_plus * 100) / 100 }}</span>
+                    </template>
+                </el-table-column>
+
+                <el-table-column label="Quantity" prop="chose_num"></el-table-column>
+
+                <el-table-column label="Total Amount" prop="member_price_plus">
+                    <template slot-scope="scope">
+                        <span>{{ Math.round(scope.row.member_price_plus * 100) / 100 }}</span>
+                    </template>
+                </el-table-column>
+        </el-table>
+
+            <div class="address_box">
+                Please select the shipping address:	<!--  请选择收货地址 -->
+                <el-radio-group v-model="addressId" @change='choseAddress'>
+                    <div v-for="(item , index) in all_address" :key='index' class="address">
+                        <el-radio :label="item.ID" >
+                            Full Address:{{item.ADDRESS}}, {{item.CITY_NAME}}, {{item.LGA_NAME}}, {{item.PROVINCE_NAME}}<!-- 详细地址 -->
+                            Recipient Name:{{item.CONSIGNEE}}<!-- 收件人姓名 -->
+                            Phone Number:{{item.MOBILE}}<!-- 手机号码 -->
+                        </el-radio>
+                    </div>
+                    <div class="address">
+                        <el-radio label="100000000000000000">Self Pick-up</el-radio><!--自提-->
+                    </div>
+                </el-radio-group>
+            </div>
+
+            <div class="box address_box">
+                Total Orders:<!-- 订单合计 -->
+                <div class="sum">
+                    <div class="sum_box">
+                        <div>Freight</div><!-- 运费 -->
+                        <div>{{ pointFreight }} {{ unit }}</div>
+                    </div>
+                    <div class="sum_box">
+                        <div>Amount Paid</div><!-- 实付金额 -->
+                        <div>
+                            <span>{{ prefixSign }} {{ pointsSum }} {{ unit }}</span>
+                        </div>
+                    </div>
+                </div>
+          </div>
+
+            <div class="">
+                <el-button type="danger"  size="small" @click="cancelOrder()">Go Back</el-button>
+                <el-button type="primary" size="small" @click="goToAccounts()" :loading="submitButtonStat">Pay</el-button><!--去结算-->
+            </div>
+        </div>
+
+        <!-- payStack模态框 -->
+        <el-dialog title="Pay" v-if="visible" :visible.sync="visible" width="30%" v-loading="payStackLoading" :before-close="handleClose">
+            <section>
+                <div class="formcontainer">
+                    <el-divider></el-divider>
+                    <div class="container">
+                        <el-form :model="form">
+                            <el-form-item label="Email" label-width="100px" required>
+                                <el-input v-model="form.email" autocomplete="off"></el-input>
+                            </el-form-item>
+                            <el-form-item label="Amount" label-width="100px" required>
+                                <el-input v-model="form.amount" autocomplete="off" readonly></el-input>
+                            </el-form-item>
+                        </el-form>
+                    </div>
+                </div>
+            </section>
+            <paystack
+                :firstname="form.firstname"
+                :lastname="form.lastname"
+                :amount="form.amount * 100"
+                :email="form.email"
+                :metadata="form.metadata"
+                :currency="form.currency"
+                :paystackkey="form.publicKey"
+                :reference="reference"
+                :channels="channels"
+                :callback="processPayment"
+                :close="processClose"
+            >
+            <el-button type="primary" size="small">Pay</el-button>
+            </paystack>
+            <el-button type="danger" size="small" class="cancelButton" @click="handleClose">Cancel</el-button>
+    </el-dialog>
+
+        <!-- 倒计时页面 -->
+        <el-dialog title="Tips" :visible.sync="payDialog" :show-close="false" width="350px" :close="handleOrderList">
+            <el-result icon="success" title="the order is successful">
+                <template slot="extra">
+                    <span style="color: #008efa; font-size: 30px;">{{ countdown }}</span>
+                </template>
+            </el-result>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { fetchProductList, fetchProduct } from '@/api/shop';
+import waves from '@/directive/waves';
+import { parseTime } from '@/utils';
+import tool from '@/utils/tool';
+
+export default{
+    name: 'shoppingCart',
+    data: function () {
+        return {
+            tool: tool,
+            loading: true,
+            goods: [],
+            payList: [],
+            pointsSum: '',
+            cashSum: '',
+            freight: '',
+            pointFreight: '',
+            freeShipping: '',
+            goodsId: '',
+            goodsNum: '',
+            payPassword: '',
+            submitButtonStat: false,
+            prefixSign: '₦',
+            unit: 'NGN',
+            sn: '',
+            orderType: '',
+            payDialog: false,
+            countdown: 5,
+            visible: false,
+            payType: 'pay_stack',
+            payStackLoading: false,
+            channels: ["card", "bank", "ussd", "qr"],
+            form: {
+                publicKey: PAY_STACK_PUBLIC_KEY,
+                currency: PAY_STACK_CURRENCY,
+                firstname: userInfo.userName(),
+                lastname: '',
+                email: userInfo.userEmail(),
+                amount: 0, // kobo
+                orderSn: '',
+                metadata: {
+                    cart_id: this.sn,
+                    custom_fields: [
+                        {
+                            display_name: 'orderSn',
+                            variable_name: 'orderSn',
+                            value: this.sn,
+                        },
+                        {
+                          display_name: 'orderType',
+                          variable_name: 'orderType',
+                          value: 'baOrder'
+                        },
+                    ]
+            },
+          },
+            regionData: store.state.regionInfo.regionData,
+            addressId: '100000000000000000',
+            all_address: [],
+        }
+    },
+    components: {
+        paystack
+    },
+    created() {
+        // 加载sessionStorage中推送的商品
+        let option = sessionStorage.getItem('order_goods');
+        // 加载购物车
+        this.getShowCart();
+        if (option) {
+            let pageGoodsList = JSON.parse(option);
+            let pageList;
+            for (let i in pageGoodsList) {
+                pageList = pageGoodsList[i];
+                if (!pageList) continue;
+
+                pageList.map((pageData, index) => {
+                    if (Number(pageData.chose_num) > 0) {
+                        let discount = pageData.DISCOUNT / 100;
+                        pageData.member_price = Math.round(pageData.SELL_PRICE * discount * 100) / 100;
+                        pageData.member_price_plus = Math.round(pageData.SELL_PRICE * Number(pageData.chose_num) * discount * 100) / 100;
+                        pageData.tax_amount_plus = Math.round((pageData.member_price - pageData.member_price / (1 + pageData.TAX_RATE / 100)) * pageData.chose_num * 100) / 100;
+                        this.goods.push(pageData)
+                    }
+                })
+            }
+            // 计算价格
+          this.getSumMoney();
+        }
+    },
+    computed: {
+        // PayStack混淆串
+        reference() {
+            let text = '';
+            let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+            for (let i = 0; i < 10; i++) {
+                text += possible.charAt(Math.floor(Math.random() * possible.length));
+            }
+            return text;
+        }
+    },
+    methods: {
+        // 取消订单
+        cancelOrder() {
+            history.go(-1)
+        },
+        // 设置运费
+        setFreight() {
+            // 如果地址为自提,则运费为0
+            this.pointFreight = (this.addressId === '100000000000000000') ? Number(0) : Number(this.freight);
+        },
+        // 表格合并
+        getSummaries(param) {
+            const { columns, data } = param;
+            const sums = [];
+            columns.forEach((column, index) => {
+                if (index === 0) {
+                    sums[index] = 'Total'; // 合计
+                    return;
+                }
+                const values = data.map(item => Number(item[column.property]));
+                if ((!values.every(value => isNaN(value))) && [4, 5, 6].includes(index)) {
+                    sums[index] = values.reduce((prev, curr) => {
+                        const value = Number(curr);
+                        if (!isNaN(value)) {
+                            return Math.round((prev + curr) * 100) / 100;
+                        } else {
+                            return Math.round(prev * 100) / 100;
+                        }
+                    }, 0);
+                }
+            });
+
+            return sums;
+        },
+        // 支付
+        goToAccounts() {
+            this.submitButtonStat = true
+            this.$prompt('Please enter your payment password', 'Hint', { // '请输入支付密码', '提示'
+                confirmButtonText: 'Confirm', // 确定
+                cancelButtonText: 'Cancel', // 取消
+                inputType: 'password',
+                inputPattern: /\S+/,
+                inputErrorMessage: 'Please enter your payment password' // 请输入支付密码
+            }).then(({value}) => {
+                this.payPassword = value
+                let params = {
+                    goodsId: this.goodsId,
+                    goodsNum: this.goodsNum,
+                    payPassword: this.payPassword,
+                    email: this.form.email,
+                    addressId: this.addressId,
+                    address: this.address,
+                };
+
+                // PayStack支付
+                return network.postData('shop/ba-sure-approach-order', params).then(response => {
+                    this.submitButtonStat = false;
+                    this.form.orderSn = response.SN;
+                    this.form.amount = this.cashSum;
+                    this.form.metadata.custom_fields[0].value = response.SN;
+                    this.visible = true;
+                }).catch(_ => {
+                    this.submitButtonStat = false;
+                });
+            }).catch(_ => {
+                this.submitButtonStat = false;
+            });
+        },
+        // 计算价格
+        getSumMoney () {
+            let cash_plus_sum = [];
+            let goodsId = [];
+            let goodsNum = [];
+            let choseNum = 0;
+            this.goods.map(item => {
+                choseNum = Number(item.chose_num);
+                if (choseNum > 0) {
+                    cash_plus_sum.push(item.SELL_PRICE * choseNum * (item.DISCOUNT / 100));
+                    goodsId.push(item.ID);
+                    goodsNum.push(choseNum);
+                }
+            })
+            this.goodsNum = goodsNum;
+            this.goodsId = goodsId;
+            // 增加运费
+            let payAmount = tool.sum(cash_plus_sum);
+            // 设置运费
+            this.setFreight();
+            // 商品总价大于预定值,免运费
+            this.pointFreight = (this.pointFreight > 0) ? ((payAmount >= this.freeShipping) ? 0 : this.freight) : 0
+            // 计算总价
+            this.pointsSum = this.cashSum = this.form.amount = tool.formatPrice(tool.sum(cash_plus_sum) + this.pointFreight) ;
+        },
+        // 展示购物车信息
+        getShowCart () {
+            network.getData('shop/ba-shopping-cart', {}).then(response => {
+                this.loading = false;
+                // 免运费阈值
+                this.freeShipping = response.freeShipping;
+                // 运费
+                this.freight = response.freight;
+                // 收货地址
+                this.all_address = response.allAddress;
+                this.all_address.map((item, index) => {
+                    if (item.IS_DEFAULT === 1) {
+                        this.addressId = item.ID
+                    }
+                })
+            }).catch(_ => {
+                this.loading = false;
+            })
+        },
+        // 选择收货地址
+        choseAddress (addressId) {
+            this.addressId = addressId;
+            // 设置运费
+            this.setFreight()
+            // 计算价格
+            this.getSumMoney()
+        },
+        // 关闭支付回调
+        handleClose() {
+            let _this = this
+            _this.$confirm('Confirm to close?').then(_ => {
+                return network.postData('shop/ba-delete-approach-order', { orderSn: this.form.orderSn }).then(_ => {
+                    // 关闭支付模态框
+                    _this.visible = false
+                    // 关闭购物车页面,返回到订单列表页
+                    sessionStorage.setItem('order_goods', null)
+                    this.$router.push({path: `/shop/ba-product-list`})
+                })
+            }).catch(_ => {
+                // 关闭支付模态框
+                _this.visible = false
+                // 关闭购物车页面,返回到订单列表页
+                sessionStorage.setItem('order_goods', null)
+                this.$router.push({path: `/shop/ba-product-list`})
+            })
+        },
+        // 支付成功回调
+        processPayment() {
+            // 关闭支付页面
+            this.visible = false
+            this.payStackLoading = false
+            // 显示支付成功模态框
+            this.payDialog = true;
+            // 启动支付成功倒计时
+            this.handleCountdown()
+        },
+        // 关闭支付回调
+        processClose () {
+            // 关闭支付模态框
+            this.visible = false
+            // 关闭购物车页面,返回到订单列表页
+            sessionStorage.removeItem('order_goods')
+            this.$router.push({path: `/shop/ba-product-list`})
+        },
+        // 倒计时结束跳转
+        handleOrderList () {
+            this.$router.push({path: `/shop/ba-order-list`})
+        },
+        // 启动倒计时
+        handleCountdown () {
+            // 创建定时器
+            setInterval(() => {
+                // 每隔1秒把time的值减一,赋值给span标签
+                this.countdown--
+                if (this.countdown === 0) {
+                    // 倒计时结束,跳转到订单列表
+                    this.$router.push({path: `/shop/ba-order-list`});
+                }
+            }, 1000)
+        },
+    },
+}
+</script>
+
+<style scoped>
+.address{
+    /* height: 3rem; */
+    line-height: 3.5rem;
+
+}
+.address_box{
+     border-bottom: 1px solid #e3e3e3;
+}
+.sum{
+    display: inline-block;
+}
+.box{
+    margin: 1rem 0;
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    padding-bottom: 1rem;
+}
+.sum_box{
+    display: flex;
+    margin-left: 1rem;
+}
+.sum_box > div{
+    line-height: 2rem;
+}
+.sum_box > div:nth-child(1){
+    margin-right: 1rem;
+}
+.payButton {
+    border: none;
+    padding: 0;
+}
+</style>