settlementDialog.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. <template>
  2. <el-dialog
  3. class="common-dialog"
  4. :title="$t('zhi-fu-jie-suan')"
  5. :visible="showDialog"
  6. width="1100px"
  7. @close="cancel"
  8. destroy-on-close
  9. >
  10. <el-dialog
  11. class="common-dialog"
  12. width="800px"
  13. :title="$t('xuan-ze-qia-quan')"
  14. :visible.sync="showCouponDialog"
  15. append-to-body
  16. destroy-on-close
  17. >
  18. <div class="coupon-list">
  19. <div class="none" v-if="!memberInfo || !myCouponList || myCouponList.length < 1">
  20. {{ $t('zan-wu-ke-yong-qia-quan') }}
  21. </div>
  22. <div class="row" v-for="couponList in myCouponList">
  23. <div class="item active" v-for="coupon in couponList">
  24. <div @click="useThisCoupon(coupon)">
  25. <div class="left">
  26. <div class="amount">¥{{ coupon.amount }}</div>
  27. <div class="tips">{{ coupon.description }}</div>
  28. </div>
  29. <div class="right">
  30. <div class="name">{{ coupon.name }}</div>
  31. <div class="time">{{ coupon.effectiveDate }}</div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </el-dialog>
  38. <el-form ref="form" label-width="0px">
  39. <div class="settlement">
  40. <div class="left">
  41. <div class="title">{{ $t('qing-xuan-ze-zhi-fu-fang-shi') }}</div>
  42. <div class="content">
  43. <div
  44. :class="'pay-item' + (payType == 'CASH' ? ' active' : '')"
  45. @click="selectPayType('CASH')"
  46. >
  47. <svg
  48. t="1656296356619"
  49. class="icon"
  50. viewBox="0 0 1024 1024"
  51. version="1.1"
  52. xmlns="http://www.w3.org/2000/svg"
  53. p-id="10192"
  54. width="32"
  55. height="32"
  56. >
  57. <path
  58. d="M2.323 512C2.323 230.513 230.513 2.323 512 2.323S1021.677 230.513 1021.677 512 793.487 1021.677 512 1021.677 2.323 793.487 2.323 512L2.323 512zM664.053 441.296c-102.278-0.011-185.336 83.036-185.402 185.369-0.055 102.377 83.201 185.567 185.677 185.523 101.981-0.044 185.072-83.135 185.226-185.237C849.697 524.552 766.518 441.306 664.053 441.296zM689.881 615.395c9.786 0 19.572 0.11 29.357-0.055 3.112-0.055 4.002 0.99 3.892 3.991-0.209 5.619-0.055 11.237-0.055 17.296l-49.237 0 0 27.488 48.918 0 0 21.155L673.74 685.27c-0.088 1.792-0.209 3.211-0.209 4.629-0.011 10.896-0.099 21.804 0.044 32.7 0.044 3.068-0.913 4.035-3.958 3.936-6.234-0.209-12.48-0.209-18.714 0-3.013 0.099-4.002-0.792-3.947-3.892 0.176-10.896 0.066-21.804 0.066-32.7l0-4.431-51.315 0 0-21.188 51.084 0L646.791 636.78l-51.37 0c0-6.784-0.11-13.117 0.154-19.44 0.033-0.693 2.232-1.836 3.442-1.847 11.743-0.143 23.486-0.088 35.229-0.088 1.33 0 2.65 0 4.772 0-17.933-30.831-35.526-61.09-53.492-91.975 1.924-0.121 3.178-0.275 4.442-0.275 6.85-0.022 13.7 0.176 20.55-0.088 3.365-0.132 5.212 0.957 6.784 3.991 14.228 27.323 28.61 54.559 42.958 81.827 0.11 0.209 0.286 0.385 0.253 0.341 14.822-27.554 29.665-55.053 44.377-82.651 1.418-2.661 3.035-3.573 5.959-3.486 6.597 0.209 13.205 0.055 19.813 0.077 1.177 0 2.353 0.11 4.211 0.209-18.098 30.809-35.889 61.101-54.053 92.03C684.35 615.395 687.121 615.395 689.881 615.395zM300.198 231.253c4.937 3.573 9.984 7.642 15.118 12.205 5.146 4.563 9.775 9.819 13.887 15.778 2.056 3.178 4.53 6.751 7.411 10.72 2.881 3.969 5.553 7.939 8.027 11.908 2.881 4.365 5.762 8.928 8.642 13.689L481.07 295.553c2.881-3.969 5.553-8.136 8.027-12.502 2.056-3.573 4.321-7.147 6.795-10.72 2.463-3.573 4.728-6.751 6.795-9.522 4.112-5.553 8.235-10.819 12.348-15.778 4.112-4.959 10.083-9.819 17.9-14.58 3.299-1.99 6.069-4.563 8.334-7.741 2.265-3.178 3.705-6.344 4.321-9.522 0.616-3.178 0.209-6.256-1.231-9.225-1.44-2.98-4.211-5.256-8.334-6.839-3.705-1.188-6.894-1.583-9.566-1.188-2.672 0.396-5.355 1.089-8.027 2.089-2.672 0.99-5.454 2.089-8.334 3.277-2.881 1.188-6.377 1.781-10.5 1.781-4.112 0-7.51-0.693-10.182-2.089-2.672-1.385-5.146-3.079-7.411-5.058-2.265-1.979-4.629-4.068-7.103-6.256-2.463-2.188-5.762-3.87-9.874-5.058-8.224-3.178-14.811-3.771-19.747-1.781-4.937 1.99-9.874 5.157-14.822 9.522-4.112 3.969-7.411 6.751-9.874 8.334-1.231 0.792-2.265 1.187-3.09 1.187-2.474-1.187-4.728-2.573-6.795-4.167-2.056-1.198-4.013-2.485-5.861-3.87-1.847-1.385-3.595-3.068-5.245-5.058-3.288-3.178-8.224-5.256-14.811-6.256-6.586-0.99-12.546 0.099-17.9 3.277-6.993 4.365-11.93 8.038-14.811 11.017-2.881 2.98-7.202 5.058-12.963 6.245-3.288 0.792-6.894 0.594-10.797-0.594-3.903-1.187-7.917-2.375-12.04-3.573-4.112-1.188-8.027-1.979-11.732-2.386-3.727-0.418-7.015 0.385-9.896 2.364-5.762 4.365-7.609 9.621-5.553 15.778C291.148 222.809 294.854 227.679 300.198 231.253zM591.682 424.451c-0.352-0.385-0.682-0.814-1.034-1.198-10.489-11.314-20.682-21.133-30.556-29.467-11.93-9.522-22.43-18.56-31.479-27.092-9.06-8.532-16.669-16.174-22.837-22.925-7.411-7.543-13.579-14.481-18.516-20.836l-138.914 0c-5.355 6.751-11.523 13.887-18.516 21.43-5.762 6.751-12.963 14.195-21.606 22.331-8.642 8.136-18.318 16.768-29.017 25.894-12.348 10.325-23.761 22.024-34.261 35.13-10.5 13.106-19.242 27.488-26.235 43.167s-11.831 32.447-14.503 50.314c-2.672 17.856-2.166 36.515 1.539 55.966 3.299 17.461 10.083 35.031 20.374 52.689s24.179 33.635 41.672 47.928c17.493 14.283 38.791 25.905 63.893 34.833 25.102 8.928 53.91 13.392 86.423 13.392 19.033 0 36.691-1.572 53.272-4.365-14.184-28.687-22.353-60.848-22.342-94.977C449.106 533.414 508.679 454.215 591.682 424.451z"
  59. p-id="10193"
  60. fill="#ff5b57"
  61. ></path>
  62. </svg>
  63. <div class="name">{{ $t('xian-jin-zhi-fu-0') }}</div>
  64. </div>
  65. <!-- <div
  66. :class="'pay-item' + (payType == 'B2C' ? ' active' : '')"
  67. @click="selectPayType('B2C')"
  68. >
  69. <svg
  70. t="1656295559018"
  71. class="icon"
  72. viewBox="0 0 1024 1024"
  73. version="1.1"
  74. xmlns="http://www.w3.org/2000/svg"
  75. p-id="6471"
  76. width="32"
  77. height="32"
  78. >
  79. <path
  80. d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m286.4896 668.16a78.2336 78.2336 0 0 1-78.208 78.208H303.1808A78.2336 78.2336 0 0 1 224.9728 668.16V355.3536a78.1312 78.1312 0 0 1 78.1568-78.2336h417.1008a78.2336 78.2336 0 0 1 78.208 78.2336v91.1616h-208.5632a65.2032 65.2032 0 1 0 0 130.4064h208.6144z m-143.36-156.3904a39.1168 39.1168 0 1 1-39.1168-39.0912 39.1168 39.1168 0 0 1 39.0656 39.1936z"
  81. fill="#113a28"
  82. p-id="6472"
  83. ></path>
  84. </svg>
  85. <div class="name">{{ $t('yin-hang-zhi-fu') }}</div>
  86. </div> -->
  87. <!-- <div
  88. :class="'pay-item' + (payType == 'BALANCE' ? ' active' : '')"
  89. @click="selectPayType('BALANCE')"
  90. >
  91. <svg
  92. t="1656295559018"
  93. class="icon"
  94. viewBox="0 0 1024 1024"
  95. version="1.1"
  96. xmlns="http://www.w3.org/2000/svg"
  97. p-id="6471"
  98. width="32"
  99. height="32"
  100. >
  101. <path
  102. d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m286.4896 668.16a78.2336 78.2336 0 0 1-78.208 78.208H303.1808A78.2336 78.2336 0 0 1 224.9728 668.16V355.3536a78.1312 78.1312 0 0 1 78.1568-78.2336h417.1008a78.2336 78.2336 0 0 1 78.208 78.2336v91.1616h-208.5632a65.2032 65.2032 0 1 0 0 130.4064h208.6144z m-143.36-156.3904a39.1168 39.1168 0 1 1-39.1168-39.0912 39.1168 39.1168 0 0 1 39.0656 39.1936z"
  103. fill="#113a28"
  104. p-id="6472"
  105. ></path>
  106. </svg>
  107. <div class="name">{{ $t('yu-e-zhi-fu') }}</div>
  108. </div>
  109. <div
  110. :class="'pay-item' + (payType == 'MICROPAY' ? ' active' : '')"
  111. @click="selectPayType('MICROPAY')"
  112. >
  113. <svg
  114. t="1649925318920"
  115. class="icon"
  116. viewBox="0 0 1024 1024"
  117. version="1.1"
  118. xmlns="http://www.w3.org/2000/svg"
  119. p-id="2605"
  120. width="32"
  121. height="32"
  122. >
  123. <path
  124. d="M337.387283 341.82659c-17.757225 0-35.514451 11.83815-35.514451 29.595375s17.757225 29.595376 35.514451 29.595376 29.595376-11.83815 29.595376-29.595376c0-18.49711-11.83815-29.595376-29.595376-29.595375zM577.849711 513.479769c-11.83815 0-22.936416 12.578035-22.936416 23.6763 0 12.578035 11.83815 23.676301 22.936416 23.676301 17.757225 0 29.595376-11.83815 29.595376-23.676301s-11.83815-23.676301-29.595376-23.6763zM501.641618 401.017341c17.757225 0 29.595376-12.578035 29.595376-29.595376 0-17.757225-11.83815-29.595376-29.595376-29.595375s-35.514451 11.83815-35.51445 29.595375 17.757225 29.595376 35.51445 29.595376zM706.589595 513.479769c-11.83815 0-22.936416 12.578035-22.936416 23.6763 0 12.578035 11.83815 23.676301 22.936416 23.676301 17.757225 0 29.595376-11.83815 29.595376-23.676301s-11.83815-23.676301-29.595376-23.6763z"
  125. fill="#28C445"
  126. p-id="2606"
  127. ></path>
  128. <path
  129. d="M510.520231 2.959538C228.624277 2.959538 0 231.583815 0 513.479769s228.624277 510.520231 510.520231 510.520231 510.520231-228.624277 510.520231-510.520231-228.624277-510.520231-510.520231-510.520231zM413.595376 644.439306c-29.595376 0-53.271676-5.919075-81.387284-12.578034l-81.387283 41.433526 22.936416-71.768786c-58.450867-41.433526-93.965318-95.445087-93.965317-159.815029 0-113.202312 105.803468-201.988439 233.803468-201.98844 114.682081 0 216.046243 71.028902 236.023121 166.473989-7.398844-0.739884-14.797688-1.479769-22.196532-1.479769-110.982659 1.479769-198.289017 85.086705-198.289017 188.67052 0 17.017341 2.959538 33.294798 7.398844 49.572255-7.398844 0.739884-15.537572 1.479769-22.936416 1.479768z m346.265896 82.867052l17.757225 59.190752-63.630058-35.514451c-22.936416 5.919075-46.612717 11.83815-70.289017 11.83815-111.722543 0-199.768786-76.947977-199.768786-172.393063-0.739884-94.705202 87.306358-171.653179 198.289017-171.65318 105.803468 0 199.028902 77.687861 199.028902 172.393064 0 53.271676-34.774566 100.624277-81.387283 136.138728z"
  130. fill="#28C445"
  131. p-id="2607"
  132. ></path>
  133. </svg>
  134. <div class="name">{{ $t('wei-xin-zhi-fu') }}</div>
  135. </div>
  136. <div
  137. :class="'pay-item' + (payType == 'ALISCAN' ? ' active' : '')"
  138. @click="selectPayType('ALISCAN')"
  139. >
  140. <svg
  141. t="1681287790288"
  142. class="icon"
  143. viewBox="0 0 1024 1024"
  144. version="1.1"
  145. xmlns="http://www.w3.org/2000/svg"
  146. p-id="2581"
  147. width="32"
  148. height="32"
  149. >
  150. <path
  151. d="M230.404 576.536c-12.087 9.728-25.043 23.93-28.805 41.984-5.12 24.666-1.069 55.541 22.728 79.761 28.828 29.362 72.637 37.398 91.56 38.779 51.4 3.717 106.184-21.772 147.477-50.844 16.184-11.42 43.899-34.349 70.39-69.721-59.37-30.653-133.477-64.557-212.703-61.24-40.47 1.692-69.454 10.084-90.647 21.281z m752.859 135.545C1009.463 650.574 1024 582.968 1024 512 1024 229.688 794.335 0 512 0 229.665 0 0 229.688 0 512c0 282.335 229.665 512 512 512 170.385 0 321.491-83.723 414.631-212.124-87.997-43.742-233.027-115.734-322.36-159.299-42.63 48.596-105.65 97.303-176.84 118.495-44.722 13.29-85.037 18.365-127.199 9.75-41.739-8.548-72.481-28.093-90.401-47.683-9.127-9.995-19.612-22.706-27.203-37.82a71.25 71.25 0 0 0 1.202 3.049s-4.363-7.524-7.702-19.5a85.994 85.994 0 0 1-3.34-18.143 93.517 93.517 0 0 1-0.2-13.045c-0.378-7.702-0.066-15.783 1.67-24.064 4.185-20.235 12.822-43.81 35.172-65.692 49.063-48.039 114.777-50.621 148.814-50.42 50.421 0.289 138.04 22.35 211.812 48.439 20.436-43.52 33.547-90.068 42.007-121.1H305.308v-33.168h157.518v-66.337H272.139v-33.169h190.687v-66.315c0-9.105 1.803-16.584 16.584-16.584h74.619v82.899h207.293v33.169H554.029v66.337h165.82s-16.65 92.828-68.719 184.32c115.557 41.272 278.128 104.849 332.133 126.086z"
  152. fill="#1296DB"
  153. p-id="2582"
  154. ></path>
  155. </svg>
  156. <div class="name">{{ $t('zhi-fu-bao-zhi-fu') }}</div>
  157. </div>
  158. </div>-->
  159. </div>
  160. </div>
  161. <div class="main">
  162. <div class="title">{{ $t('jie-suan-xin-xi') }}</div>
  163. <div class="content">
  164. <!-- <div class="coupon-info">
  165. <div>
  166. {{ $t('ke-yong-ka-quan') }}:
  167. <span class="num">({{ memberInfo ? couponList.length : 0 }})</span>
  168. </div>
  169. <el-form-item class="form-item" prop="couponName">
  170. <el-input
  171. class="input-item"
  172. style="width: 450px"
  173. @focus="selectCoupon()"
  174. v-model="couponName"
  175. :placeholder="$t('qing-xuan-ze-ka-quan')"
  176. clearable
  177. />
  178. </el-form-item>
  179. </div> -->
  180. <div class="remark-info">
  181. <div>{{ $t('bei-zhu-xin-xi') }}:</div>
  182. <el-form-item class="form-item" prop="remark">
  183. <el-input
  184. class="caret-[#f67f20]"
  185. type="textarea"
  186. v-model="remark"
  187. ref="remark"
  188. :placeholder="$t('qing-shu-ru-bei-zhu-xin-xi')"
  189. clearable
  190. />
  191. </el-form-item>
  192. </div>
  193. <div class="discount-info">
  194. <!-- <el-row>
  195. <el-col :span="12">
  196. <div>{{ $t('zhe-kou-zhe') }}</div>
  197. <el-form-item class="form-item" prop="discount">
  198. <el-input
  199. type="text"
  200. v-model="discountAmount"
  201. style="width: 200px"
  202. :placeholder="$t('qing-shu-ru-zhe-kou')"
  203. clearable
  204. />
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="12">
  208. <div>{{ $t('li-jian') }}:({{ $t('yuan') }})</div>
  209. <el-form-item class="form-item" prop="reduce">
  210. <el-input
  211. type="text"
  212. v-model="reduceAmount"
  213. style="width: 200px"
  214. :placeholder="$t('qing-shu-ru-li-jian-jin-e-0')"
  215. clearable
  216. />
  217. </el-form-item>
  218. </el-col>
  219. </el-row> -->
  220. </div>
  221. <div class="amount-info">
  222. <span class="discount-amount">
  223. {{ $t('you-hui-jin-e') }}:¥
  224. <span class="value">{{ discountPrice.toFixed(2) }}</span>
  225. </span>
  226. <span class="pay-amount">
  227. {{ $t('ying-fu-jin-e') }}:¥
  228. <span class="value">{{ newTotalPrice.toFixed(2) }}</span>
  229. </span>
  230. </div>
  231. </div>
  232. </div>
  233. <!-- <div class="right">
  234. <div class="title">{{ $t('hui-yuan-xin-xi') }}</div>
  235. <div class="content">
  236. <div class="member-info" v-if="memberInfo">
  237. <div class="base">
  238. <img class="avatar" v-if="memberInfo.avatar" :src="memberInfo.avatar" />
  239. <img class="avatar" v-if="!memberInfo.avatar" src="@/assets/images/avatar.png" />
  240. <span class="name">{{ memberInfo.name }}</span>
  241. <div class="gender">
  242. <b v-if="memberInfo.sex" class="el-icon-male"></b>
  243. <b v-if="!memberInfo.sex" class="el-icon-female"></b>
  244. </div>
  245. </div>
  246. <div class="item">
  247. <div class="head">{{ $t('shou-ji-hao') }}:</div>
  248. <div class="value">{{ memberInfo.mobile ? memberInfo.mobile : $t('zan-wu') }}</div>
  249. </div>
  250. <div class="item">
  251. <div class="head">{{ $t('hui-yuan-hao') }}:</div>
  252. <div class="value">{{ memberInfo.userNo ? memberInfo.userNo : $t('zan-wu') }}</div>
  253. </div>
  254. <div class="item">
  255. <div class="head">{{ $t('ke-yong-yu-e') }}:</div>
  256. <div class="value">
  257. {{ memberInfo.balance ? memberInfo.balance.toFixed(2) : 0.0 }}(元)
  258. </div>
  259. </div>
  260. <div class="item">
  261. <div class="head">{{ $t('ke-yong-ji-fen') }}:</div>
  262. <div class="value">{{ memberInfo.point ? memberInfo.point : '0' }}</div>
  263. </div>
  264. <div class="re-select">
  265. <el-button
  266. calss="do-action"
  267. size="mini"
  268. type="danger"
  269. icon="el-icon-user"
  270. @click="bindToMember()"
  271. >
  272. {{ $t('chong-xin-xuan-ze') }}
  273. </el-button>
  274. </div>
  275. </div>
  276. <div class="guest" v-if="!memberInfo">
  277. <el-empty description="当前为游客" :image-size="30"></el-empty>
  278. <el-button
  279. calss="do-action"
  280. size="mini"
  281. type="danger"
  282. icon="el-icon-user"
  283. @click="bindToMember()"
  284. >
  285. {{ $t('guan-lian-hui-yuan') }}
  286. </el-button>
  287. </div>
  288. <div class="staff">
  289. <el-button
  290. v-if="staffInfo"
  291. calss="do-action"
  292. size="mini"
  293. type="primary"
  294. icon="el-icon-user"
  295. @click="bindToStaff()"
  296. >
  297. {{ $t('yi-guan-lian') }}({{ staffInfo.realName }})
  298. </el-button>
  299. <el-button
  300. v-if="!staffInfo"
  301. calss="do-action"
  302. size="mini"
  303. type="primary"
  304. icon="el-icon-user"
  305. @click="bindToStaff()"
  306. >
  307. {{ $t('guan-lian-yuan-gong') }}
  308. </el-button>
  309. </div>
  310. </div>
  311. </div> -->
  312. </div>
  313. </el-form>
  314. <div slot="footer" class="dialog-footer">
  315. <el-button type="primary" class="main-button" @click="submit()">
  316. {{ $t('que-ding-shou-kuan') }}
  317. </el-button>
  318. <el-button @click="cancel()">{{ $t('qu-xiao') }}</el-button>
  319. </div>
  320. </el-dialog>
  321. </template>
  322. <script>
  323. export default {
  324. props: {
  325. showDialog: {
  326. type: [Boolean],
  327. default: () => false,
  328. },
  329. memberInfo: {
  330. type: [Object],
  331. default: () => {},
  332. },
  333. staffInfo: {
  334. type: [Object],
  335. default: () => {},
  336. },
  337. orderInfo: {
  338. type: [Object],
  339. default: () => {},
  340. },
  341. couponList: {
  342. type: [Array],
  343. default: () => [],
  344. },
  345. totalPrice: {
  346. type: [Number],
  347. default: () => '0',
  348. },
  349. remarks: {
  350. type: [String],
  351. default: () => '',
  352. },
  353. },
  354. watch: {
  355. showDialog(value) {
  356. const app = this
  357. if (value) {
  358. if (app.orderInfo.id) {
  359. app.totalPrice = app.orderInfo.payAmount
  360. }
  361. app.discountAmount = ''
  362. app.reduceAmount = ''
  363. app.myCouponList = []
  364. app.couponName = ''
  365. app.userCouponId = 0
  366. app.remark = app.remarks
  367. app.computerPrice(app.discountAmount, app.reduceAmount)
  368. if (app.memberInfo) {
  369. for (let i = 0, len = app.couponList.length; i < len; i += 2) {
  370. app.myCouponList.push(app.couponList.slice(i, i + 2))
  371. }
  372. }
  373. }
  374. },
  375. discountAmount(value) {
  376. const reg = /^[0-9](.)*$/
  377. if (value < 0 || value > 10 || !reg.test(value)) {
  378. this.discountAmount = ''
  379. value = ''
  380. }
  381. this.computerPrice(value, this.reduceAmount)
  382. },
  383. reduceAmount(value) {
  384. const reg = /^[0-9](.)*$/
  385. if (value > this.totalPrice || value < 0 || !reg.test(value)) {
  386. this.reduceAmount = ''
  387. value = ''
  388. }
  389. this.computerPrice(this.discountAmount, value)
  390. },
  391. },
  392. data() {
  393. return {
  394. loading: false,
  395. discountPrice: 0,
  396. payType: '',
  397. userCouponId: 0,
  398. couponName: '',
  399. remark: '',
  400. discountAmount: '',
  401. reduceAmount: '',
  402. newTotalPrice: 0,
  403. showCouponDialog: false,
  404. myCouponList: [],
  405. }
  406. },
  407. methods: {
  408. // 选择支付方式
  409. selectPayType(type) {
  410. const app = this
  411. if (type == 'BALANCE' && !app.memberInfo) {
  412. app.$alert(this.$t('yu-e-zhi-fu-xu-guan-lian-hui-yuan-xin-xi'))
  413. return false
  414. }
  415. this.payType = type
  416. },
  417. // 选择卡券
  418. selectCoupon() {
  419. const app = this
  420. if (!app.memberInfo) {
  421. app.$alert(this.$t('qing-xian-guan-lian-hui-yuan-xin-xi'))
  422. app.$refs.remark.focus()
  423. return false
  424. } else {
  425. app.myCouponList = []
  426. app.couponName = ''
  427. app.userCouponId = 0
  428. app.computerPrice(app.discountAmount, app.reduceAmount)
  429. if (app.memberInfo) {
  430. for (let i = 0, len = app.couponList.length; i < len; i += 2) {
  431. app.myCouponList.push(app.couponList.slice(i, i + 2))
  432. }
  433. }
  434. app.showCouponDialog = true
  435. }
  436. },
  437. // 使用该卡券
  438. useThisCoupon(coupon) {
  439. const app = this
  440. app
  441. .$confirm(this.$t('que-ding-shi-yong-gai-qia-quan-ma'))
  442. .then(function () {
  443. app.$emit('useThisCoupon', coupon)
  444. app.couponName = coupon.name
  445. app.userCouponId = coupon.userCouponId
  446. app.showCouponDialog = false
  447. })
  448. .then(() => {
  449. // empty
  450. })
  451. .catch(function () {
  452. // empty
  453. })
  454. },
  455. // 提交结算
  456. submit() {
  457. const app = this
  458. if (app.payType == '') {
  459. app.$alert(this.$t('qing-xian-xuan-ze-zhi-fu-fang-shi'))
  460. return false
  461. }
  462. app.$emit('submit', {
  463. payType: this.payType,
  464. totalPrice: this.newTotalPrice,
  465. remark: this.remark,
  466. discountPrice: this.discountPrice,
  467. userCouponId: app.userCouponId,
  468. })
  469. app.payType = ''
  470. },
  471. cancel() {
  472. this.$emit('closeDialog', 'settlementDialog')
  473. this.payType = ''
  474. },
  475. computerPrice(discountAmount, reduceAmount) {
  476. if (this.orderInfo.id) {
  477. this.totalPrice = this.orderInfo.amount
  478. }
  479. let discountPrice = 0.0
  480. if (discountAmount.length > 0) {
  481. discountPrice = this.totalPrice - this.totalPrice * (discountAmount / 10)
  482. }
  483. if (reduceAmount.length > 0) {
  484. discountPrice = discountPrice + parseFloat(reduceAmount)
  485. }
  486. if (isNaN(discountPrice)) {
  487. this.discountAmount = ''
  488. this.reduceAmount = ''
  489. discountPrice = 0
  490. }
  491. this.discountPrice = discountPrice
  492. this.newTotalPrice = this.totalPrice - this.discountPrice
  493. if (this.newTotalPrice < 0) {
  494. this.newTotalPrice = 0
  495. }
  496. },
  497. // 关联会员
  498. bindToMember() {
  499. this.$emit('switchMember')
  500. },
  501. // 关联员工
  502. bindToStaff() {
  503. this.$emit('bindStaff')
  504. },
  505. },
  506. }
  507. </script>
  508. <style lang="scss" scoped>
  509. .coupon-list {
  510. text-align: center;
  511. .none {
  512. color: #666666;
  513. }
  514. .row {
  515. height: 80px;
  516. margin-bottom: 15px;
  517. .item {
  518. float: left;
  519. width: 45%;
  520. margin-left: 10px;
  521. height: 83px;
  522. border: solid 2px #113a28;
  523. cursor: pointer;
  524. border-radius: 2px;
  525. .left {
  526. width: 30%;
  527. height: 80px;
  528. float: left;
  529. background: #113a28;
  530. color: #ffffff;
  531. .amount {
  532. font-size: 24px;
  533. margin-top: 10px;
  534. font-weight: bold;
  535. }
  536. .tips {
  537. font-size: 12px;
  538. margin-top: 3px;
  539. }
  540. }
  541. .right {
  542. width: 70%;
  543. float: left;
  544. margin-top: 10px;
  545. text-align: left;
  546. padding-left: 10px;
  547. height: 80px;
  548. .time {
  549. margin-top: 3px;
  550. font-size: 12px;
  551. }
  552. }
  553. }
  554. }
  555. }
  556. .settlement {
  557. border: solid 1px #ccc;
  558. border-radius: 2px;
  559. min-height: 350px;
  560. margin: 0 auto;
  561. .left {
  562. width: 200px;
  563. float: left;
  564. height: 350px;
  565. padding: 10px;
  566. border-right: solid 1px #ccc;
  567. .title {
  568. margin-bottom: 10px;
  569. font-weight: bold;
  570. }
  571. .pay-item {
  572. height: 65px;
  573. line-height: 65px;
  574. border-radius: 2px;
  575. text-align: center;
  576. margin-bottom: 10px;
  577. border: solid 2px #cccccc;
  578. text-align: center;
  579. padding-left: 35px;
  580. cursor: pointer;
  581. .icon {
  582. margin-top: 15px;
  583. float: left;
  584. }
  585. .name {
  586. margin-left: 2px;
  587. font-size: 14px;
  588. color: #888888;
  589. float: left;
  590. }
  591. }
  592. .active {
  593. border: 3px solid #f67f20;
  594. background: #fdf5e6;
  595. .name {
  596. color: #f67f20;
  597. }
  598. }
  599. }
  600. .main {
  601. float: left;
  602. padding: 10px;
  603. // width: 598px;
  604. width: calc(100% - 200px);
  605. height: 348px;
  606. box-sizing: border-box;
  607. position: relative;
  608. .title {
  609. margin-bottom: 10px;
  610. font-weight: bold;
  611. }
  612. .content {
  613. width: 100%;
  614. box-sizing: border-box;
  615. .coupon-info {
  616. margin-top: 20px;
  617. .num {
  618. color: #ff5b57;
  619. font-weight: bold;
  620. }
  621. }
  622. .discount-info {
  623. height: 40px;
  624. }
  625. .amount-info {
  626. text-align: right;
  627. position: absolute;
  628. width: calc(100% - 20px);
  629. bottom: 10px;
  630. font-size: 16px;
  631. .discount-amount {
  632. margin-right: 50px;
  633. .value {
  634. font-size: 20px;
  635. }
  636. }
  637. .pay-amount {
  638. .value {
  639. font-weight: bold;
  640. color: #ff5b57;
  641. font-size: 20px;
  642. }
  643. }
  644. }
  645. }
  646. }
  647. .right {
  648. float: right;
  649. padding: 10px;
  650. width: 200px;
  651. height: 350px;
  652. border-left: solid 1px #ccc;
  653. .title {
  654. margin-bottom: 10px;
  655. font-weight: bold;
  656. }
  657. .content {
  658. .member-info {
  659. .base {
  660. height: 50px;
  661. .avatar {
  662. width: 50px;
  663. height: 50px;
  664. border-radius: 25px;
  665. border: solid 2px #cccccc;
  666. float: left;
  667. }
  668. .name {
  669. font-weight: bold;
  670. font-size: 14px;
  671. }
  672. .gender {
  673. margin-left: 52px;
  674. .el-icon-male {
  675. font-size: 16px;
  676. color: #2b2f3a;
  677. }
  678. .el-icon-female {
  679. font-size: 16px;
  680. color: deeppink;
  681. }
  682. }
  683. }
  684. .item {
  685. margin-top: 5px;
  686. border: dashed 1px #cccccc;
  687. padding: 5px;
  688. .head {
  689. float: left;
  690. }
  691. .value {
  692. margin-top: 1px;
  693. text-align: left;
  694. }
  695. }
  696. .re-select {
  697. margin: 10px auto;
  698. text-align: center;
  699. }
  700. }
  701. .guest {
  702. margin-top: 20px;
  703. text-align: center;
  704. .do-action {
  705. height: 8px;
  706. line-height: 8px;
  707. }
  708. }
  709. .staff {
  710. margin-top: 10px;
  711. text-align: center;
  712. .do-action {
  713. height: 8px;
  714. line-height: 8px;
  715. }
  716. }
  717. }
  718. }
  719. }
  720. </style>