PublishComments.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="bg">
  3. <view class="commodity">
  4. <view @click="linkto(item)" class="mc_item" v-for="(item,index) in dataList.orderlist" :key="index">
  5. <view class="item_swipe">
  6. <view class="box_img">
  7. <u--image width="180rpx" height="180rpx" :src="item.fileList[0].fileUrl" ></u--image>
  8. </view>
  9. <view class="box_text">
  10. <view class="box_title">
  11. {{ item.name }}
  12. </view>
  13. <view class="box_type">
  14. 已选择 配方原料
  15. </view>
  16. <view class="box_num">
  17. <view class="bn_left">
  18. ¥1888
  19. </view>
  20. <view class="bn_right">
  21. {{ 'x' + item.num }}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <u-divider ></u-divider>
  28. <view class="rateBox">
  29. 整体满意度 <u-rate active-color="#ffcf00" inactive-color="#b2b2b2" :count="5" v-model="rateValue"></u-rate>
  30. </view>
  31. <view class="pjBox">
  32. <u--textarea v-model="value1" placeholder="展开对商品评价..."
  33. count maxlength="200" ></u--textarea>
  34. </view>
  35. <view class="upload">
  36. <u-upload
  37. :fileList="fileList1"
  38. @afterRead="afterRead"
  39. @delete="deletePic"
  40. name="1"
  41. multiple
  42. :maxCount="3"
  43. ></u-upload>
  44. </view>
  45. </view>
  46. <view style="height: 200rpx;"></view>
  47. <view class="btnBox">
  48. <view class="btn">
  49. 提交评价
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import env from "@/http/config/config.js"
  56. export default {
  57. components: {
  58. },
  59. data() {
  60. return {
  61. fileList1:[],
  62. value1:'',
  63. dataList:{
  64. orderlist:[
  65. {
  66. check:false,
  67. name:'产品名称产',
  68. num:2,
  69. },
  70. {
  71. check:false,
  72. name:'产品名称产品名称产品名称产品产品名称产品名称产品名称产品',
  73. num:1,
  74. }
  75. ],
  76. time:'2023-04-12 18:31:56',
  77. name:'产品名称产',
  78. type:'待付款',
  79. },
  80. }
  81. },
  82. onLoad() {
  83. },
  84. methods: {
  85. linktoPublishComments(){
  86. uni.navigateTo({
  87. url: '/pages/market/PublishComments'
  88. });
  89. },
  90. linkto(item){
  91. uni.navigateTo({
  92. url: '/pages/market/OrderDetails'
  93. });
  94. },
  95. // 删除图片
  96. deletePic(event) {
  97. this[`fileList${event.name}`].splice(event.index, 1)
  98. },
  99. // 新增图片
  100. async afterRead(event) {
  101. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  102. let lists = [].concat(event.file)
  103. let fileListLen = this[`fileList${event.name}`].length
  104. lists.map((item) => {
  105. this[`fileList${event.name}`].push({
  106. ...item,
  107. status: 'uploading',
  108. message: '上传中'
  109. })
  110. })
  111. for (let i = 0; i < lists.length; i++) {
  112. const result = await this.uploadFilePromise(lists[i].url)
  113. let item = this[`fileList${event.name}`][fileListLen]
  114. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  115. status: 'success',
  116. message: '',
  117. url: result
  118. }))
  119. fileListLen++
  120. }
  121. },
  122. uploadFilePromise(url) {
  123. return new Promise((resolve, reject) => {
  124. let a = uni.uploadFile({
  125. url: env.BASEURL + '/open/upload/uploadFile',
  126. filePath: url,
  127. name: 'file',
  128. formData: {
  129. user: 'test'
  130. },
  131. success: (res) => {
  132. const fileData = JSON.parse(res.data)
  133. if (fileData.code == 500) {
  134. resolve('')
  135. }else{
  136. const fileData = JSON.parse(res.data)
  137. resolve(fileData.data)
  138. }
  139. }
  140. });
  141. })
  142. },
  143. }
  144. }
  145. </script>
  146. <style>
  147. .bg{
  148. width: 750rpx;
  149. height: auto;
  150. min-height: 100vh;
  151. background: #F1F1F1;
  152. border-radius: 0rpx 0rpx 0rpx 0rpx;
  153. display: flex;
  154. flex-direction: column;
  155. align-items: center;
  156. }
  157. .commodity{
  158. width: 702rpx;
  159. height: auto;
  160. /* min-height: 954rpx; */
  161. background: #FFFFFF;
  162. border-radius: 16rpx 16rpx 16rpx 16rpx;
  163. opacity: 1;
  164. margin-top: 24rpx;
  165. /* padding-bottom: 100rpx; */
  166. }
  167. .commodity_title{
  168. width: 650rpx;
  169. height: 40rpx;
  170. font-size: 28rpx;
  171. font-weight: 500;
  172. color: #999;
  173. line-height: 40rpx;
  174. padding: 24rpx 0 0 24rpx;
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. }
  179. .mc_item{
  180. width: 702rpx;
  181. height: 244rpx;
  182. background: #FFFFFF;
  183. border-radius: 16rpx 16rpx 16rpx 16rpx;
  184. opacity: 1;
  185. margin-top: 24rpx;
  186. }
  187. .item_swipe{
  188. width: 678rpx;
  189. height: 244rpx;
  190. background: #FFFFFF;
  191. border-radius: 16rpx 16rpx 16rpx 16rpx;
  192. opacity: 1;
  193. display: flex;
  194. align-items: center;
  195. flex-direction: row;
  196. padding-left: 24rpx;
  197. }
  198. .box_img{
  199. width: 180rpx;
  200. height: 180rpx;
  201. background-color: #999999;
  202. }
  203. .box_text{
  204. width: 392rpx;
  205. height: 200rpx;
  206. margin-left: 20rpx;
  207. display: flex;
  208. flex-direction: column;
  209. justify-content: space-between;
  210. }
  211. .box_title{
  212. width: 392rpx;
  213. height: 40rpx;
  214. font-size: 28rpx;
  215. font-weight: bold;
  216. color: #333333;
  217. line-height: 40rpx;
  218. display: -webkit-box;
  219. word-break: break-all;
  220. text-overflow: ellipsis;
  221. overflow: hidden;
  222. -webkit-box-orient: vertical;
  223. -webkit-line-clamp:1;
  224. }
  225. .box_type{
  226. width: 410rpx;
  227. height: 48rpx;
  228. background: #EEEEEE;
  229. border-radius: 8rpx 8rpx 8rpx 8rpx;
  230. opacity: 1;
  231. font-size: 28rpx;
  232. font-weight: 500;
  233. color: #999999;
  234. padding-left: 24rpx;
  235. line-height: 48rpx;
  236. display: -webkit-box;
  237. word-break: break-all;
  238. text-overflow: ellipsis;
  239. overflow: hidden;
  240. -webkit-box-orient: vertical;
  241. -webkit-line-clamp:1;
  242. }
  243. .box_num{
  244. width: 410rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. }
  249. .rateBox{
  250. display: flex;
  251. margin: 24rpx;
  252. }
  253. .pjBox{
  254. margin-left: 24rpx;
  255. width: 654rpx;
  256. /* height: 320rpx; */
  257. background: #F1F1F1;
  258. border-radius: 16rpx 16rpx 16rpx 16rpx;
  259. opacity: 1;
  260. }
  261. .btnBox{
  262. width: 750rpx;
  263. height: 100rpx;
  264. background: #FFFFFF;
  265. border-radius: 0rpx 0rpx 0rpx 0rpx;
  266. opacity: 1;
  267. display: flex;
  268. flex-direction: row;
  269. justify-content: center;
  270. align-items: center;
  271. position: fixed;
  272. bottom: 0;
  273. }
  274. .btn{
  275. width: 702rpx;
  276. height: 80rpx;
  277. background: #46A6FF;
  278. border-radius: 64rpx 64rpx 64rpx 64rpx;
  279. opacity: 1;
  280. font-weight: 500;
  281. color: #FFFFFF;
  282. line-height: 80rpx;
  283. text-align: center;
  284. }
  285. .upload{
  286. width: 702rpx;
  287. margin: 48rpx 0 48rpx 24rpx;
  288. }
  289. </style>